Skip to main content

Module http

Module http 

Source
Expand description

Fetching from the web: the one client everything is fetched with, and the one way of fetching.

Every address comes from whoever wrote a profile or a note. Only https is fetched, redirects included; nothing waits longer than FETCH_TIMEOUT; and no more is read than the caller is ready to keep, so a hostile address costs a refused request at worst. Of a web page only the head is read, and that only if the server calls it a page.

Videos are the one thing fetched that is not fetched here: see crate::video.

Structs§

PageHead
The head of a web page: where it was found, after whatever redirects, and its bytes as far as they were read.

Enums§

Linked
What a link turned out to be, asked for as a web page.

Constants§

FETCH_TIMEOUT 🔒
How long anything gets to arrive.

Functions§

client
The HTTP client: https only, redirects included, and never waiting longer than FETCH_TIMEOUT.
get
What is at url, if it answers with success and is no more than max_bytes long.
get_as
What url answers when it is asked for accept, up to max_bytes: a relay’s account of itself, say, which is at the relay’s own address for whoever asks for that and not for a page.
get_in_place
As get, of an address that has to answer for itself: what came from anywhere it sent the request on to is refused.
get_page_head
The head of the web page at url: what it sends until its head ends, and max_bytes of it at most. Unlike get, a page longer than that is no error: the rest is left unread. What the server doesn’t call a web page is refused before any of it is read; if it calls it a video, that is the answer.
head_end 🔒
Where the head of a page ends in bytes, looking from from on: at the tag that closes it, or the one that opens the body.
is_html 🔒
Whether what a server calls content_type is a web page.
is_video
Whether what a server, or a note, calls content_type is a video.
media_type 🔒
The media type in what a server calls content_type, without what follows it.
read 🔒
What response carries, if it is a success and no more than max_bytes long.