[fix] minor and short fixes

This commit is contained in:
cronopio 2013-09-10 19:31:47 -05:00
parent 1993faf8a4
commit e0faaaf811
3 changed files with 13 additions and 12 deletions

View File

@ -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;
}
},

View File

@ -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);
@ -100,5 +102,3 @@ ProxyStream.prototype._read = function(size) {
this.push(chunk);
};
module.exports = ProxyStream;

View File

@ -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);
@ -34,7 +36,7 @@ WebsocketStream.prototype.onPipe = function(req) {
});
};
WebsocketStream.prototye.onFinish = function() {
WebsocketStream.prototype.onFinish = function() {
this.proxyReq.end();
};
@ -55,7 +57,4 @@ WebsocketStream.prototype._write = function(chunk, encoding, callback) {
WebsocketStream.prototype._read = function(size) {
};
WebsocketStream.prototype
};