Skip to content

_http_common ParserIncomingMessage fails to check for undefined on parser.socket.server[kIncomingMessage] #20151

Closed
@nyxtom

Description

@nyxtom

node/lib/_http_common.js

Lines 78 to 82 in 15e41a9

var ParserIncomingMessage = parser.socket && parser.socket.server ?
parser.socket.server[kIncomingMessage] : IncomingMessage;
parser.incoming = new ParserIncomingMessage(parser.socket);
parser.incoming.httpVersionMajor = versionMajor;

Due to this line of code, if parser.socket.server[kIncomingMessage] is undefined, an error will be thrown on the line below where the ParserIncomingMessage is constructed. A simple additional check here would solve this issue. A few libraries have cropped this up in socket.io, ws and some others that weren't happening in previous versions of node.

Node version: 9.6.0
Platform: OSX

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateIssues and PRs that are duplicates of other issues or PRs.httpIssues or PRs related to the http subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions