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 jcrugzz committed Apr 19, 2018
1 parent c611484 commit c59de61
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/http-proxy/passes/web-outgoing.js
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 c59de61

Please sign in to comment.