-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add test: req.host should work with IPv6 Host #875
Conversation
Current coverage is 100% (diff: 100%)@@ master #875 diff @@
====================================
Files 4 4
Lines 417 420 +3
Methods 81 81
Messages 0 0
Branches 102 104 +2
====================================
+ Hits 417 420 +3
Misses 0 0
Partials 0 0
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@dougwilson what do you think? i haven't seen ipv6 host names in the wild |
The |
req.header.host = '[::1]:3000'; | ||
assert.equal(req.hostname, '[::1]'); | ||
}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What should req.hostname be if req.host is [::1]
without the port? Or is req.host guaranteed with port attached such as [::1]:80
?
Otherwise, if req.host were [::1]
, this req.hostname would be [::
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Change needs to take into account that port is optional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we convert the ipv6 address to real one? [::1]:3000
look like not real.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
::1
is the short hand for the main loopback address (the IPv6 version of 127.0.0.1).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No description provided.