Skip to main content

Crate ts_http_util

Crate ts_http_util 

Source
Expand description

§ts_http_util

A collection of utilities for working with HTTP/1.1 and HTTP/2 client connections over plaintext or TLS streams. Built on top of http, hyper, and tokio for use with tailscale.

This crate is tailored for our needs, and is probably a poor fit for other use cases. If you’re looking for a general-purpose HTTP client crate, we recommend using hyper directly, or looking at reqwest or ureq.

Re-exports§

pub use http1::Http1;
pub use http2::Http2;

Modules§

http1
HTTP/1.1 client implementation, utilities to establish an HTTP/1.1 connection over TCP or TLS, and utilities to parse HTTP/1.1 requests.
http2
HTTP/2 client implementation, and utilities to establish an HTTP/2 connection over TCP or TLS.

Structs§

HeaderMap
A specialized multimap for header names and values.
HeaderName
Represents an HTTP header field name
HeaderValue
Represents an HTTP header field value.
Method
The Request Method (VERB)
Request
Represents an HTTP request.
Response
Represents an HTTP response
StatusCode
An HTTP status code (status-code in RFC 9110 et al.).

Enums§

Error
General categories of error that can occur during any phase of an HTTP connection.

Constants§

HOST
Specifies the domain name of the server and (optionally) the TCP port number on which the server is listening.

Traits§

Client
An HTTP client that can asynchronously send requests and receive responses.
ClientExt
Extension trait adding specific HTTP method functions (GET, POST, etc.) on top of the base Client trait.
ResponseExt
Helper methods for http::Response.

Functions§

do_upgrade
Upgrade a Response from HTTP/1.1 to the requested protocol.
host_header
Produce a Host header for the given URL.
make_upgrade_req
Create a Request to upgrade from HTTP/1.1 to the given protocol, which can be sent to the server via an Http1 client to start the HTTP/1.1 protocol upgrade process.
upgrade
Gets a pending HTTP upgrade from this message.

Type Aliases§

BytesBody
The body of an HTTP Request or Response that may contain one or more bytes; i.e., a body may be present.
EmptyBody
The body of an HTTP Request or Response that’s always empty; i.e., the body will always be zero bytes in length.
Upgraded
A connection that has been upgraded from HTTP/1.1 to a different protocol, such as HTTP/2 or DERP, via HTTP/1.1’s upgrade mechanism.protocol upgrade