AshHooks.Http.Httpc (AshHooks v2.0.3)

Copy Markdown View Source

An AshHooks.Http adapter built on OTP's :httpc.

The adapter resolves and validates the destination, pins the connection address, and preserves the original hostname for TLS certificate verification, SNI, and the Host header. Redirects are returned without following them. TLS uses the OTP CA store unless cacerts: der_list supplies a private CA bundle. The operation deadline covers DNS, connection, send, and response collection; connection also has a separate, shorter ceiling.

Response retention is capped by max_body_bytes (64 KiB by default). OTP streams 200 and 206 responses, so this adapter cancels collection at that limit. Other statuses are buffered inside :httpc before the adapter can truncate them. Use the default AshHooks.Http.Bounded adapter when the allocation of an untrusted error response must also be bounded. OTP's streaming interface does not distinguish 206 from 200; both are reported as 200 by this adapter and classified as successful delivery.

HTTPS URLs with literal IP hosts return {:error, :ip_literal_https_needs_bounded}. Use AshHooks.Http.Bounded for those endpoints: it can inspect the socket certificate's IP subject alternative name as well as validate its certificate chain.