mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
mm test file
This commit is contained in:
parent
e45bfd66a2
commit
1a7bef0cda
31
ttest.js
31
ttest.js
@ -29,30 +29,25 @@ var srv = http.createServer(function(req, res) {
|
||||
res.end('1');
|
||||
}).listen(8000);
|
||||
|
||||
srv.on('connection', function(s) {
|
||||
s.pipe(process.stdout);
|
||||
});
|
||||
|
||||
srv.on('upgrade', function(req, socket, head) {
|
||||
|
||||
var options = {
|
||||
port: 9090,
|
||||
hostname: '127.0.0.1',
|
||||
headers: req.headers
|
||||
}
|
||||
var req = http.request(options);
|
||||
req.end();
|
||||
socket.on('data', function(d) {
|
||||
console.log('yoo');
|
||||
console.log(d);
|
||||
});
|
||||
var s;
|
||||
req.on('socket', function(ss) {
|
||||
s = ss;
|
||||
});
|
||||
req.on('upgrade', function(res, sock, hd) {
|
||||
/*console.log(hd.toString('utf-8'));
|
||||
var str = Object.keys(res.headers).map(function(i) {
|
||||
return i + ": " + res.headers[i];
|
||||
}).join('\r\n');
|
||||
socket.write("HTTP/1.1 101 Switching Protocols\r\n" + str);
|
||||
var r = http.request(options);
|
||||
|
||||
r.on('upgrade', function(res, sock, hd) {
|
||||
if (hd && hd.length) sock.unshift(hd);
|
||||
|
||||
socket.write(hd);
|
||||
socket.pipe(sock).pipe(socket);*/
|
||||
|
||||
socket.pipe(sock).pipe(socket);
|
||||
});
|
||||
|
||||
r.end();
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user