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

Strip port suffix from Host header if the protocol is known #588

Closed
sindresorhus opened this issue Aug 24, 2018 · 3 comments
Closed

Strip port suffix from Host header if the protocol is known #588

sindresorhus opened this issue Aug 24, 2018 · 3 comments
Labels
enhancement This change will extend Got features ✭ help wanted ✭

Comments

@sindresorhus
Copy link
Owner

See request/request#2904

@sindresorhus sindresorhus added enhancement This change will extend Got features ✭ help wanted ✭ labels Aug 24, 2018
@szmarczak
Copy link
Collaborator

> require('.')('http://httpbin.org/anything').then(resp => console.log(resp.body)) // using master
...
> {
  "args": {},
  "data": "",
  "files": {},
  "form": {},
  "headers": {
    "Accept-Encoding": "gzip, deflate",
    "Connection": "close",
    "Host": "httpbin.org",
    "User-Agent": "got/9.1.0 (https://github.com/sindresorhus/got)"
  },
  "json": null,
  "method": "GET",
  "origin": "xxx.xxx.xxx.xxx",
  "url": "http://httpbin.org/anything"
}

Wireshark log:

Hypertext Transfer Protocol
    GET /anything HTTP/1.1\r\n
    user-agent: got/9.1.0 (https://github.com/sindresorhus/got)\r\n
    accept-encoding: gzip, deflate\r\n
    Host: httpbin.org\r\n
    Connection: close\r\n
    \r\n
    [Full request URI: http://httpbin.org/anything]
    [HTTP request 1/1]

@sindresorhus
Copy link
Owner Author

Ok, great. We should at least implement the same tests as https://github.com/request/request/pull/2904/files#diff-5db92d37ce5156ccbf7499555bdd0bf9R183 so we don't accidentally regress in the future.

@szmarczak
Copy link
Collaborator

Will do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This change will extend Got features ✭ help wanted ✭
Projects
None yet
Development

No branches or pull requests

2 participants