Skip to content
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

Closed
wants to merge 3 commits into from
Closed

add test: req.host should work with IPv6 Host #875

wants to merge 3 commits into from

Conversation

i5ting
Copy link

@i5ting i5ting commented Dec 27, 2016

No description provided.

@codecov-io
Copy link

codecov-io commented Dec 27, 2016

Current coverage is 100% (diff: 100%)

Merging #875 into master will not change coverage

@@           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          

Powered by Codecov. Last update 948d3ef...c61e6af

Copy link
Member

@fengmk2 fengmk2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jonathanong
Copy link
Member

@dougwilson what do you think?

i haven't seen ipv6 host names in the wild

@dougwilson
Copy link
Contributor

The Host: [::1] and Host: [::1]:3000 are the headers one would see in the wild. Including the [ and ] in the hostname result seems to be the correct results AFAICT.

req.header.host = '[::1]:3000';
assert.equal(req.hostname, '[::1]');
})

Copy link

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 [::.

Copy link
Contributor

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.

Copy link
Member

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.

Copy link
Contributor

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).

Copy link
Member

@jonathanong jonathanong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants