Skip to content

Commit

Permalink
g3-icap-client: rename trait methods
Browse files Browse the repository at this point in the history
  • Loading branch information
zh-jq-b committed Nov 26, 2024
1 parent 1b94b96 commit 608e799
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion lib/g3-http/src/client/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion lib/g3-http/src/client/transparent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion lib/g3-http/src/server/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion lib/g3-http/src/server/transparent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion lib/g3-icap-client/src/reqmod/h1/bidirectional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl<I: IdleCheck> 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
Expand Down
8 changes: 4 additions & 4 deletions lib/g3-icap-client/src/reqmod/h1/impl_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand All @@ -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)
}
}
2 changes: 1 addition & 1 deletion lib/g3-icap-client/src/reqmod/h1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub trait HttpRequestForAdaptation {
fn body_type(&self) -> Option<HttpBodyType>;
fn serialize_for_adapter(&self) -> Vec<u8>;
fn append_upgrade_header(&self, buf: &mut Vec<u8>);
fn adapt_to_chunked(&self, other: HttpAdaptedRequest) -> Self;
fn adapt_to(&self, other: HttpAdaptedRequest) -> Self;
}

#[allow(async_fn_in_trait)]
Expand Down
6 changes: 3 additions & 3 deletions lib/g3-icap-client/src/reqmod/h1/recv_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ impl<I: IdleCheck> HttpRequestAdapter<I> {
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;
Expand All @@ -172,7 +172,7 @@ impl<I: IdleCheck> HttpRequestAdapter<I> {
)
.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
Expand Down Expand Up @@ -210,7 +210,7 @@ impl<I: IdleCheck> HttpRequestAdapter<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
Expand Down
2 changes: 1 addition & 1 deletion lib/g3-icap-client/src/respmod/h1/bidirectional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl<I: IdleCheck> 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)
Expand Down
8 changes: 4 additions & 4 deletions lib/g3-icap-client/src/respmod/h1/impl_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand All @@ -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)
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/g3-icap-client/src/respmod/h1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub trait HttpResponseForAdaptation {
fn body_type(&self, method: &Method) -> Option<HttpBodyType>;
fn serialize_for_client(&self) -> Vec<u8>;
fn serialize_for_adapter(&self) -> Vec<u8>;
fn adapt_to_chunked(&self, other: HttpAdaptedResponse) -> Self;
fn adapt_to(&self, other: HttpAdaptedResponse) -> Self;
}

#[allow(async_fn_in_trait)]
Expand Down
4 changes: 2 additions & 2 deletions lib/g3-icap-client/src/respmod/h1/recv_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl<I: IdleCheck> HttpResponseAdapter<I> {
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)
Expand Down Expand Up @@ -200,7 +200,7 @@ impl<I: IdleCheck> HttpResponseAdapter<I> {
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)
Expand Down

0 comments on commit 608e799

Please sign in to comment.