pub async fn authenticate(
__arg0: State<Admission>,
request: Request,
next: Next,
) -> ResponseExpand description
Admit a request that presented the operator’s credential or a live turn’s, hand every handler who it authenticated as, and refuse every other request before anything reads it.
Exactly one Authorization header, spelled Bearer and then the
credential. Two headers, another scheme, another spelling of this one, and a
credential that is nobody’s are all the same refusal, which says what to
present and nothing about what was presented — and, on a server that has no
operator credential yet, names the command that issues one.
The refusal is decided on the head alone, and the body is then drained, up
to BODY_BOUND, before it is answered. Nothing reads what is
drained: a connection closed with a body still unread on it is closed with
a reset rather than an end, and a caller on Windows — where a reset discards
everything received and not yet read — then reads the abort in place of the
401 that was already on its way. Linux hands over what was queued first,
which is why the same race is only ever seen there.