data HttpConfig
Settings of a request. All durations are optional (none = no limit).
Example:
use std.http { Client, HttpConfig, Response }
fn main() io, net {
// fail after 2 seconds, never follow redirects, accept bodies up to 1 MiB
let cfg = HttpConfig{ timeout: 2s, maxRedirects: 0, maxBody: 1048576 }
match Client.get("http://127.0.0.1:1/", cfg: cfg) {
Response _ => print("answered")
NetError _ => print("no server")
}
}no server
pub(api) data HttpConfigС версии. 1.0.0-beta
Поля
pub(api) timeout: Duration? = none | Bound for the whole request: connect, TLS handshake, sending, every redirect, receiving the body. |
pub(api) connectTimeout: Duration? = none | Bound for establishing one connection (TCP + TLS handshake). |
pub(api) maxBody: i64 = 67108864 | Largest response body accepted, in bytes ( |
pub(api) maxRedirects: i64 = 5 | 0 = do not follow redirects. |
pub(api) keepAlive: bool = true | Reuse connections (pool); false sends |
pub(api) chunkedUpload: bool = false | Send request bodies with |
pub(api) http2: bool = true | https: offer HTTP/2 in ALPN and use it when the server selects it (the connection is then shared by all tasks; |
pub(api) userAgent: str = "oxl-http/1.0" | Value of the |
pub(api) ca: str = "" | https: trust anchors (PEM file or text) instead of the system roots. |
pub(api) caPem: str = "" | https: trust anchors as PEM text. |
pub(api) insecureSkipVerify: bool = false | https: skip certificate verification (tests only). |
pub(api) verifyHostname: bool = true | https: check that the certificate names the host. |
pub(api) pin: str = "" | https: hex SHA-256 of the server's leaf certificate. |
pub(api) cert: str = "" | https: client certificate for mutual TLS. |
pub(api) key: str = "" | https: private key file of the client certificate. |
pub(api) certPem: str = "" | https: client certificate chain as PEM text. |
pub(api) keyPem: str = "" | https: client private key as PEM text. |
pub(api) keyPassword: str = "" | https: password of the client private key. |
Определено в: std/http/http.oxl:112