dox_http_client 0.0.1
dox_http_client: ^0.0.1 copied to clipboard
Fast native HTTP/1.1 client for Dart, with HTTPS and keep-alive. Rust owns the sockets and parses the answers through dart:ffi.
0.0.1 #
- First version.
DoxHttpClientis an HTTP client for calls to other servers. Rust owns the sockets and reads the answers on the thread of the isolate.get,head,post,put,patch,deleteandsendreturn aDoxHttpClientResponsewithstatusCode,body,bodyBytes,headersandheader(name).- HTTP/1.1 with keep-alive: the client keeps its connections open and uses them again. Chunked answers, answers that end with the connection, IPv4, IPv6 and host names are supported. When the first address of a host name does not accept the connection, the client tries the next address.
- HTTPS with TLS 1.2 and TLS 1.3 (rustls). The client trusts the root certificates of Mozilla, which are in the library.
trustedCertificatesadds your own certificates as PEM text. - A request fails with a
DoxHttpClientExceptionwhen no answer comes.failuregives the cause as aDoxHttpFailure. - The default timeout of a request is 30 seconds. Set
timeoutfor the client or for one request.Duration.zerois no timeout. - A connection with no request for
idleTimeout(default 15 seconds) closes.Duration.zerokeeps idle connections open. maxConnectionsPerHostandmaxResponseSizeare off by default.- Before a kept connection gets the next request, the client reads it. If the server closed it or sent bytes that nobody asked for, the client closes it and uses a different connection.
- The client does not do these things: HTTP/2, redirects, compressed bodies and streamed bodies.
- The package has its own native library. Its functions start with
dox_client_, so an app can load it together with the library ofdox_http_native. - A build from source needs a C compiler, because the TLS library compiles C code and assembly code. The ready-built libraries from the GitHub release do not need one.
- Fuzz target
client_responsefor the answer parser. THIRD_PARTY_NOTICESlists the licenses of the code and data in the native library. Each release also has it next to the libraries.