fix(mesh): answer HEAD on a remote GET route (CARD-20, #125)
The teacup's router resolves HEAD to a remote buffered GET through the implicit-HEAD fallback, and OPTIONS advertises HEAD. But the remote route handler forwarded req.method, so the teapot got a HEAD envelope, found no HEAD plan in resolveRoute, and answered 404. Forward a HEAD that matched a remote GET as GET. dispatch already drops the body for HEAD, so the client gets the GET's status and headers and no body, the same as a local route. An explicit remote HEAD route is matched first and is still forwarded as HEAD. The fix is teacup-side (D16, accepted 2026-10-22): the teapot and the wire protocol are unchanged, so a new teacup works against an older teapot during a rolling deploy. Tests cover app.fetch and the Node listener (200 + GET headers + empty body, OPTIONS, explicit HEAD precedence, 404/500 kept with no body, the teapot handler called once as GET) and Deno and Bun. The frozen owner-mesh-allow.json capture changes in the next commit. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
5 files changed
+237
-1
No files matched your search
@@ -148,6 +148,14 @@ npm treats versions as semver and semver forbids leading zeros.
|
||||
Without `trustProxy` it is ignored. Only `edgeHandler` reads it: the Node, Deno and Bun adapters, and a
|
||||
bare `app.fetch`, ignore it as before.
|
||||
|
||||
- **Mesh (alpha): `HEAD` on a remote `GET` route now works** (#125). The teacup resolved `HEAD` to
|
||||
the remote `GET` and `OPTIONS` advertised `HEAD`, but the request went to the teapot as `HEAD`,
|
||||
which has no `HEAD` plan, so it answered `404`. The teacup now forwards it as a `GET` and drops
|
||||
the body, so it answers like a local route: the `GET`'s status and headers, no body, and a
|
||||
`404`/`500` from the route keeps its status. An explicit remote `HEAD` route still takes
|
||||
precedence. The teapot is unchanged, so a new teacup works against an older teapot during a
|
||||
rolling deploy.
|
||||
|
||||
- **`static` no longer serves files outside its root through a symlink** (#106). The traversal guard
|
||||
compared paths lexically, and the file read then followed symlinks, so `public/leak -> /etc/hosts`
|
||||
was served. Containment now compares real paths: the requested file, and a directory's
|
||||
|
||||
Reference in new issue
Block a user