Skip to content

Passing options object to http.createServer stops server responding #24105

Closed
@brokencube

Description

  • Version: node 8.12.0
  • Platform: macOS Sierra 10.12.6 (16G1510)
  • uname -a: Darwin [USERNAME] 16.7.0 Darwin Kernel Version 16.7.0: [DATETIME]; root:xnu-3789.73.14~1/RELEASE_X86_64 x86_64
  • Subsystem: http

Example:

"use strict";
const http = require('http');
const options = {};

const server = http.createServer(options, (req, res) => {
    console.log('got here', req, res);
});
server.listen(4000);
# telnet localhost 4000
GET /

Expected: Console.log of "got here"
Actual: No output.

It also doesn't work is options is set to:

const options = {
  IncomingMessage: http.IncomingMessage,
  ServerResponse: http.ServerResponse
}

Is working as expected in v10.13.0

Using node inspect the difference in execution between v8 and v10 seems to be this line:
_http_common.js:117
return parser.onIncoming(parser.incoming, shouldKeepAlive);

Which should be returning a IncomingMessage object, but instead returns nothing. But that's as far as I could get with this.

Calling without the options object - i.e.:

const server = http.createServer((req, res) => {})

Works as expected

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.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