事件:'connect'


【Event: 'connect'

每当客户端请求 HTTP CONNECT 方法时都会触发此事件。如果没有监听此事件,请求 CONNECT 方法的客户端其连接将被关闭。

【Emitted each time a client requests an HTTP CONNECT method. If this event is not listened for, then clients requesting a CONNECT method will have their connections closed.】

此事件保证会传递一个 <net.Socket> 类的实例,该类是 <stream.Duplex> 的子类,除非用户指定了其他类型的套接字而不是 <net.Socket>

【This event is guaranteed to be passed an instance of the <net.Socket> class, a subclass of <stream.Duplex>, unless the user specifies a socket type other than <net.Socket>.】

在此事件被触发后,请求的套接字将不会有 'data' 事件监听器,这意味着需要绑定监听器才能处理发送到该套接字的服务器数据。

【After this event is emitted, the request's socket will not have a 'data' event listener, meaning it will need to be bound in order to handle data sent to the server on that socket.】