| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 063a83c commit c5ae814
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -135,7 +135,6 @@ function OutgoingMessage() { | |||
| 135 | 135 | this._header = null; | |
| 136 | 136 | this[kOutHeaders] = null; | |
| 137 | 137 | ||
| 138 | - this._maxRequestsPerSocket = null; | ||
| 139 | 138 | this._keepAliveTimeout = 0; | |
| 140 | 139 | ||
| 141 | 140 | this._onPendingData = nop; | |
@@ -448,7 +447,9 @@ function _storeHeader(firstLine, headers) { | |||
| 448 | 447 | } else if (!state.connection) { | |
| 449 | 448 | const shouldSendKeepAlive = this.shouldKeepAlive && | |
| 450 | 449 | (state.contLen || this.useChunkedEncodingByDefault || this.agent); | |
| 451 | - if (shouldSendKeepAlive) { | ||
| 450 | + if (shouldSendKeepAlive && this.maxRequestsOnConnectionReached) { | ||
| 451 | + header += 'Connection: close\r\n'; | ||
| 452 | + } else if (shouldSendKeepAlive) { | ||
| 452 | 453 | header += 'Connection: keep-alive\r\n'; | |
| 453 | 454 | if (this._keepAliveTimeout && this._defaultKeepAlive) { | |
| 454 | 455 | const timeoutSeconds = MathFloor(this._keepAliveTimeout / 1000); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -877,7 +877,6 @@ function parserOnIncoming(server, socket, state, req, keepAlive) { | |||
| 877 | 877 | ||
| 878 | 878 | const res = new server[kServerResponse](req); | |
| 879 | 879 | res._keepAliveTimeout = server.keepAliveTimeout; | |
| 880 | - res._maxRequestsPerSocket = server.maxRequestsPerSocket; | ||
| 881 | 880 | res._onPendingData = updateOutgoingData.bind(undefined, | |
| 882 | 881 | socket, state); | |
| 883 | 882 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,11 +10,11 @@ const bodySent = 'This is my request'; | |||
| 10 | 10 | function assertResponse(headers, body, expectClosed) { | |
| 11 | 11 | if (expectClosed) { | |
| 12 | 12 | assert.match(headers, /Connection: close\r\n/m); | |
| 13 | - assert.strictEqual(headers.search(/Keep-Alive: timeout=5, max=3\r\n/m), -1); | ||
| 13 | + assert.strictEqual(headers.search(/Keep-Alive: timeout=5\r\n/m), -1); | ||
| 14 | 14 | assert.match(body, /Hello World!/m); | |
| 15 | 15 | } else { | |
| 16 | 16 | assert.match(headers, /Connection: keep-alive\r\n/m); | |
| 17 | - assert.match(headers, /Keep-Alive: timeout=5, max=3\r\n/m); | ||
| 17 | + assert.match(headers, /Keep-Alive: timeout=5\r\n/m); | ||
| 18 | 18 | assert.match(body, /Hello World!/m); | |
| 19 | 19 | } | |
| 20 | 20 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,11 +10,11 @@ const bodySent = 'This is my request'; | |||
| 10 | 10 | function assertResponse(headers, body, expectClosed) { | |
| 11 | 11 | if (expectClosed) { | |
| 12 | 12 | assert.match(headers, /Connection: close\r\n/m); | |
| 13 | - assert.strictEqual(headers.search(/Keep-Alive: timeout=5, max=3\r\n/m), -1); | ||
| 13 | + assert.strictEqual(headers.search(/Keep-Alive: timeout=5\r\n/m), -1); | ||
| 14 | 14 | assert.match(body, /Hello World!/m); | |
| 15 | 15 | } else { | |
| 16 | 16 | assert.match(headers, /Connection: keep-alive\r\n/m); | |
| 17 | - assert.match(headers, /Keep-Alive: timeout=5, max=3\r\n/m); | ||
| 17 | + assert.match(headers, /Keep-Alive: timeout=5\r\n/m); | ||
| 18 | 18 | assert.match(body, /Hello World!/m); | |
| 19 | 19 | } | |
| 20 | 20 | } | |
@@ -75,7 +75,7 @@ server.listen(0, common.mustCall((res) => { | |||
| 75 | 75 | ||
| 76 | 76 | assert.match(responseParts[6], /HTTP\/1\.1 503 Service Unavailable/m); | |
| 77 | 77 | assert.match(responseParts[6], /Connection: close\r\n/m); | |
| 78 | - assert.strictEqual(responseParts[6].search(/Keep-Alive: timeout=5, max=3\r\n/m), -1); | ||
| 78 | + assert.strictEqual(responseParts[6].search(/Keep-Alive: timeout=5\r\n/m), -1); | ||
| 79 | 79 | assert.strictEqual(responseParts[7].search(/Hello World!/m), -1); | |
| 80 | 80 | ||
| 81 | 81 | socket.end(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments