handle 'upgrade' in comma-separated connection header

Firefox sends `keep-alive, upgrade`, not just `upgrade`,
which the proxy incorrectly turned into `close`
This commit is contained in:
MinRK 2014-09-01 21:25:37 -07:00
parent 554f59c518
commit 51eeebef68

View File

@ -53,7 +53,8 @@ common.setupOutgoing = function(outgoing, options, req, forward) {
if (!outgoing.agent) {
outgoing.headers = outgoing.headers || {};
if (typeof outgoing.headers.connection !== 'string'
|| outgoing.headers.connection.toLowerCase() !== 'upgrade'
|| !outgoing.headers.connection.toLowerCase().split(',').some(
function (s) { if (s.trim() === 'upgrade') { return true; } })
) { outgoing.headers.connection = 'close'; }
}