(
self,
io: Input,
target: T,
)
| 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!( |
no test coverage detected