Skip to content

Churust v0.2.0

Choose a tag to compare

@github-actions github-actions released this 25 Jul 13:30
· 12 commits to main since this release

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, so churust = "0.2" is a
    complete dependency list. Previously a crate depending only on churust
    failed to compile with E0433: cannot find tokio in the crate root, because
    #[churust::main] expanded to an absolute ::tokio path.
  • Automatic HEAD. A HEAD request to a route with only a GET handler
    now runs that handler and returns its status and headers without a body, per
    RFC 9110 §9.3.2. Previously 405. An explicitly registered HEAD route still
    wins, and HEAD on a route with no GET is still 405. Content-Length is
    preserved for buffered bodies so a client sizing a resource gets the same
    answer GET would give; streamed bodies are dropped rather than drained and
    omit the header.
  • Automatic OPTIONS. An OPTIONS request no handler claims returns 204
    with Allow, listing the registered methods plus a synthesized HEAD where
    GET exists. 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/x both registered,
    GET /files/special returned 404. This broke StaticFiles in its most
    ordinary deployment — a catch-all asset route beside any other route.
    Resolution is now exact match, then wildcard, then 405 with the union of
    both allow sets, then 404.
  • Path parameters are percent-decoded, matching query parameters, which
    already were. /u/John%20Doe now yields John Doe rather than
    John%20Doe. Segments are split before decoding, so %2F cannot 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 400 instead
    of being passed through.
  • StaticFiles refuses 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 full to the set Churust uses:
    rt-multi-thread, net, io-util, time, sync, signal, macros, plus
    fs under Churust's own fs feature. If you relied on a tokio feature
    arriving transitively, declare tokio yourself with the features you need;
    Cargo unifies them.
  • #[churust::main] expands to ::churust::__private::tokio rather than
    ::tokio. Invoking the macro directly from churust-macros is no longer
    supported; depend on churust.

Breaking

  • Match gained a BadPath variant and is now #[non_exhaustive], so a
    match on churust_core::Match needs a _ arm. This affects code driving
    Router directly; applications built on the routing DSL are unaffected.

Crates

What's Changed

New Contributors

Full Changelog: v0.1.1...v0.2.0