#web #request #http #rest #client


Asynchronous HTTP/1.1 (and 1.0) implementation

17 releases

0.3.10 Apr 18, 2021
0.3.9 Nov 22, 2020
0.3.8 Sep 6, 2020
0.3.6 Aug 29, 2020
0.1.1 Jul 31, 2020

#88 in HTTP client

Download history 2/week @ 2022-11-27 9/week @ 2022-12-04 23/week @ 2022-12-11 5/week @ 2022-12-18 5/week @ 2022-12-25 6/week @ 2023-01-01 31/week @ 2023-01-08 80/week @ 2023-01-15 94/week @ 2023-01-22 130/week @ 2023-01-29 84/week @ 2023-02-05 119/week @ 2023-02-12 94/week @ 2023-02-19 77/week @ 2023-02-26 35/week @ 2023-03-05 66/week @ 2023-03-12

277 downloads per month
Used in hreq


2.5K SLoC


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.


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.


~56K SLoC