From f3e9ecd2bbcce44ec972dae3b125a13742d62919 Mon Sep 17 00:00:00 2001 From: Zhang Jingqiang Date: Tue, 26 Nov 2024 16:19:02 +0800 Subject: [PATCH] g3-icap-client: rename trait methods --- lib/g3-http/src/client/response.rs | 2 +- lib/g3-http/src/client/transparent.rs | 2 +- lib/g3-http/src/server/request.rs | 2 +- lib/g3-http/src/server/transparent.rs | 2 +- lib/g3-icap-client/src/reqmod/h1/bidirectional.rs | 2 +- lib/g3-icap-client/src/reqmod/h1/impl_trait.rs | 8 ++++---- lib/g3-icap-client/src/reqmod/h1/mod.rs | 2 +- lib/g3-icap-client/src/reqmod/h1/recv_request.rs | 6 +++--- lib/g3-icap-client/src/respmod/h1/bidirectional.rs | 2 +- lib/g3-icap-client/src/respmod/h1/impl_trait.rs | 8 ++++---- lib/g3-icap-client/src/respmod/h1/mod.rs | 2 +- lib/g3-icap-client/src/respmod/h1/recv_response.rs | 4 ++-- 12 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lib/g3-http/src/client/response.rs b/lib/g3-http/src/client/response.rs index afcae69c..58778ba4 100644 --- a/lib/g3-http/src/client/response.rs +++ b/lib/g3-http/src/client/response.rs @@ -65,7 +65,7 @@ impl HttpForwardRemoteResponse { } } - pub fn adapt_to_chunked(&self, adapted: HttpAdaptedResponse) -> Self { + pub fn adapt_to(&self, adapted: HttpAdaptedResponse) -> Self { let mut hop_by_hop_headers = self.hop_by_hop_headers.clone(); match adapted.content_length { Some(content_length) => { diff --git a/lib/g3-http/src/client/transparent.rs b/lib/g3-http/src/client/transparent.rs index 118a0ed2..d9ddb0d8 100644 --- a/lib/g3-http/src/client/transparent.rs +++ b/lib/g3-http/src/client/transparent.rs @@ -69,7 +69,7 @@ impl HttpTransparentResponse { } } - pub fn adapt_to_chunked(&self, adapted: HttpAdaptedResponse) -> Self { + pub fn adapt_to(&self, adapted: HttpAdaptedResponse) -> Self { let mut hop_by_hop_headers = self.hop_by_hop_headers.clone(); match adapted.content_length { Some(content_length) => { diff --git a/lib/g3-http/src/server/request.rs b/lib/g3-http/src/server/request.rs index 9f5afea9..49bf82b3 100644 --- a/lib/g3-http/src/server/request.rs +++ b/lib/g3-http/src/server/request.rs @@ -68,7 +68,7 @@ impl HttpProxyClientRequest { } } - pub fn adapt_to_chunked(&self, adapted: HttpAdaptedRequest) -> Self { + pub fn adapt_to(&self, adapted: HttpAdaptedRequest) -> Self { let mut hop_by_hop_headers = self.hop_by_hop_headers.clone(); match adapted.content_length { Some(content_length) => { diff --git a/lib/g3-http/src/server/transparent.rs b/lib/g3-http/src/server/transparent.rs index 264f8e5d..343beb0d 100644 --- a/lib/g3-http/src/server/transparent.rs +++ b/lib/g3-http/src/server/transparent.rs @@ -73,7 +73,7 @@ impl HttpTransparentRequest { } } - pub fn adapt_to_chunked(&self, adapted: HttpAdaptedRequest) -> Self { + pub fn adapt_to(&self, adapted: HttpAdaptedRequest) -> Self { let mut hop_by_hop_headers = self.hop_by_hop_headers.clone(); match adapted.content_length { Some(content_length) => { diff --git a/lib/g3-icap-client/src/reqmod/h1/bidirectional.rs b/lib/g3-icap-client/src/reqmod/h1/bidirectional.rs index eecf4091..8a443470 100644 --- a/lib/g3-icap-client/src/reqmod/h1/bidirectional.rs +++ b/lib/g3-icap-client/src/reqmod/h1/bidirectional.rs @@ -150,7 +150,7 @@ impl BidirectionalRecvHttpRequest<'_, I> { .await?; let body_content_length = http_req.content_length; - let final_req = orig_http_request.adapt_to_chunked(http_req); + let final_req = orig_http_request.adapt_to(http_req); ups_writer .send_request_header(&final_req) .await diff --git a/lib/g3-icap-client/src/reqmod/h1/impl_trait.rs b/lib/g3-icap-client/src/reqmod/h1/impl_trait.rs index b7621e66..a34d36f2 100644 --- a/lib/g3-icap-client/src/reqmod/h1/impl_trait.rs +++ b/lib/g3-icap-client/src/reqmod/h1/impl_trait.rs @@ -43,8 +43,8 @@ impl HttpRequestForAdaptation for HttpProxyClientRequest { } } - fn adapt_to_chunked(&self, other: HttpAdaptedRequest) -> Self { - self.adapt_to_chunked(other) + fn adapt_to(&self, other: HttpAdaptedRequest) -> Self { + self.adapt_to(other) } } @@ -69,7 +69,7 @@ impl HttpRequestForAdaptation for HttpTransparentRequest { } } - fn adapt_to_chunked(&self, other: HttpAdaptedRequest) -> Self { - self.adapt_to_chunked(other) + fn adapt_to(&self, other: HttpAdaptedRequest) -> Self { + self.adapt_to(other) } } diff --git a/lib/g3-icap-client/src/reqmod/h1/mod.rs b/lib/g3-icap-client/src/reqmod/h1/mod.rs index 0a9b6f6f..ec2096a9 100644 --- a/lib/g3-icap-client/src/reqmod/h1/mod.rs +++ b/lib/g3-icap-client/src/reqmod/h1/mod.rs @@ -54,7 +54,7 @@ pub trait HttpRequestForAdaptation { fn body_type(&self) -> Option; fn serialize_for_adapter(&self) -> Vec; fn append_upgrade_header(&self, buf: &mut Vec); - fn adapt_to_chunked(&self, other: HttpAdaptedRequest) -> Self; + fn adapt_to(&self, other: HttpAdaptedRequest) -> Self; } #[allow(async_fn_in_trait)] diff --git a/lib/g3-icap-client/src/reqmod/h1/recv_request.rs b/lib/g3-icap-client/src/reqmod/h1/recv_request.rs index 01b6610f..51c3dff2 100644 --- a/lib/g3-icap-client/src/reqmod/h1/recv_request.rs +++ b/lib/g3-icap-client/src/reqmod/h1/recv_request.rs @@ -144,7 +144,7 @@ impl HttpRequestAdapter { self.http_req_add_no_via_header, ) .await?; - let final_req = orig_http_request.adapt_to_chunked(http_req); + let final_req = orig_http_request.adapt_to(http_req); if icap_rsp.keep_alive { self.icap_client.save_connection(self.icap_connection).await; @@ -171,7 +171,7 @@ impl HttpRequestAdapter { ) .await?; - let final_req = orig_http_request.adapt_to_chunked(http_req); + let final_req = orig_http_request.adapt_to(http_req); ups_writer .send_request_header(&final_req) .await @@ -209,7 +209,7 @@ impl HttpRequestAdapter { .await?; let body_content_length = http_req.content_length; - let final_req = orig_http_request.adapt_to_chunked(http_req); + let final_req = orig_http_request.adapt_to(http_req); ups_writer .send_request_header(&final_req) .await diff --git a/lib/g3-icap-client/src/respmod/h1/bidirectional.rs b/lib/g3-icap-client/src/respmod/h1/bidirectional.rs index 77790061..3243342f 100644 --- a/lib/g3-icap-client/src/respmod/h1/bidirectional.rs +++ b/lib/g3-icap-client/src/respmod/h1/bidirectional.rs @@ -143,7 +143,7 @@ impl BidirectionalRecvHttpResponse<'_, I> { let http_rsp = HttpAdaptedResponse::parse(icap_reader, http_header_size).await?; let body_content_length = http_rsp.content_length; - let final_rsp = orig_http_response.adapt_to_chunked(http_rsp); + let final_rsp = orig_http_response.adapt_to(http_rsp); state.mark_clt_send_start(); clt_writer .send_response_header(&final_rsp) diff --git a/lib/g3-icap-client/src/respmod/h1/impl_trait.rs b/lib/g3-icap-client/src/respmod/h1/impl_trait.rs index 9ed17c6f..995e8e53 100644 --- a/lib/g3-icap-client/src/respmod/h1/impl_trait.rs +++ b/lib/g3-icap-client/src/respmod/h1/impl_trait.rs @@ -35,8 +35,8 @@ impl HttpResponseForAdaptation for HttpForwardRemoteResponse { self.serialize_for_adapter() } - fn adapt_to_chunked(&self, other: HttpAdaptedResponse) -> Self { - self.adapt_to_chunked(other) + fn adapt_to(&self, other: HttpAdaptedResponse) -> Self { + self.adapt_to(other) } } @@ -53,8 +53,8 @@ impl HttpResponseForAdaptation for HttpTransparentResponse { self.serialize_for_adapter() } - fn adapt_to_chunked(&self, other: HttpAdaptedResponse) -> Self { - self.adapt_to_chunked(other) + fn adapt_to(&self, other: HttpAdaptedResponse) -> Self { + self.adapt_to(other) } } diff --git a/lib/g3-icap-client/src/respmod/h1/mod.rs b/lib/g3-icap-client/src/respmod/h1/mod.rs index c3e0f7b5..86b4bfb5 100644 --- a/lib/g3-icap-client/src/respmod/h1/mod.rs +++ b/lib/g3-icap-client/src/respmod/h1/mod.rs @@ -50,7 +50,7 @@ pub trait HttpResponseForAdaptation { fn body_type(&self, method: &Method) -> Option; fn serialize_for_client(&self) -> Vec; fn serialize_for_adapter(&self) -> Vec; - fn adapt_to_chunked(&self, other: HttpAdaptedResponse) -> Self; + fn adapt_to(&self, other: HttpAdaptedResponse) -> Self; } #[allow(async_fn_in_trait)] diff --git a/lib/g3-icap-client/src/respmod/h1/recv_response.rs b/lib/g3-icap-client/src/respmod/h1/recv_response.rs index 1a76fef7..e76ef587 100644 --- a/lib/g3-icap-client/src/respmod/h1/recv_response.rs +++ b/lib/g3-icap-client/src/respmod/h1/recv_response.rs @@ -165,7 +165,7 @@ impl HttpResponseAdapter { let http_rsp = HttpAdaptedResponse::parse(&mut self.icap_connection.1, http_header_size).await?; - let final_rsp = orig_http_response.adapt_to_chunked(http_rsp); + let final_rsp = orig_http_response.adapt_to(http_rsp); state.mark_clt_send_start(); clt_writer .send_response_header(&final_rsp) @@ -200,7 +200,7 @@ impl HttpResponseAdapter { HttpAdaptedResponse::parse(&mut self.icap_connection.1, http_header_size).await?; let body_content_length = http_rsp.content_length; - let final_rsp = orig_http_response.adapt_to_chunked(http_rsp); + let final_rsp = orig_http_response.adapt_to(http_rsp); state.mark_clt_send_start(); clt_writer .send_response_header(&final_rsp)