GeezerVison is showing github.com — http: use cached '1.1' http version string · nodejs/node@ade1175
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: lib/_http_common.js +5-1Lines changed: 5 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -64,6 +64,8 @@ function parserOnHeaders(headers, url) { |
64 | 64 | this._url += url; |
65 | 65 | } |
66 | 66 |
|
| 67 | +const HTTP_VERSION_1_1 = '1.1'; |
| 68 | + |
67 | 69 | // `headers` and `url` are set only if .onHeaders() has not been called for |
68 | 70 | // this request. |
69 | 71 | // `url` is not set for response parsers but that's not applicable here since |
@@ -91,7 +93,9 @@ function parserOnHeadersComplete(versionMajor, versionMinor, headers, method, |
91 | 93 | const incoming = parser.incoming = new ParserIncomingMessage(socket); |
92 | 94 | incoming.httpVersionMajor = versionMajor; |
93 | 95 | incoming.httpVersionMinor = versionMinor; |
94 | | - incoming.httpVersion = `${versionMajor}.${versionMinor}`; |
| 96 | + incoming.httpVersion = versionMajor === 1 && versionMinor === 1 ? |
| 97 | + HTTP_VERSION_1_1 : |
| 98 | + `${versionMajor}.${versionMinor}`; |
95 | 99 | incoming.joinDuplicateHeaders = socket?.server?.joinDuplicateHeaders || |
96 | 100 | parser.joinDuplicateHeaders; |
97 | 101 | incoming.url = url; |
|