@telorun/http-server 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @telorun/http-server
|
|
2
2
|
|
|
3
|
+
## 0.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e3146f3: Fix spurious request cancellation (HTTP 499) for body-bearing requests whose handler awaits before replying. Per-request cancellation was wired to the request stream's `close` event, which fires as normal cleanup once a request body has been fully received — so any `PUT`/`POST` whose handler did async work (e.g. a DB query) before sending a response was cancelled mid-flight and answered with 499. Cancellation now listens on the response socket, which only closes early on a genuine client disconnect; normal completions and synchronous rejects are unaffected.
|
|
8
|
+
|
|
3
9
|
## 0.8.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -107,9 +107,13 @@ export class HttpServerApi {
|
|
|
107
107
|
};
|
|
108
108
|
const sink = fastifyReplySink(reply);
|
|
109
109
|
// Per-request cancellation: abandon downstream work when the client
|
|
110
|
-
// disconnects before the response is sent.
|
|
110
|
+
// disconnects before the response is sent. Listen on the response
|
|
111
|
+
// socket, not the request stream — the latter's `close` fires as normal
|
|
112
|
+
// cleanup once a request body has been fully received, which would
|
|
113
|
+
// cancel any body-bearing request that awaits (e.g. a DB call) before
|
|
114
|
+
// replying. The response socket only closes early on a real disconnect.
|
|
111
115
|
const cancellation = this.ctx.createCancellationSource();
|
|
112
|
-
|
|
116
|
+
reply.raw.on("close", () => {
|
|
113
117
|
if (!reply.sent)
|
|
114
118
|
cancellation.cancel("client-disconnect");
|
|
115
119
|
});
|
package/package.json
CHANGED
|
@@ -148,9 +148,13 @@ export class HttpServerApi implements ResourceInstance {
|
|
|
148
148
|
const sink = fastifyReplySink(reply);
|
|
149
149
|
|
|
150
150
|
// Per-request cancellation: abandon downstream work when the client
|
|
151
|
-
// disconnects before the response is sent.
|
|
151
|
+
// disconnects before the response is sent. Listen on the response
|
|
152
|
+
// socket, not the request stream — the latter's `close` fires as normal
|
|
153
|
+
// cleanup once a request body has been fully received, which would
|
|
154
|
+
// cancel any body-bearing request that awaits (e.g. a DB call) before
|
|
155
|
+
// replying. The response socket only closes early on a real disconnect.
|
|
152
156
|
const cancellation = this.ctx.createCancellationSource();
|
|
153
|
-
|
|
157
|
+
reply.raw.on("close", () => {
|
|
154
158
|
if (!reply.sent) cancellation.cancel("client-disconnect");
|
|
155
159
|
});
|
|
156
160
|
|