-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src,http: fix uncaughtException miss in http
In AsyncWrap::MakeCallback always return empty handle if there is an error. In the future this should change to return a v8::MaybeLocal, but that major change will have to wait for v6.x, and these changes are meant to be backported to v4.x. The HTTParser call to AsyncWrap::MakeCallback failed because it expected a thrown call to return an empty handle. In node::MakeCallback return an empty handle if the call is in_makecallback(), otherwise return v8::Undefined() as usual to preserve backwards compatibility. Ref: #7048 Fixes: #5555 PR-URL: #5591 Reviewed-By: Julien Gilli <jgilli@nodejs.org>
- Loading branch information
1 parent
6f312b3
commit 63356df
Showing
3 changed files
with
31 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const http = require('http'); | ||
|
||
const uncaughtCallback = common.mustCall(function(er) { | ||
assert.equal(er.message, 'get did fail'); | ||
}); | ||
|
||
process.on('uncaughtException', uncaughtCallback); | ||
|
||
const server = http.createServer(function(req, res) { | ||
res.writeHead(200, { 'Content-Type': 'text/plain' }); | ||
res.end('bye'); | ||
}).listen(common.PORT, function() { | ||
http.get({ port: common.PORT }, function(res) { | ||
res.resume(); | ||
throw new Error('get did fail'); | ||
}).on('close', function() { | ||
server.close(); | ||
}); | ||
}); |