Churust v0.2.0
All seven Churust crates release together on 0.2.0.
[dependencies]
churust = "0.2"That is the whole dependency list — the runtime is re-exported as churust::tokio.
Added
churust::tokio. The runtime is re-exported, sochurust = "0.2"is a
complete dependency list. Previously a crate depending only onchurust
failed to compile withE0433: cannot find tokio in the crate root, because
#[churust::main]expanded to an absolute::tokiopath.- Automatic
HEAD. AHEADrequest to a route with only aGEThandler
now runs that handler and returns its status and headers without a body, per
RFC 9110 §9.3.2. Previously405. An explicitly registeredHEADroute still
wins, andHEADon a route with noGETis still405.Content-Lengthis
preserved for buffered bodies so a client sizing a resource gets the same
answerGETwould give; streamed bodies are dropped rather than drained and
omit the header. - Automatic
OPTIONS. AnOPTIONSrequest no handler claims returns204
withAllow, listing the registered methods plus a synthesizedHEADwhere
GETexists. CORS preflight keeps priority. Router::methods_for, which reports the methods registered for a path
including any a trailing wildcard would serve.
Fixed
- A
{path...}wildcard was unreachable whenever a static route shared its
prefix. With/files/{path...}and/files/special/xboth registered,
GET /files/specialreturned404. This brokeStaticFilesin its most
ordinary deployment — a catch-all asset route beside any other route.
Resolution is now exact match, then wildcard, then405with the union of
both allow sets, then404. - Path parameters are percent-decoded, matching query parameters, which
already were./u/John%20Doenow yieldsJohn Doerather than
John%20Doe. Segments are split before decoding, so%2Fcannot forge a
path separator, and+stays literal in a path rather than becoming a space. - Malformed percent-encoding and non-UTF-8 path segments return
400instead
of being passed through. StaticFilesrefuses encoded separators (%2F,%5C). They previously
became real separators once a wildcard's segments were rejoined. Traversal
was already blocked by the existing..rejection; this removes the need to
reason about rejoining to establish that.
Changed
- Tokio features narrowed from
fullto the set Churust uses:
rt-multi-thread,net,io-util,time,sync,signal,macros, plus
fsunder Churust's ownfsfeature. If you relied on a tokio feature
arriving transitively, declaretokioyourself with the features you need;
Cargo unifies them. #[churust::main]expands to::churust::__private::tokiorather than
::tokio. Invoking the macro directly fromchurust-macrosis no longer
supported; depend onchurust.
Breaking
Matchgained aBadPathvariant and is now#[non_exhaustive], so a
matchonchurust_core::Matchneeds a_arm. This affects code driving
Routerdirectly; applications built on the routing DSL are unaffected.
Crates
churust· docschurust-core· docschurust-macros· docschurust-json· docschurust-logging· docschurust-cors· docschurust-auth· docs
What's Changed
- 0.2.0: routing correctness and one-dependency quickstart by @davthecodercom in #1
New Contributors
- @davthecodercom made their first contribution in #1
Full Changelog: v0.1.1...v0.2.0