-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
Closed
Labels
domainIssues and PRs related to the domain subsystem.Issues and PRs related to the domain subsystem.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.Issues that need assistance from volunteers or PRs that need help to proceed.httpIssues or PRs related to the http subsystem.Issues or PRs related to the http subsystem.
Description
- Version: 10.13.0
- Platform: Linux themachine.novalocal 3.10.0-862.14.4.el7.x86_64 deps: update openssl to 1.0.1j #1 SMP Wed Sep 26 15:12:11 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
If an error is thrown while handling a request and then it is caught by an error domain, the second request coming on the same connection is not parsed correctly and the server returns 400 Bad Request.
I managed to reproduce this using a simple example. Server code:
'use strict';
var ed = require('domain');
var http = require('http');
var count = 0;
var server = http.createServer(function(request, response) {
var d = ed.createDomain();
d.on('error', function() {
console.log("request", count++);
response.statusCode = 500;
response.end();
});
d.enter();
throw new Error("Something wrong happened.");
d.exit();
});
server.listen(8092, "127.0.0.1", function() {
console.log("connected");
});
Make the requests:
# curl -v 'http://127.0.0.1:8092' 'http://127.0.0.1:8092'
* About to connect() to 127.0.0.1 port 8092 (#0)
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8092 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 127.0.0.1:8092
> Accept: */*
>
< HTTP/1.1 500 Internal Server Error
< Date: Tue, 11 Dec 2018 09:49:43 GMT
< Connection: keep-alive
< Content-Length: 0
<
* Connection #0 to host 127.0.0.1 left intact
* Found bundle for host 127.0.0.1: 0x2283ec0
* Re-using existing connection! (#0) with host 127.0.0.1
* Connected to 127.0.0.1 (127.0.0.1) port 8092 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 127.0.0.1:8092
> Accept: */*
>
< HTTP/1.1 400 Bad Request
* no chunk, no close, no size. Assume close to signal end
<
* Closing connection 0
From what I found, the parser returns a HPE_CB_headers_complete error code. Most probably, the parser's internal state gets messed up or does not get to update when the error is thrown.
Metadata
Metadata
Assignees
Labels
domainIssues and PRs related to the domain subsystem.Issues and PRs related to the domain subsystem.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.Issues that need assistance from volunteers or PRs that need help to proceed.httpIssues or PRs related to the http subsystem.Issues or PRs related to the http subsystem.