1
0
Fork 0
forked from svrjs/svrjs

Optimize HTTP/1.x compatibility header setting

This commit is contained in:
Dorian Niemiec 2024-03-09 16:00:19 +01:00
parent 6c8873ce3f
commit 7b0038754e

5
svr.js
View file

@ -2946,8 +2946,9 @@ if (!cluster.isPrimary) {
// Set HTTP/1.x headers // Set HTTP/1.x headers
if (!req.headers.host) req.headers.host = req.headers[":authority"]; if (!req.headers.host) req.headers.host = req.headers[":authority"];
(req.headers[":path"] == undefined ? (function () {})() : req.url = req.headers[":path"]); if (!req.url) req.url = req.headers[":path"];
req.protocol = req.headers[":scheme"]; if (!req.protocol) req.protocol = req.headers[":scheme"];
if (!req.method) req.method = req.headers[":method"];
if (req.headers[":path"] == undefined || req.headers[":method"] == undefined) { if (req.headers[":path"] == undefined || req.headers[":method"] == undefined) {
var cheaders = getCustomHeaders(); var cheaders = getCustomHeaders();
cheaders["Content-Type"] = "text/html; charset=utf-8"; cheaders["Content-Type"] = "text/html; charset=utf-8";