Permalink
Browse files

comments

  • Loading branch information...
1 parent 637cf3a commit 8b03aefcacf03065b0b90061eba202d9be362263 @hueniverse committed Jun 23, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/utils.js
View
@@ -44,10 +44,10 @@ exports.parseHost = function (req, hostHeaderName) {
var hostHeaderRegex;
if (hostHeader[0] === '[') {
- hostHeaderRegex = /^(?:(?:\r\n)?\s)*(\[[^\]]+\])(?::(\d+))?(?:(?:\r\n)?\s)*$/;
+ hostHeaderRegex = /^(?:(?:\r\n)?\s)*(\[[^\]]+\])(?::(\d+))?(?:(?:\r\n)?\s)*$/; // IPv6
}
else {
- hostHeaderRegex = /^(?:(?:\r\n)?\s)*([^:]+)(?::(\d+))?(?:(?:\r\n)?\s)*$/;
+ hostHeaderRegex = /^(?:(?:\r\n)?\s)*([^:]+)(?::(\d+))?(?:(?:\r\n)?\s)*$/; // IPv4, hostname
}
var hostParts = hostHeader.match(hostHeaderRegex);

0 comments on commit 8b03aef

Please sign in to comment.