#[non_exhaustive]pub enum RedirectRefusal {
Credentials,
Body,
Payload,
TooMany,
}Expand description
Why a redirect was refused rather than followed.
The rules live with the transport that applies them; this is the half of
them a caller can branch on. Each variant renders the clause the error
message carries, so refusal.to_string() is what the user is told.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Credentials
The request carries credentials, and the redirect leaves the origin they were addressed to.
The one this crate exists to report. A same-origin redirect is followed instead: the token reaches no host it was not already going to.
Body
The request body cannot be sent a second time.
A redirect is followed by sending the same request to the address it
named: same method, same payload. So a body is no reason to refuse one
— a bodiless POST, which is most of API v4, goes wherever it is
pointed, and a body held in memory goes with it.
A body that is a stream cannot. write_table from an iterator and
every raw_command_upload read their body as it is sent, so by the
time the 3xx arrives some of it has already gone and there is nothing
to rewind. Sending what is left would be a different request; sending
nothing is the expensive failure this refuses — a write_table that
arrived carrying no rows is answered much like one that succeeded.
Payload
The request carries data, and the redirect leaves the origin it was addressed to.
RedirectRefusal::Credentials asked again about the other thing a
caller chooses a host for. A token is not the only thing worth
withholding from a host nobody named: a table’s rows are the caller’s
own data, and a Location header is the far end of the connection
asking for them to be sent somewhere else. So this one does not wait
for a token to be present.
A redirect that stays on the origin is followed, body and all — the
bytes were already going there. And a body of length zero is not data:
Content-Length: 0 gives nothing away, so most of API v4 is unaffected.
TooMany
The redirects did not end.
This client follows a bounded number of same-origin hops; a balancer pointing at itself is a loop, not a route.
Trait Implementations§
Source§impl Clone for RedirectRefusal
impl Clone for RedirectRefusal
Source§fn clone(&self) -> RedirectRefusal
fn clone(&self) -> RedirectRefusal
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for RedirectRefusal
Source§impl Debug for RedirectRefusal
impl Debug for RedirectRefusal
Source§impl Display for RedirectRefusal
impl Display for RedirectRefusal
impl Eq for RedirectRefusal
Source§impl Error for RedirectRefusal
impl Error for RedirectRefusal
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()