Commit f5c0e282 authored by Alba Mendez's avatar Alba Mendez
Browse files

http2: allow Host in HTTP/2 requests

The HTTP/2 spec allows Host to be used instead of :authority in
requests, and this is in fact *preferred* when converting from HTTP/1.

We erroneously treated Host as a connection header, thus disallowing
it in requests. The patch corrects this, aligning Node.js behaviour
with the HTTP/2 spec and with nghttp2:

 - Treat Host as a single-value header instead of a connection header.
 - Don't autofill :authority if Host is present.
 - The compatibility API (request.authority) falls back to using Host
   if :authority is not present.

This is semver-major because requests are no longer guaranteed to
have :authority set. An explanatory note was added to the docs.

Fixes: https://github.com/nodejs/node/issues/29858

PR-URL: https://github.com/nodejs/node/pull/34664


Reviewed-By: default avatarJames M Snell <jasnell@gmail.com>
Reviewed-By: default avatarGerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: default avatarYongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: default avatarMatteo Collina <matteo.collina@gmail.com>
Reviewed-By: default avatarAnna Henningsen <anna@addaleax.net>
Reviewed-By: default avatarRich Trott <rtrott@gmail.com>
Reviewed-By: default avatarRicky Zhou <0x19951125@gmail.com>
parent 42a3a7f9
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment