Commit graph Crafter.Network/interfaces/Crafter.Network-HTTP.cppm
Author SHA1 Message Date
catbot
4d5ef7c96b feat(http1): dispatch unmatched paths to an optional fallback handler
The route map only answers paths that are known when the listener is
built. A route with an unbounded segment — /shop/<slug>, /order/<token>,
/posts/<id> — cannot be pre-registered: the token space is unbounded and
the product set changes while the server runs. Every such request became
a synthetic 404 that the application never got to see.

Add one optional member, called for anything `routes` missed, with the
full target still in request.path. Precedence is exact path, then the
query-stripped path, then fallback, then the 404 as before, so a
default-constructed listener behaves byte-identically and no call site
changes.

A hook rather than a pattern syntax: consumers that already have a
router — one shared between a wasm frontend and the server, so a URL
cannot mean different things to a crawler and to the app — keep using
it, and there is no second route table to disagree with the first.

PathWithoutQuery moves out of this file into :HTTP as an exported
PathWithoutQueryHTTP, since ListenerHTTP now needs the same split and a
fallback handler almost always does too.

ListenerAsyncHTTP1 starts accepting inside its constructor, so assigning
`listener.fallback` afterwards would race the accept loop; it gets a
constructor overload that installs the fallback before the thread
starts.
2026-07-28 19:41:57 +00:00
e33ec5b72e SPDX license 2026-07-22 17:55:45 +02:00
28fab2509b full QUIC support 2026-05-07 00:06:44 +02:00
de2073422c crafter build V2 2026-05-06 01:09:40 +02:00
9bdf133d0f fixes 2025-11-03 14:25:51 +01:00
64739c39d8 headers are now always lower case 2025-11-02 16:04:32 +01:00
0fbc5bad52 initial commit 2025-11-02 15:00:53 +01:00