pub struct UploadRequest<'a> {
pub target: Target<'a>,
pub method: UploadMethod,
pub body: UploadBody,
pub priority: Priority,
pub max_response: u64,
pub headers: &'a [(String, String)],
pub basic_auth: Option<&'a BasicAuth>,
pub bearer_token: Option<&'a BearerToken>,
pub allow_cleartext_credentials: bool,
pub response_timeout: Option<Duration>,
}Expand description
Fields§
§target: Target<'a>The target, read as FetchRequest::target is. A
Target::PathQuery goes to the mirrors with its query, as for a
fetch.
The fetcher tries the mirrors in order until one of them takes the request. It never asks a mirror after that one.
method: UploadMethodThe method.
The default is POST.
body: UploadBodyThe body that the request sends.
priority: PriorityThe place of the request in the queue when the fetcher is at its limit.
max_response: u64The largest response body, in bytes, for each status.
A larger Content-Length of a 2xx answer fails the upload with
Error::UploadInterrupted. An answer other than 2xx with a larger
Content-Length keeps its status, and its body is
withheld. If a body grows past the cap
while it streams, the read fails with
io::ErrorKind::FileTooLarge. The
default is UploadRequest::DEFAULT_MAX_RESPONSE.
headers: &'a [(String, String)]Headers merged over the headers of the fetcher.
FetchRequest::headers states the merge. The fetcher sets no
Content-Type, so a Content-Type that the server needs goes here.
basic_auth: Option<&'a BasicAuth>Credentials for Authorization: Basic, for this request.
They replace the credentials of the fetcher.
Beside bearer_token, beside an
Authorization entry in headers, or beside
a signer of the fetcher, they fail the
upload before admission with Error::Fetch.
bearer_token: Option<&'a BearerToken>A token for Authorization: Bearer, for this request.
It replaces the credentials of the fetcher.
Beside basic_auth, beside an
Authorization entry in headers, or beside
a signer of the fetcher, it fails the
upload before admission with Error::Fetch.
allow_cleartext_credentials: boolThe permission for a credential to reach a cleartext origin.
FetchRequest::allow_cleartext_credentials states the rule.
response_timeout: Option<Duration>The longest wait for the response head after hyper takes the end of the body.
None takes progress_timeout.
Implementations§
Source§impl<'a> UploadRequest<'a>
impl<'a> UploadRequest<'a>
Sourcepub const DEFAULT_MAX_RESPONSE: u64
pub const DEFAULT_MAX_RESPONSE: u64
The default response cap of a request: 2 MiB.
Sourcepub fn path(path: &'a str, body: UploadBody) -> UploadRequest<'a>
pub fn path(path: &'a str, body: UploadBody) -> UploadRequest<'a>
Creates a POST of body to path under each mirror.
The request has normal priority. It carries the headers and the credentials of the fetcher.
Sourcepub fn url(url: &'a str, body: UploadBody) -> UploadRequest<'a>
pub fn url(url: &'a str, body: UploadBody) -> UploadRequest<'a>
Creates a POST of body to the absolute URL url.
The request has normal priority. It carries the headers and the credentials of the fetcher.