Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 4 additions & 24 deletions lib/_http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,6 @@ function Server(options, requestListener) {
this.on('request', requestListener);
}

// Similar option to this. Too lazy to write my own docs.
// http://www.squid-cache.org/Doc/config/half_closed_clients/
// https://wiki.squid-cache.org/SquidFaq/InnerWorkings#What_is_a_half-closed_filedescriptor.3F
this.httpAllowHalfOpen = false;

this.on('connection', connectionListener);

this.timeout = 0;
Expand Down Expand Up @@ -580,12 +575,7 @@ function socketOnTimeout() {
}

function socketOnClose(socket, state) {
debug('server socket close');
// Mark this parser as reusable
if (socket.parser) {
freeParser(socket.parser, null, socket);
}

freeParser(socket.parser, null, socket);
abortIncoming(state.incoming);
}

Expand All @@ -601,19 +591,9 @@ function socketOnEnd(server, socket, parser, state) {
const ret = parser.finish();

if (ret instanceof Error) {
debug('parse error');
FunctionPrototypeCall(socketOnError, socket, ret);
return;
}

if (!server.httpAllowHalfOpen) {
abortIncoming(state.incoming);
if (socket.writable) socket.end();
} else if (state.outgoing.length) {
state.outgoing[state.outgoing.length - 1]._last = true;
} else if (socket._httpMessage) {
socket._httpMessage._last = true;
} else if (socket.writable) {
socket.destroy(ret);
} else {
// TODO(ronag): Does end() vs destroy() make any difference?
socket.end();
}
}
Expand Down
2 changes: 0 additions & 2 deletions lib/https.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ function Server(opts, requestListener) {

FunctionPrototypeCall(tls.Server, this, opts, _connectionListener);

this.httpAllowHalfOpen = false;

if (requestListener) {
this.addListener('request', requestListener);
}
Expand Down