https://github.com/algesten/hreq-h1
HTTP/1.x client & server implementation for Rust
https://github.com/algesten/hreq-h1
Last synced: 17 days ago
JSON representation
HTTP/1.x client & server implementation for Rust
- Host: GitHub
- URL: https://github.com/algesten/hreq-h1
- Owner: algesten
- License: apache-2.0
- Created: 2020-07-05T07:41:43.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-04-18T19:08:08.000Z (about 4 years ago)
- Last Synced: 2025-03-25T09:12:20.483Z (about 1 month ago)
- Language: Rust
- Size: 557 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# hreq-h1
An asynchronous HTTP/1 server and client implemenation.
This library provides the lower level parts of the HTTP/1.1 (and 1.0) spec.
Specifically it concerns sending/receiving http requests and bodies over
some unnamed transport. Which async runtime to use, TCP and TLS are handled
outside this library.Since HTTP/1.1 has no multiplexing, the HTTP headers `Content-Length` and
`Transfer-Encoding` are handled/enforced by this library to be able to correctly
delinate where a request starts/ends over the transport.### In scope
* `Content-Length` for known body sizes and ensuring the body size is correct.
* `Transfer-Encoding: chunked` when body size not known.
* `Connection: keep-alive` or `close` to handle HTTP/1.0 response delineation.### Out of scope
Basically everything which isn't about HTTP as "transport", i.e. application
level logic.* Following redirects
* Cookie handling
* `Content-Type` characters sets, mime types.
* `Content-Encoding` compression, gzip.
* `Expect: 100-Continue`## Layout and API
The API tries to closely follow that of [h2] so that a user of the library can make
uniform handling of both HTTP/1.1 and HTTP/2.0.There are separate [client] and [server] modules and code that is shared between
them lives in the crate root.## Handshake
Some connection must already have been established between client and server, this library
does not perform socket connection.In HTTP/1.1 there is no "handshake" like in HTTP/2.0, but
to be congruent with [h2], the entry points for starting a connection are [`client::handshake`]
and [`server::handshake`].[h2]: https://crates.io/crates/h2
[client]: client/index.html
[server]: server/index.html
[`client::handshake`]: client/fn.handshake.html
[`server::handshake`]: server/fn.handshake.html