Skip to content

Commit 64a06c5

Browse files
committed
Revert "Error argument for http.ServerRequest 'close'"
Too slow. This reverts commit e7ac6d8.
1 parent 1495625 commit 64a06c5

File tree

5 files changed

+5
-166
lines changed

5 files changed

+5
-166
lines changed

lib/http.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -980,20 +980,12 @@ function connectionListener(socket) {
980980
var self = this;
981981
var outgoing = [];
982982
var incoming = [];
983-
var abortError = null;
984983

985984
function abortIncoming() {
986-
if (!abortError) {
987-
abortError = new Error('http.ServerRequest was aborted by the client');
988-
abortError.code = 'aborted';
989-
}
990-
991985
while (incoming.length) {
992986
var req = incoming.shift();
993-
994-
// @deprecated, should be removed in 0.5.x
995987
req.emit('aborted');
996-
req.emit('close', abortError);
988+
req.emit('close');
997989
}
998990
// abort socket._httpMessage ?
999991
}
@@ -1004,8 +996,6 @@ function connectionListener(socket) {
1004996

1005997
socket.setTimeout(2 * 60 * 1000); // 2 minute timeout
1006998
socket.addListener('timeout', function() {
1007-
abortError = new Error('http.ServerRequest timed out');
1008-
abortError.code = 'timeout';
1009999
socket.destroy();
10101000
});
10111001

test/simple/test-http-request-aborted.js

Lines changed: 0 additions & 44 deletions
This file was deleted.

test/simple/test-http-set-timeout.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ var assert = require('assert');
2424
var http = require('http');
2525

2626
var server = http.createServer(function(req, res) {
27-
console.log('got request. setting 100ms second timeout');
28-
req.connection.setTimeout(100);
29-
30-
req.on('close', function(err) {
31-
assert.strictEqual(err.code, 'timeout');
27+
console.log('got request. setting 1 second timeout');
28+
req.connection.setTimeout(500);
3229

30+
req.connection.addListener('timeout', function() {
31+
req.connection.destroy();
3332
common.debug('TIMEOUT');
3433
server.close();
3534
});

test/simple/test-https-request-aborted.js

Lines changed: 0 additions & 53 deletions
This file was deleted.

test/simple/test-https-request-timeout.js

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)