@@ -93,7 +93,7 @@ not be emitted.
9393
9494### Event: 'connect'
9595
96- ` function (request, socket, head ) { } `
96+ ` function (request, socket) { } `
9797
9898Emitted each time a client requests a http CONNECT method. If this event isn't
9999listened for, then clients requesting a CONNECT method will have their
@@ -102,16 +102,14 @@ connections closed.
102102* ` request ` is the arguments for the http request, as it is in the request
103103 event.
104104* ` socket ` is the network socket between the server and client.
105- * ` head ` is an instance of Buffer, the first packet of the tunneling stream,
106- this may be empty.
107105
108106After this event is emitted, the request's socket will not have a ` data `
109107event listener, meaning you will need to bind to it in order to handle data
110108sent to the server on that socket.
111109
112110### Event: 'upgrade'
113111
114- ` function (request, socket, head ) { } `
112+ ` function (request, socket) { } `
115113
116114Emitted each time a client requests a http upgrade. If this event isn't
117115listened for, then clients requesting an upgrade will have their connections
@@ -120,7 +118,6 @@ closed.
120118* ` request ` is the arguments for the http request, as it is in the request
121119 event.
122120* ` socket ` is the network socket between the server and client.
123- * ` head ` is an instance of Buffer, the first packet of the upgraded stream,
124121 this may be empty.
125122
126123After this event is emitted, the request's socket will not have a ` data `
@@ -595,7 +592,7 @@ Emitted after a socket is assigned to this request.
595592
596593### Event: 'connect'
597594
598- ` function (response, socket, head ) { } `
595+ ` function (response, socket) { } `
599596
600597Emitted each time a server responds to a request with a CONNECT method. If this
601598event isn't being listened for, clients receiving a CONNECT method will have
@@ -612,14 +609,13 @@ A client server pair that show you how to listen for the `connect` event.
612609 res.writeHead(200, {'Content-Type': 'text/plain'});
613610 res.end('okay');
614611 });
615- proxy.on('connect', function(req, cltSocket, head ) {
612+ proxy.on('connect', function(req, cltSocket) {
616613 // connect to an origin server
617614 var srvUrl = url.parse('http://' + req.url);
618615 var srvSocket = net.connect(srvUrl.port, srvUrl.hostname, function() {
619616 cltSocket.write('HTTP/1.1 200 Connection Established\r\n' +
620617 'Proxy-agent: Node-Proxy\r\n' +
621618 '\r\n');
622- srvSocket.write(head);
623619 srvSocket.pipe(cltSocket);
624620 cltSocket.pipe(srvSocket);
625621 });
@@ -639,7 +635,7 @@ A client server pair that show you how to listen for the `connect` event.
639635 var req = http.request(options);
640636 req.end();
641637
642- req.on('connect', function(res, socket, head ) {
638+ req.on('connect', function(res, socket) {
643639 console.log('got connected!');
644640
645641 // make a request over an HTTP tunnel
@@ -658,7 +654,7 @@ A client server pair that show you how to listen for the `connect` event.
658654
659655### Event: 'upgrade'
660656
661- ` function (response, socket, head ) { } `
657+ ` function (response, socket) { } `
662658
663659Emitted each time a server responds to a request with an upgrade. If this
664660event isn't being listened for, clients receiving an upgrade header will have
@@ -673,7 +669,7 @@ A client server pair that show you how to listen for the `upgrade` event.
673669 res.writeHead(200, {'Content-Type': 'text/plain'});
674670 res.end('okay');
675671 });
676- srv.on('upgrade', function(req, socket, head ) {
672+ srv.on('upgrade', function(req, socket) {
677673 socket.write('HTTP/1.1 101 Web Socket Protocol Handshake\r\n' +
678674 'Upgrade: WebSocket\r\n' +
679675 'Connection: Upgrade\r\n' +
@@ -698,7 +694,7 @@ A client server pair that show you how to listen for the `upgrade` event.
698694 var req = http.request(options);
699695 req.end();
700696
701- req.on('upgrade', function(res, socket, upgradeHead ) {
697+ req.on('upgrade', function(res, socket) {
702698 console.log('got upgraded!');
703699 socket.end();
704700 process.exit(0);
0 commit comments