Skip to content

Commit 31a30c6

Browse files
committed
Close connections after serving requests if FCGI_KEEP_CONN flag is missing
1 parent 64f5562 commit 31a30c6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/server.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,13 @@ function connectionListener(socket) {
131131
reason = fcgi.records.EndRequest.protocolStatus.REQUEST_COMPLETE;
132132
}
133133

134-
if (!socket.destroyed) {
134+
if (socket.writable && !socket.destroyed) {
135135
stream.writeRecord(
136136
id, new fcgi.records.EndRequest(status, reason));
137+
138+
if (id in requests && !requests[id]._keepAlive) {
139+
socket.end();
140+
}
137141
}
138142

139143
delete requests[id];

0 commit comments

Comments
 (0)