- Description:
- http is a minimal, single-file HTTP library
- Owner:
- Murilo Ijanc'
- Last Change:
- Clone URL:
ssh://anon@ijanc.org/got.http
Commit Briefs
add examples/post for POSTing a body to a URL
- body from argv or stdin (-), sent as application/json - prints response status line, headers, and body
add HTTPS client, parsers, and chunked transfer-coding
- Method / Version / Status (is_* predicates, canonical reason phrases) and case-insensitive ordered Headers - parse_request and parse_response_head per RFC 2616 §5/§6, accepting bare LF (§19.3) and obs-fold (§2.2) - response_body_length / request_body_length covering the §4.4 matrix - ChunkedReader / ChunkedWriter per §3.6.1 for SSE-style streaming - RequestBuilder + top-level get/head/post/put/delete/patch/request; send() returns a Response that implements Read, with Host, User-Agent, Connection: close, and Content-Length auto-set - TlsStream wraps libtls and propagates -ltls via #[link] - percent_encode, percent_decode, url_form; RequestBuilder::form - examples/get.rs and 34 inline tests
add examples/ and expose VERSION const
Populate VERSION from the HTTP_VERSION environment variable which make already passes to rustc, so downstream crates can print or log the library version without a second source of truth. Add examples/hello.rs, a minimal binary that links against the rlib and prints the version. A generic Makefile pattern rule builds any file under examples/ into build/ex-<name>, driven by the new examples target.
Branches
Tree
| .gitignore | commits | blame |
| .rustfmt.toml | commits | blame |
| LICENSE | commits | blame |
| Makefile | commits | blame |
| README.md | commits | blame |
| examples/ | |
| http.rs | commits | blame |
| link.mk | commits | blame |
README.md
http - minimal HTTP/1.0 and HTTP/1.1 library
=============================================
http is a minimal, single-file HTTP library written in Rust, conforming
to RFC 1945 (HTTP/1.0) and RFC 2616 (HTTP/1.1). It is meant to be
dropped into another project's source tree, or linked as a plain rlib.
Requirements
------------
In order to build http you need rustc (edition 2024).
Installation
------------
There are two ways to use http in another Rust project.
Drop-in source. Copy http.rs into your project and declare it as a
module:
mod http;
Linked rlib. Build the library with make(1) and pass it to rustc:
$ make
$ rustc --extern http=build/libhttp.rlib -L build main.rs
Standards
---------
- RFC 1945 (HTTP/1.0)
- RFC 2616 (HTTP/1.1)
Download
--------
got clone ssh://anon@ijanc.org/http
git clone https://git.ijanc.org/http.git
License
-------
ISC - see LICENSE.
