Skip to content

Commit

Permalink
issue #953: stop using writeHead
Browse files Browse the repository at this point in the history
object.keys in web-incoming.js results in a non-deterministic ordering of keys, which means that in web-outgoing writeHead might be called before setHeader, which throws an error
  • Loading branch information
jfurler authored and indexzero committed Apr 20, 2018
1 parent 8097ae2 commit 2c44039
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/http-proxy/passes/web-outgoing.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,10 @@ module.exports = { // <--
writeStatusCode: function writeStatusCode(req, res, proxyRes) {
// From Node.js docs: response.writeHead(statusCode[, statusMessage][, headers])
if(proxyRes.statusMessage) {
res.writeHead(proxyRes.statusCode, proxyRes.statusMessage);
res.statusCode = proxyRes.statusCode;
res.statusMessage = proxyRes.statusMessage;
} else {
res.writeHead(proxyRes.statusCode);
res.statusCode = proxyRes.statusCode;
}
}

Expand Down

0 comments on commit 2c44039

Please sign in to comment.