Skip to content
Martin Keegan edited this page Sep 24, 2025 · 15 revisions

This page can be used for hacking the design/spec together until it can be moved to a .md file in the repo

petite_http desiderata/spec

Missing features:

  • serving anything but HTML, JPEG or static files.
  • A templating system that prevents escaping errors in the response.
  • HTTP redirects.
  • Serving pages with radically different request parameters, deserving of different Params types.

Present features:

  • A system that prevents escaping errors in the request.
  • Rust's ? operator generates HTTP error responses.
  • You never see a Url.
  • Useful utilities for manipulating and testing parts of URL paths. More missing features:
  • handle_post().

Serving pages with radically different request parameters, deserving of different Params types. For this, I think a possible design is a dispatch() function that picks a Handle implementation and passes it to a callback. Then different URL paths can have different Params types, and each be statically type checked.

  • A templating system that prevents escaping errors in the response. For this the minimum viable product is a trait ToHtml with three implementations:
  • &'static str (no escaping)
  • struct User(String) (HTML escaping)
  • struct Url(String) (%-encoding then HTML escaping)

I'm thinking that HttpOkay::Html payload should be a Box, i.e. the handler can return a ToHtml for this particular case, and petite_http will escape it correctly.

informal criterion is "anything needed by Ocularity, photo server, or Nifki (the next example)". And I'm adding questionnaire to that list. It's far from a feature-complete web app framework, as it should be. Just the 80% functionality

Clone this wiki locally