Skip to content

Commit

Permalink
[fix] minor and short fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cronopio committed Sep 11, 2013
1 parent 1993faf commit e0faaaf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
10 changes: 6 additions & 4 deletions lib/caronte/passes/ws.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ var passes = exports;
*/

function checkMethodAndHeader (req, res, options) {
if (req.method !== 'GET' || req.headers.upgrade.toLowerCase() !== 'websocket') {
req.end();

return true;
if (req.method !== 'GET' || !req.headers.upgrade) {
req.end(); return true;
}

if (req.headers.upgrade.toLowerCase() !== 'websocket') {
req.end(); return true;
}
},

Expand Down
4 changes: 2 additions & 2 deletions lib/caronte/streams/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ var Duplex = require('stream').Duplex,
http = require('http'),
https = require('https');

module.exports = ProxyStream;

function ProxyStream(options, res) {
Duplex.call(this);

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

this.push(chunk);
};

module.exports = ProxyStream;
11 changes: 5 additions & 6 deletions lib/caronte/streams/websocket.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
var Duplex = require('stream').Duplex,
common = require('common'),
common = require('../common'),
http = require('http'),
https = require('https');

module.exports = WebsocketStream;

function WebsocketStream(options, res) {
Duplex.call(this);

Expand Down Expand Up @@ -34,7 +36,7 @@ WebsocketStream.prototype.onPipe = function(req) {
});
};

WebsocketStream.prototye.onFinish = function() {
WebsocketStream.prototype.onFinish = function() {
this.proxyReq.end();
};

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

WebsocketStream.prototype._read = function(size) {

};


WebsocketStream.prototype
};

0 comments on commit e0faaaf

Please sign in to comment.