MCPcopy Create free account
hub / github.com/Recordscript/recordscript / http_connect

Method http_connect

libs/hbb_common/src/proxy.rs:471–488  ·  view source on GitHub ↗
(
        self,
        io: Input,
        target: T,
    )

Source from the content-addressed store, hash-verified

469 }
470
471 pub async fn http_connect<'a, Input, T>(
472 self,
473 io: Input,
474 target: T,
475 ) -> Result<BufStream<Input>, ProxyError>
476 where
477 Input: AsyncRead + AsyncWrite + Unpin,
478 T: IntoTargetAddr<'a>,
479 {
480 let mut stream = BufStream::new(io);
481 let (domain, port) = get_domain_and_port(target)?;
482
483 let request = self.make_request(&domain, port);
484 stream.write_all(request.as_bytes()).await?;
485 stream.flush().await?;
486 recv_and_check_response(&mut stream).await?;
487 Ok(stream)
488 }
489
490 fn make_request(&self, host: &str, port: u16) -> String {
491 let mut request = format!(

Callers 2

connectMethod · 0.80
https_connectMethod · 0.80

Calls 4

get_domain_and_portFunction · 0.85
recv_and_check_responseFunction · 0.85
make_requestMethod · 0.80
flushMethod · 0.45

Tested by

no test coverage detected