Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Port number in Host request header is forced to be specified #23

Closed
mandel59 opened this issue Aug 22, 2018 · 0 comments · Fixed by #36
Closed

Port number in Host request header is forced to be specified #23

mandel59 opened this issue Aug 22, 2018 · 0 comments · Fixed by #36

Comments

@mandel59
Copy link

mandel59 commented Aug 22, 2018

Code to reproduce:

const http = require("http");
const ProxyAgent = require("proxy-agent");

function main() {
  const agent = new ProxyAgent(null);
  const req = http.request(
    {
      protocol: "http:",
      host: "example.com",
      path: "/",
      agent
    },
    res => {}
  );
  req.end();
  console.log("Host:", req.getHeader("Host"));
}

if (typeof require != "undefined" && require.main == module) {
  main();
}

Expected: The value of Host request header is www.example.com
Actual: The value of Host request header is www.example.com:80

To set Agent.prototype.defaultPort (undocumented) property to 80 solves this issue.

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

Successfully merging a pull request may close this issue.

1 participant