|
Mila
Deep Neural Network Library
|
How to ask, and how to read the answer: redirects, the token rule, resume, status. More...
#include <cstddef>#include <cstdint>#include <format>#include <functional>#include <memory>#include <stdexcept>#include <string>#include <utility>import Distribution.HttpTransport;Classes | |
| class | Mila::Distribution::HttpClient |
| GET a URL, streaming the body to a sink, over whichever transport it is given. More... | |
| struct | Mila::Distribution::HttpRequest |
| struct | Mila::Distribution::HttpResult |
Namespaces | |
| namespace | Mila |
| Mila main API namespace. | |
Typedefs | |
| using | Mila::Distribution::ProgressCallback |
| Called as bytes arrive. | |
Enumerations | |
| enum class | Mila::Distribution::HttpStatus { Ok , Unauthorized , Forbidden , NotFound , RangeIgnored , RangeNotSatisfiable , TransportError , ServerError } |
| Outcome of a transfer attempt, distinguishing failures that need different fixes. More... | |
Functions | |
| std::string | Mila::Distribution::hostOf (const std::string &url) |
| Extract the host from a URL, for deciding whether auth may cross a redirect. | |
| std::string | Mila::Distribution::resolveRedirect (const std::string &base, const std::string &location) |
| Resolve a Location header against the URL it came from. | |
| std::string | Mila::Distribution::toString (HttpStatus status) |
How to ask, and how to read the answer: redirects, the token rule, resume, status.
Every decision that used to live inside the libcurl implementation, now written once above any transport and depending on nothing. That matters most for one rule: the authorization header is dropped when the host changes, so no transport can leak a bearer token to a CDN, because no transport is ever told one. See Specifications/HttpClient.md.
|
export |
Called as bytes arrive.
Return false to abort the transfer.
total_bytes is zero when the server does not report a length.
|
exportstrong |
Outcome of a transfer attempt, distinguishing failures that need different fixes.
|
export |
Resolve a Location header against the URL it came from.
A Location may be relative – RFC 7231 permits it and HuggingFace uses it, answering a manifest request with a 307 to /api/resolve-cache/.... Handing that to a transport verbatim yields a malformed URL, since a bare path has no scheme.
Handles the four forms: absolute, protocol-relative, root-relative, and path-relative.