Commit e94a18e
authored
Wire --body-limit into createServer; real CONTENT_LENGTH for chunked git pushes (JavaScriptSolidServer#562)
* fix: wire --body-limit into createServer; real CONTENT_LENGTH for chunked git pushes
Two halves of the same user-facing bug (JavaScriptSolidServer#561) — 'git push of a pack
over 10MB cannot succeed no matter what the operator configures':
1. bin/jss.js start parsed --body-limit / JSS_BODY_LIMIT into
config.bodyLimit and then dropped it — the hand-written options
object passed to createServer() omitted bodyLimit, so every
CLI-started server enforced the 10MiB default. The JavaScriptSolidServer#474 knob was
dead wiring; only programmatic createServer({ bodyLimit }) worked.
2. With the limit actually raised, pushes > 1MiB still died: git sends
packs over http.postBuffer (1MiB) with Transfer-Encoding: chunked
and no Content-Length, and the git handler set the CGI's
CONTENT_LENGTH from the absent header ('0'), so http-backend read
zero bytes and receive-pack failed with 'the remote end hung up
unexpectedly'. Use the buffered body's real length instead.
Regression tests (test/body-limit-cli.test.js) spawn the real CLI and
assert the limit reaches Fastify via flag and env — 2 of 3 fail
without fix 1. Verified end-to-end: 'jss install solid-chat/app=chat
JavaScriptSolidServer/git' (13.6MB / >1MiB packs, previously
impossible) now completes 2/2 with extracted working trees serving
200. Full suite: 961 pass, 0 fail.
Fixes JavaScriptSolidServer#561
* review fix (JavaScriptSolidServer#562): bound stopCli's final await; document why the attach can't race
Copilot flagged a race between the exitCode check and attaching the
'exit' listener. That specific interleaving can't occur — both are in
the same synchronous block, and Node can't emit 'exit' between two
synchronous statements (if the event already fired, exitCode is
non-null and we return before attaching). Documented in a comment.
The comment's spirit stands though: the final `await gone` was
unbounded, so a pathological unkillable child (stuck in
uninterruptible I/O) would hang the suite forever. Capped with a 2s
race — SIGKILL can't be caught, so 'exit' follows promptly in every
realistic case; the bound is belt-and-braces. 3/3 passing.1 parent f3285c5 commit e94a18e
3 files changed
Lines changed: 143 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
193 | 197 | | |
194 | 198 | | |
195 | 199 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
282 | | - | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
283 | 291 | | |
284 | 292 | | |
285 | 293 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
0 commit comments