Skip to content

Commit e0faaaf

Browse files
committed
[fix] minor and short fixes
1 parent 1993faf commit e0faaaf

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

lib/caronte/passes/ws.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ var passes = exports;
2020
*/
2121

2222
function checkMethodAndHeader (req, res, options) {
23-
if (req.method !== 'GET' || req.headers.upgrade.toLowerCase() !== 'websocket') {
24-
req.end();
25-
26-
return true;
23+
if (req.method !== 'GET' || !req.headers.upgrade) {
24+
req.end(); return true;
25+
}
26+
27+
if (req.headers.upgrade.toLowerCase() !== 'websocket') {
28+
req.end(); return true;
2729
}
2830
},
2931

lib/caronte/streams/proxy.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ var Duplex = require('stream').Duplex,
33
http = require('http'),
44
https = require('https');
55

6+
module.exports = ProxyStream;
7+
68
function ProxyStream(options, res) {
79
Duplex.call(this);
810

@@ -100,5 +102,3 @@ ProxyStream.prototype._read = function(size) {
100102

101103
this.push(chunk);
102104
};
103-
104-
module.exports = ProxyStream;

lib/caronte/streams/websocket.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
var Duplex = require('stream').Duplex,
2-
common = require('common'),
2+
common = require('../common'),
33
http = require('http'),
44
https = require('https');
55

6+
module.exports = WebsocketStream;
7+
68
function WebsocketStream(options, res) {
79
Duplex.call(this);
810

@@ -34,7 +36,7 @@ WebsocketStream.prototype.onPipe = function(req) {
3436
});
3537
};
3638

37-
WebsocketStream.prototye.onFinish = function() {
39+
WebsocketStream.prototype.onFinish = function() {
3840
this.proxyReq.end();
3941
};
4042

@@ -55,7 +57,4 @@ WebsocketStream.prototype._write = function(chunk, encoding, callback) {
5557

5658
WebsocketStream.prototype._read = function(size) {
5759

58-
};
59-
60-
61-
WebsocketStream.prototype
60+
};

0 commit comments

Comments
 (0)