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§
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§
- Header
Map - A specialized multimap for header names and values.
- Header
Name - Represents an HTTP header field name
- Header
Value - Represents an HTTP header field value.
- Method
- The Request Method (VERB)
- Request
- Represents an HTTP request.
- Response
- Represents an HTTP response
- Status
Code - An HTTP status code (
status-codein 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.
- Client
Ext - Extension trait adding specific HTTP method functions (GET, POST, etc.) on top of the base
Clienttrait. - Response
Ext - Helper methods for
http::Response.
Functions§
- do_
upgrade - Upgrade a
Responsefrom HTTP/1.1 to the requested protocol. - host_
header - Produce a
Hostheader for the given URL. - make_
upgrade_ req - Create a
Requestto upgrade from HTTP/1.1 to the givenprotocol, which can be sent to the server via anHttp1client to start the HTTP/1.1 protocol upgrade process. - upgrade
- Gets a pending HTTP upgrade from this message.
Type Aliases§
- Bytes
Body - The body of an HTTP
RequestorResponsethat may contain one or more bytes; i.e., a body may be present. - Empty
Body - The body of an HTTP
RequestorResponsethat’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