Skip to main content

Module http

Module http 

Source
Expand description

The one owner of the HTTP requests rk sends.

rk sends every request in-process, through one blocking client with a TLS stack that links no system OpenSSL and needs no system library. No other module builds a client. The client trusts the platform’s certificate store, plus one bundle file, the first that SSL_CERT_FILE, NIX_SSL_CERT_FILE, or CURL_CA_BUNDLE names, plus each directory SSL_CERT_DIR names. It reads its proxy per request and per redirect: https_proxy, then HTTPS_PROXY, for https, http_proxy, then HTTP_PROXY, for http, then all_proxy, then ALL_PROXY, and none where no_proxy, else NO_PROXY, names the host, its domain, or an address range it falls in. Each call carries its own timeout over the whole request, and states whether it follows a redirect, as each curl call it replaced did.

RK_HTTP_ORIGIN is the one test seam: an http:// origin on 127.0.0.1, ::1, or localhost that every request and every redirect is sent to instead, with no proxy, and with the host it named in the X-Rk-Original-Host header. Any other value refuses by name, so the seam can never carry a token to a remote host.

SATISFIES tool-requirements:rk-sends-its-own-requests

Structs§

Request
One request: what a call site asks the client to send.
Response
One answer: its status, its body, and the URL that answered after every redirect.

Enums§

Method
One request’s method.

Constants§

ORIGINAL_HOST_HEADER
The header that carries the host a request named, under the seam.
ORIGIN_VAR
The test seam’s variable.
USER_AGENT
The user agent every request names; crates.io requires one.

Functions§

send
Send one request and read its whole answer. Every status is an answer, so a 404 is Ok; an Err is a request that got no answer, with the reason.
send_with
send with the environment it reads given, so a test can name the certificate and proxy variables without touching the process.