Skip to content

Node 4 breaks making 16kb or greater requests #2821

@geek

Description

@geek

Related to this PR: #2355
In iojs 3.2.0 the following code works, in iojs 3.3.0 and node 4 the following code throws an error.

var Http = require('http');
var Url = require('url');

var server = Http.createServer(function (req, res) {

    res.writeHead(200);
    res.end();
});
server.listen(8080);

var uri = Url.parse('http://localhost:8080/');
uri.method = 'post';
var req = Http.request(uri);

var payload = new Array(1640).join('0123456789');
req.write(payload);
req.end();

Error:

_http_server.js:515
  this._handle.readStart();
              ^

TypeError: Cannot read property 'readStart' of null
    at Socket.onSocketResume (_http_server.js:515:15)
    at emitNone (events.js:67:13)
    at Socket.emit (events.js:166:7)
    at resume_ (_stream_readable.js:712:10)
    at doNTCallback2 (node.js:429:9)
    at process._tickCallback (node.js:343:17)

If you change the payload size to just under 16kb it works:

var Http = require('http');
var Url = require('url');

var server = Http.createServer(function (req, res) {

    res.writeHead(200);
    res.end();
});
server.listen(8080);

var uri = Url.parse('http://localhost:8080/');
uri.method = 'post';
var req = Http.request(uri);

var payload = new Array(1639).join('0123456789');
req.write(payload);
req.end();

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.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