Skip to main content

write_local_error

Function write_local_error 

Source
pub async fn write_local_error<W>(
    stream: &mut W,
    status: u16,
    body: &str,
) -> Result<(), Error>
where W: AsyncWrite + Unpin + ?Sized,
Expand description

Writes an HTTP error response to a local client whose exchange could not be proxied.

Plain text and a real status rather than dropping the socket: a browser pointed at a tunnel whose token lost its scope should render the reason, and a dropped connection renders as “the site can’t be reached”, which names the wrong component.