mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
[fix] minor and short fixes
This commit is contained in:
parent
1993faf8a4
commit
e0faaaf811
@ -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;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user