Skip to content

Commit

Permalink
g3proxy: check out http forward capacilities only when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
zh-jq-b committed Jun 19, 2024
1 parent cc8e786 commit 4b97ff0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions g3proxy/src/serve/http_proxy/task/pipeline/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,21 +265,25 @@ where
path_selection,
);

let forward_capability = self
.forward_context
.check_in_final_escaper(&task_notes, &req.upstream)
.await;
let remote_protocol = match req.client_protocol {
HttpProxySubProtocol::TcpConnect => HttpProxySubProtocol::TcpConnect,
HttpProxySubProtocol::HttpForward => HttpProxySubProtocol::HttpForward,
HttpProxySubProtocol::HttpsForward => {
let forward_capability = self
.forward_context
.check_in_final_escaper(&task_notes, &req.upstream)
.await;
if forward_capability.forward_https() {
HttpProxySubProtocol::HttpForward
} else {
HttpProxySubProtocol::HttpsForward
}
}
HttpProxySubProtocol::FtpOverHttp => {
let forward_capability = self
.forward_context
.check_in_final_escaper(&task_notes, &req.upstream)
.await;
if forward_capability.forward_ftp(&req.inner.method) {
HttpProxySubProtocol::HttpForward
} else {
Expand Down

0 comments on commit 4b97ff0

Please sign in to comment.