mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
use regex to check for upgrade header
in websocket connections
This commit is contained in:
parent
51eeebef68
commit
65a21bce6d
@ -53,8 +53,7 @@ common.setupOutgoing = function(outgoing, options, req, forward) {
|
|||||||
if (!outgoing.agent) {
|
if (!outgoing.agent) {
|
||||||
outgoing.headers = outgoing.headers || {};
|
outgoing.headers = outgoing.headers || {};
|
||||||
if (typeof outgoing.headers.connection !== 'string'
|
if (typeof outgoing.headers.connection !== 'string'
|
||||||
|| !outgoing.headers.connection.toLowerCase().split(',').some(
|
|| ! /(^|,)\s*upgrade\s*($|,)/i.test(outgoing.headers.connection)
|
||||||
function (s) { if (s.trim() === 'upgrade') { return true; } })
|
|
||||||
) { outgoing.headers.connection = 'close'; }
|
) { outgoing.headers.connection = 'close'; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user