Fix "inbound-http" feature (#323)

This commit is contained in:
vkill
2022-12-02 21:55:28 +08:00
committed by GitHub
parent 606d9de99a
commit fa017bb6a0
3 changed files with 5 additions and 8 deletions

View File

@@ -59,7 +59,7 @@ impl InboundStreamHandler for Handler {
&'a self,
mut sess: Session,
stream: Box<dyn ProxyStream>,
) -> std::io::Result<InboundTransport> {
) -> std::io::Result<AnyInboundTransport> {
let http = Http::new();
let proxy_service = ProxyService::new();
let conn = http
@@ -99,9 +99,6 @@ impl InboundStreamHandler for Handler {
sess.destination = destination;
Ok(InboundTransport::Stream(
Box::new(SimpleProxyStream(parts.io)),
sess,
))
Ok(InboundTransport::Stream(Box::new(parts.io), sess))
}
}

View File

@@ -21,8 +21,8 @@ impl<'a> SimpleCallback<'a> {
impl<'a> Callback for SimpleCallback<'a> {
fn on_request(self, request: &Request, response: Response) -> Result<Response, ErrorResponse> {
if request.uri().path() != self.path {
return Err(http::response::Response::builder()
.status(http::StatusCode::NOT_FOUND)
return Err(::http::response::Response::builder()
.status(::http::StatusCode::NOT_FOUND)
.body(None)
.unwrap());
}

View File

@@ -23,7 +23,7 @@ impl<'a> tungstenite::client::IntoClientRequest for Request<'a> {
fn into_client_request(
self,
) -> tungstenite::error::Result<tungstenite::handshake::client::Request> {
let mut builder = http::Request::builder()
let mut builder = ::http::Request::builder()
.method("GET")
.uri(self.uri)
.header("User-Agent", &*crate::option::HTTP_USER_AGENT);