Repository navigation
This is the biggest release since v1.0.0. ttfb now supports HTTP/2 and
HTTP/3 (over QUIC) in addition to HTTP/1.1, and by default selects the newest
protocol the server supports.
- Library users: the
ttfb()function is replaced byTtfbClientand
TtfbOptions, and several types changed. See the BREAKING entries below. - Binary users: the default protocol is no longer HTTP/1.1. Use
--http1.1
for the previous behavior. New options include--repeatfor statistics,
--jsonfor scripts,--headers,--timeout, and-4/-6.
ttfb lib
- BREAKING The
ttfb()function is replaced byTtfbClient, which is
configured withTtfbOptions:
TtfbClient::new(TtfbOptions::default()).measure(url).
TtfbOptions::protocoltakes aProtocolSelection, and
TtfbOutcome::protocol_selection()reports it.TtfbOptionsis
#[non_exhaustive], so that new options are no breaking change: set its
fields onTtfbOptions::default(). - BREAKING
TtfbError,ResolveDnsError, andInvalidUrlErrorare
#[non_exhaustive]. - BREAKING
TtfbError::CantConnectTlsandTtfbError::CantVerifyTls
are replaced byTtfbError::Tls, which describes the error as a string.
The lib no longer depends onrustls-connector. - BREAKING
AllowInvalidCertsVerifieris no longer public. It was
exported by accident. - BREAKING
InvalidUrlError::Otheris removed. It was never used. - BREAKING
DurationPairno longer implementsDefault. A pair of zero
durations isn't a meaningful measurement. - BREAKING
TtfbOutcome::tcp_connect_duration()and
TtfbOutcome::tls_handshake_duration()are replaced by
TtfbOutcome::connection_handshake(). It reports how the connection was
established as the newConnectionHandshake: a TCP connect with an optional
TLS handshake, or a QUIC handshake for HTTP/3. - BREAKING
TtfbErrorhas the new variantsUnsupportedHttpProtocol,
Http2, andHttp3. - BREAKING
ResolveDnsError::OtherandTtfbError::CantConfigureDNSError
describe the error as a string instead of exposing theResolveErrorof
hickory-resolver, so that the DNS resolver can change without a breaking
change. - TLS trusts the system's root certificates and the bundled Mozilla root
certificates together. Previously, the bundled ones were only used if the
system's could not be loaded. - HTTPS works with IPv6 addresses, such as
https://[2606:4700:4700::1111]. TtfbErrorcomparesCantConnectHttpandOtherStreamErrorcorrectly.
Before, two errors of the same variant were never equal, while the two
variants were equal with the sameio::ErrorKind.- The duration of the DNS lookup no longer includes starting the internal Tokio
runtime and its thread, which took about 0.1-0.3 ms. - Added
TtfbOutcome::protocol(), which reports the HTTP protocol used as
HttpProtocol. - Added HTTP/2 measurements over TLS with
HttpProtocol::Http2. They need
the Cargo featurehttp2, which is enabled by default. Without it, they
fail with the newTtfbError::UnsupportedHttpProtocol. - Added HTTP/3 measurements over QUIC with
HttpProtocol::Http3. They need
the Cargo featurehttp3, which is enabled by default. ProtocolSelection::Auto, the default, selects HTTP/3, HTTP/2, or
HTTP/1.1, whichever the server supports first in this order. Protocols built
without their Cargo feature are skipped.TtfbOptions::ip_versionselects the IP version of the connection:
IpVersion::Any, the default, prefers IPv4 as before, whileIpVersion::V4
andIpVersion::V6use only that version. A host without an address of that
version fails with the newTtfbError::NoAddressForIpVersion.TtfbOptions::timeoutlimits the duration of a measurement, from the DNS
lookup to the end of the download. It defaults to 10 s and must be between
1 s and 60 min. A measurement that exceeds it fails with the new
TtfbError::Timeout.TtfbOutcome::status()andTtfbOutcome::headers()return the status code
and the headers of the final response. The typesStatusCodeand
HeaderMapof thehttpcrate are re-exported.
ttfb binary
- BREAKING The protocol is now chosen automatically by default: HTTP/3,
then HTTP/2, then HTTP/1.1. Use--http1.1for the previous behavior.
For HTTPS servers without HTTP/3, the HTTP/3 attempt usually waits for its
timeout of 1 s, which prolongs the run but not the measured timings. - Added
--http1.1,--http2,--http3, and--auto-protocolto select
the HTTP protocol. - Added
--repeat Nand--repeat Ns, which measure N times or repeatedly
for N seconds and print the minimum, median, mean, and maximum of the
relative and the absolute duration of each step. - Added
--timeout <SECS>, the maximum duration of a measurement, which
defaults to 10 s and must be between 1 s and 3600 s. - Added
-4/--ipv4and-6/--ipv6to require an IP version. Without them,
IPv4 is preferred as before. - Added
--headers, which prints the status line and the headers of the
response. - Added
--json, which prints the results only as JSON in a single line, e.g.,
for scripts. Its dependencies grow the release binary by 41 KiB (33 KiB
stripped). - The tables show the timings in ms with one decimal. More decimals only
showed measurement noise. Durations below 0.05 ms are shown as<0.1. - The output shows the IP address and port, the HTTP protocol, the status, and
the download of the response. - The output labels "TCP connect" and "HTTP GET Req" are now "TCP Connect"
and "HTTP Send GET". - The output shows the QUIC handshake of HTTP/3 measurements instead of the
TCP connect and the TLS handshake. - The release binary grows with the HTTP/2 and HTTP/3 support. On Linux,
built with Rust 1.99 (sizes when stripped in parentheses):- v1.15.0: 3.2 MiB (2.5 MiB)
- without
http2andhttp3: 3.2 MiB (2.5 MiB) - with
http2: 3.5 MiB (2.8 MiB) - with
http3: 4.0 MiB (3.2 MiB) - with
http2andhttp3, the default: 4.3 MiB (3.4 MiB)
PR List
- treewide: SPDX license headers and thiserror by @phip1611 in #119
- http1: correct response framing and content download timing by @phip1611 in #113
- http1: test response framing against well-known websites by @phip1611 in #121
- target, tls: shared target resolution and TLS configuration by @phip1611 in #123
- client: replace ttfb() with a configurable TtfbClient by @phip1611 in #124
- http2: HTTP/2 measurements by @phip1611 in #114
- outcome: TtfbTimings and the connection handshake enum by @phip1611 in #133
- http3: HTTP/3 measurements by @phip1611 in #116
- client: automatic protocol fallback by @phip1611 in #126
- cli: protocol selection options, docs by @phip1611 in #112
- http11: use the http crate's types by @phip1611 in #127
- http3: disable GREASE by @phip1611 in #135
- clippy: add clippy::absolute_paths by @phip1611 in #136
- cli: add --repeat by @phip1611 in #137
- Add a timeout for measurements by @phip1611 in #138
- Report the status and headers of the response by @phip1611 in #139
- cli: print the address, collect step durations in a helper by @phip1611 in #142
- cli: show the absolute durations with --repeat, round to 0.1 ms by @phip1611 in #144
- Add --ipv4 and --ipv6 by @phip1611 in #143
- test: give the network tests a timeout of 30 s by @phip1611 in #145
- cli: add --json by @phip1611 in #141
- error: compare the I/O errors of TtfbError by their variant by @phip1611 in #146
- lib: hide hickory-resolver's errors and fix the DNS timing by @phip1611 in #148
- lib: prepare the public API for minor releases after 2.0 by @phip1611 in #150
- ci: smoke-test the CLI with combinations of its options by @phip1611 in #151
Full Changelog: v1.15.0...v2.0.0