7 releases
Uses old Rust 2015
0.1.8 | Jun 27, 2018 |
---|---|
0.1.7 |
|
0.1.6 | Dec 29, 2017 |
0.1.3 | Sep 6, 2017 |
0.1.2 | Aug 25, 2017 |
#1129 in HTTP server
25 downloads per month
Used in swindon
55KB
1.5K
SLoC
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_guessAccept-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:
- Tokio for asynchronous stuff
- Tk-http serving HTTP
- Futures-cpupool for offloading reading from disk into separate thread pool
- Adding custom headers and error pages
- Customizing path where file are served from
License
Licensed under either of
- Apache License, Version 2.0, (./LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (./LICENSE-MIT or http://opensource.org/licenses/MIT) at your option.
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.
Dependencies
~1MB
~23K SLoC