Skip to content

Commit 3b4f14c

Browse files
authored
Send Host header indentical to the target URI
According to RFC7230, section 5.4.
1 parent c30a9dc commit 3b4f14c

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

src/agent.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,9 @@ export default class HttpsProxyAgent extends Agent {
109109
).toString('base64')}`;
110110
}
111111

112-
// The `Host` header should only include the port
113-
// number when it is not the default port.
114-
let { host, port, secureEndpoint } = opts;
115-
if (!isDefaultPort(port, secureEndpoint)) {
116-
host += `:${port}`;
117-
}
118-
headers.Host = host;
119-
112+
headers.Host = hostname;
120113
headers.Connection = 'close';
114+
121115
for (const name of Object.keys(headers)) {
122116
payload += `${name}: ${headers[name]}\r\n`;
123117
}

0 commit comments

Comments
 (0)