fulmine.js 5.13.0 → 5.13.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/router.js +10 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fulmine.js",
3
- "version": "5.13.0",
3
+ "version": "5.13.1",
4
4
  "description": "Drop-in Express 5 replacement on uWebSockets.js. Your existing middleware keeps working.",
5
5
  "main": "src/index.js",
6
6
  "exports": {
package/src/router.js CHANGED
@@ -893,6 +893,16 @@ function onNativeAborted() {
893
893
  // error goes only to whoever listens for it, since a destroy(err) with no listener
894
894
  // would take down the process
895
895
  request.emit("aborted");
896
+ // and the response dies between the two, which is where node puts it. Destroyed rather than
897
+ // told to emit 'close', because being destroyed is the state express is in here and everything
898
+ // after it follows from that state rather than having to be reproduced: 'close' goes out once,
899
+ // a later res.write returns false and calls its callback with ERR_STREAM_DESTROYED, and no
900
+ // 'error' is emitted, which a destroy(err) here would.
901
+ //
902
+ // Without this a handler learnt about the abort only from a write failing, so one that had sent
903
+ // its head and gone quiet never learnt at all. `res.on("close")` is where cancellation hangs in
904
+ // every proxy and every streaming endpoint, so it never ran for exactly the shape that needs it.
905
+ response.destroy();
896
906
  request.destroy(request.listenerCount("error") > 0 ? err : undefined);
897
907
  response.socket?.emit("error", err);
898
908
  }