Macaw.Live.Proxy.Fetcher.Httpc (macaw_live v0.1.0)

Copy Markdown View Source

The default Macaw.Live.Proxy.Fetcher (spec/06 §1.6): OTP's :httpc, copied from visualize's Visualize.TileProxy.Fetcher.Httpc and bounded.

  • it verifies the peer's certificate against the system's trusted roots (:public_key.cacerts_get/0) with hostname checking, or against cacerts: when its argument gives them (a test's own authority);
  • it follows no redirect: a redirect would leave the enabled origin, so a 3xx is answered as it came and the proxy refuses it;
  • it streams the body and stops reading at max_bytes:, canceling the request, {:error, :too_large}, so an oversized body is never held whole;
  • it answers within timeout: milliseconds, {:error, :timeout};
  • it sends exactly the headers it is given, and keeps no cookie.

Its argument is a keyword list, [] by default; cacerts: replaces the system's roots, and transport:, {module, arg}, is what it performs its I/O through (Macaw.Live.Proxy.Fetcher.Httpc.Transport), OTP's :httpc by default. A test gives it a transport of its own, so the fetcher's own logic runs and no socket opens.