类:http.IncomingMessage
【Class: http.IncomingMessage】
- 扩展自: <stream.Readable>
IncomingMessage 对象由 http.Server 或 http.ClientRequest 创建,并分别作为 'request' 和 'response' 事件的第一个参数传递。它可用于访问响应状态、头信息和数据。
【An IncomingMessage object is created by http.Server or
http.ClientRequest and passed as the first argument to the 'request'
and 'response' event respectively. It may be used to access response
status, headers, and data.】
与其 socket 值不同,socket 是 <stream.Duplex> 的子类,IncomingMessage 本身继承自 <stream.Readable> 并单独创建,用于解析和发送传入的 HTTP 头和负载,因为在使用 keep-alive 的情况下,底层 socket 可能会被多次重用。
【Different from its socket value which is a subclass of <stream.Duplex>, the
IncomingMessage itself extends <stream.Readable> and is created separately to
parse and emit the incoming HTTP headers and payload, as the underlying socket
may be reused multiple times in case of keep-alive.】