Skip to content

A library for making fully-features HTTP static file servers in rust using tk-http

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

swindon-rs/http-file-headers

Repository files navigation

Http-file-headers Crate

Github | Documentaion | Examples | Crate

A framework-agnostic library that parses file-related headers from HTTP request and helps serving files including support of:

  • ETag, If-None-Match
  • Last-Modified, If-Modified-Since
  • Accept-Ranges, Range, Content-Range
  • Content-Type using mime_guess
  • Accept-Encoding for serving compressed (gzip and brotli) files
  • Serving index.html or similar directory indexes

The library is not tied to any framework, HTTP or even async library. So it's usage is quite verbose (see example). Still it does most of the complex work internally and is easily adapted to different needs.

Here are just few things that example in < 200 LoCs shows:

  1. Tokio for asynchronous stuff
  2. Tk-http serving HTTP
  3. Futures-cpupool for offloading reading from disk into separate thread pool
  4. Adding custom headers and error pages
  5. Customizing path where file are served from

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

A library for making fully-features HTTP static file servers in rust using tk-http

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published