Kantoor. Feeds. Fetcher
(Kantoor v1.0.0)
Gets a feed over HTTPS and says what came back, with every limit applied:
- Where. Each host (the feed's, and the target of every redirect) is
resolved and checked by
Kantoor.Feeds.NetGuard; the connection goes to the checked address (Kantoor.Feeds.Http). - Redirects. At most 5 (
:max_redirects), only tohttpsaddresses that passKantoor.Feeds.Url, and an address seen before in the chain is a loop. - Size and time. The body may be at most 5 MB (
:max_bytes) and the whole fetch, redirects included, must end within 20 seconds (:timeout_ms). - Conditional.
If-None-MatchandIf-Modified-Sinceare sent when the previous fetch gave anETagorLast-Modified; a304is:not_modified.
The result is {:ok, %{body:, etag:, last_modified:}}, :not_modified or
{:error, code, retry_after}. code is a short string ("timeout",
"too_large", "not_public", "http_404", ...; see message/1) that never
contains the address, so it can be stored, shown and logged. retry_after is the
server's Retry-After in seconds when it sent one on a 429 or 503.
Summary
Functions
Fetches url (a normalised https address). Options: :max_redirects, :max_bytes, :timeout_ms.
The largest body accepted, in bytes.
English text for a fetch error code (the interface translates them).
Types
Functions
@spec fetch(String.t(), conditional(), keyword()) :: result()
Fetches url (a normalised https address). Options: :max_redirects, :max_bytes, :timeout_ms.
The largest body accepted, in bytes.
English text for a fetch error code (the interface translates them).