Skip to content

Commit

Permalink
use regex to check for upgrade header
Browse files Browse the repository at this point in the history
in websocket connections
  • Loading branch information
minrk committed Sep 16, 2014
1 parent 51eeebe commit 65a21bc
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/http-proxy/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ common.setupOutgoing = function(outgoing, options, req, forward) {
if (!outgoing.agent) {
outgoing.headers = outgoing.headers || {};
if (typeof outgoing.headers.connection !== 'string'
|| !outgoing.headers.connection.toLowerCase().split(',').some(
function (s) { if (s.trim() === 'upgrade') { return true; } })
|| ! /(^|,)\s*upgrade\s*($|,)/i.test(outgoing.headers.connection)
) { outgoing.headers.connection = 'close'; }
}

Expand Down

0 comments on commit 65a21bc

Please sign in to comment.