# Changelog
All notable changes to **apollo-http-client** will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.3.0]
### 💥 Breaking Changes
#### replace deprecated rustls-pemfile with rustls-pki-types ([#479](https://github.com/apollographql/apollo-platform-rs/pull/479)) by @SharkBaitDLS
`rustls-pemfile` is deprecated; PEM parsing is now done via `rustls-pki-types`
directly. The `source` field on `HttpClientError::TlsCertificateAuthoritiesInvalid`,
`TlsClientCertificateChainInvalid`, and `TlsClientKeyInvalid` has changed type from
`std::io::Error` to `rustls_pki_types::pem::Error`.
## [0.2.0]
### 💥 Breaking Changes
#### TLS configuration restructured ([#404](https://github.com/apollographql/apollo-platform-rs/pull/404)) by @BrynCooke
`HttpClientConfig.danger_accept_invalid_certs` has moved into a new `tls` section.
**Migration:**
```yaml
# Before
danger_accept_invalid_certs: true
# After
tls:
danger_accept_invalid_certs: true
```
#### `HttpClientError` is now `#[non_exhaustive]` ([#386](https://github.com/apollographql/apollo-platform-rs/pull/386)) by @BrynCooke
Exhaustive `match` arms on `HttpClientError` must add a wildcard `_` arm.
### ✨ Features
#### Proxy support ([#386](https://github.com/apollographql/apollo-platform-rs/pull/386), [#405](https://github.com/apollographql/apollo-platform-rs/pull/405)) by @BrynCooke
Set `proxy.url` in `HttpClientConfig` to route all outbound connections through a proxy. HTTP requests are forwarded; HTTPS requests tunnel via `CONNECT`. The proxy password is stored as `Redacted<String>` and never appears in debug output or logs:
```yaml
proxy:
url: "http://user:${PROXY_PASSWORD}@proxy.corp.example.com:3128"
```
A non-200 `CONNECT` response surfaces as `HttpClientError::ProxyTunnel { status }`. On proxied connections, `http.client.open_connections` and `http.client.connection.duration` carry `network.peer.address` and `network.peer.port` set to the proxy host; `server.address` and `server.port` continue to refer to the logical target.
#### TLS: custom CAs, mTLS, aws-lc-rs, and programmatic config ([#404](https://github.com/apollographql/apollo-platform-rs/pull/404), [#460](https://github.com/apollographql/apollo-platform-rs/pull/460)) by @BrynCooke, @DMallare
The `tls` section accepts a PEM CA bundle, a client certificate for mutual TLS, and a toggle for the OS native trust store:
```yaml
tls:
# PEM bundle to trust; multiple certificates may be concatenated.
certificate_authorities: ${file:./certs/internal-ca.pem}
# When false, trusts only the supplied CAs (useful in air-gapped environments).
use_native_certificate_store: true
client_authentication:
# PEM chain: leaf cert followed by any intermediates.
certificate_chain: ${file:./certs/client.pem}
# PEM-encoded unencrypted private key (PKCS#1, PKCS#8, or SEC1).
key: ${file:./certs/client.key}
```
Both `certificate_authorities` and `client_authentication.key` are stored as `Redacted<String>`. Encrypted private keys and empty CA bundles fail at client construction with dedicated errors.
To inject a pre-built `rustls::ClientConfig` instead of YAML-driven TLS:
```rust
let tls: Arc<rustls::ClientConfig> = /* your FIPS or custom-CA config */;
let client = HttpClient::builder(HttpClientConfig::default())
.with_tls_config(tls)
.build()?;
```
The crate now links `aws-lc-rs` as its TLS crypto provider.
#### Unix domain socket support ([#396](https://github.com/apollographql/apollo-platform-rs/pull/396), [#431](https://github.com/apollographql/apollo-platform-rs/pull/431)) by @BrynCooke
`HttpClient` sends requests over Unix domain sockets. Build the URI with the `unix_uri` helper:
```rust
use apollo_http_client::unix_uri;
let uri = unix_uri("/var/run/app.sock")?
.path_and_query("/health")
.build()?;
```
On non-Unix platforms, a `unix://` request returns `HttpClientError::UnsupportedScheme`. The socket path is recorded as `server.address` in metrics and spans. The HTTP version over UDS follows `HttpClientConfig::protocol`, as with TCP. Two new error variants handle malformed socket URIs: `InvalidUnixSocketPath` and `NonUtf8UnixSocketPath`.
Client spans now record `server.port` on every TCP request, including when the port matches the scheme default (`80` for HTTP, `443` for HTTPS).
#### `HttpClient` accepts any request body ([#432](https://github.com/apollographql/apollo-platform-rs/pull/432)) by @BrynCooke
`HttpClient` implements `Service<Request<B>>` for any body `B` whose data is `Bytes` and whose error converts to `BoxError`. Pass `Full<Bytes>`, `StreamBody<S>`, or the output of a body-transforming Tower layer directly to the client. Call sites that wrapped their body in `.map_err(Into::into).boxed()` can drop it.
#### Public config fields ([#460](https://github.com/apollographql/apollo-platform-rs/pull/460)) by @DMallare
All fields on `HttpClientConfig` and its nine sub-config structs are now `pub`:
```rust
let mut config = HttpClientConfig::default();
config.connect_timeout = Duration::from_secs(5);
config.tls.danger_accept_invalid_certs = false;
config.http2.keep_alive_interval = Duration::from_secs(15);
let client = HttpClient::new(&config)?;
```
#### `HttpClient` is `Send + Sync` ([#403](https://github.com/apollographql/apollo-platform-rs/pull/403)) by @BrynCooke
Hold `HttpClient` behind an `Arc` and share it across threads without a `Mutex` or tower buffer.
#### TCP socket options ([#391](https://github.com/apollographql/apollo-platform-rs/pull/391)) by @BrynCooke
The new `tcp` section applies to all outbound connections:
```yaml
tcp:
nodelay: true # default — disables Nagle's algorithm
keepalive: 60s # default — idle period before keep-alive probes start
```
## [0.1.1]
### ✨ Features
#### add apollo-http-client with hyper-based HTTP client and OTel metrics ([#343](https://github.com/apollographql/apollo-platform-rs/pull/343)) by @BrynCooke
Introduces `apollo-http-client`, a Tower `Service` for sending HTTP requests with
full OpenTelemetry instrumentation following the HTTP client semantic conventions.
Key capabilities:
- Supports HTTP/1.1, HTTP/2, TLS
- Connection pooling with configurable idle timeouts and keep-alive
- Spans and metrics according to OTel semantic convention, such as: `request.duration`, `open_connections`
- End-user configurability for optional OTel metrics and spans