Skip to content

Commit 59b71c0

Browse files
committed
[minor] Style compliance. Fixes #402.
1 parent 985025c commit 59b71c0

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

lib/node-http-proxy/http-proxy.js

+7-13
Original file line numberDiff line numberDiff line change
@@ -716,8 +716,7 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, upgradeHead,
716716
// In addition, it's important to note the closure scope here. Since
717717
// there is no mapping of the socket to the request bound to it.
718718
//
719-
reverseProxy.on('upgrade', function ( res, remoteSocket, head) {
720-
719+
reverseProxy.on('upgrade', function (res, remoteSocket, head) {
721720
//
722721
// Prepare handshake response 'headers' and 'statusCode'.
723722
//
@@ -741,27 +740,22 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, upgradeHead,
741740
//
742741
reverseProxy.once('socket', function (revSocket) {
743742
revSocket.on('data', function handshake (data) {
744-
745743
// Set empty headers
746744
var headers = '';
747745

748746
//
749747
// If the handshake statusCode 101, concat headers.
750748
//
751-
if(reverseProxy.handshake.statusCode && reverseProxy.handshake.statusCode == 101){
752-
749+
if (reverseProxy.handshake.statusCode && reverseProxy.handshake.statusCode == 101) {
753750
headers = [
754-
'HTTP/1.1 101 Switching Protocols'
755-
, 'Upgrade: websocket'
756-
, 'Connection: Upgrade'
757-
, 'Sec-WebSocket-Accept: ' + reverseProxy.handshake.headers['sec-websocket-accept']
751+
'HTTP/1.1 101 Switching Protocols',
752+
'Upgrade: websocket',
753+
'Connection: Upgrade',
754+
'Sec-WebSocket-Accept: ' + reverseProxy.handshake.headers['sec-websocket-accept']
758755
];
759756

760757
headers = headers.concat('', '').join('\r\n');
761-
762758
}
763-
764-
765759

766760
//
767761
// Ok, kind of harmfull part of code. Socket.IO sends a hash
@@ -793,7 +787,7 @@ HttpProxy.prototype.proxyWebSocketRequest = function (req, socket, upgradeHead,
793787
//
794788
self.emit('websocket:handshake', req, socket, head, sdata, data);
795789
// add headers to the socket
796-
socket.write(headers+sdata);
790+
socket.write(headers + sdata);
797791
var flushed = socket.write(data);
798792
if (!flushed) {
799793
revSocket.pause();

0 commit comments

Comments
 (0)