Function tor_hsservice::internal_prelude::send_request

source ·
pub(crate) async fn send_request<R, S, SP>(
    runtime: &SP,
    req: &R,
    stream: &mut S,
    source: Option<SourceInfo>
) -> Result<DirResponse, Error>
Expand description

Fetch or upload a Tor directory object using the provided stream.

To do this, we send a simple HTTP/1.0 request for the described object in req over stream, and then wait for a response. In log messages, we describe the origin of the data as coming from source.

§Notes

It’s kind of bogus to have a ‘source’ field here at all; we may eventually want to remove it.

This function doesn’t close the stream; you may want to do that yourself.

The only error variant returned is Error::RequestFailed.