You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for the awesome project and I really like to use this library.
While using this library, I have a quick suggestion to support more use case, such as proxy. This is similar with #2509.
The project I'm now working on is to send the original request to other downstream if the current server doesn't support it. It is kind of fallback mechanism. In this process, one of the requirement is that we want to keep the original request as it is and let the downstream sees the same requests. The downstream is on the same host. If it is HTTPS request, the main server will terminate it and forward to the downstream service.
In Hyper, the problem is that it enforces making origin_form if we call Hyper Client with is_proxied = true and absolute_form. (Link)
fnabsolute_form(uri:&mutUri){debug_assert!(uri.scheme().is_some(),"absolute_form needs a scheme");debug_assert!(
uri.authority().is_some(),"absolute_form needs an authority");// If the URI is to HTTPS, and the connector claimed to be a proxy,// then it *should* have tunneled, and so we don't want to send// absolute-form in that case.if uri.scheme() == Some(&Scheme::HTTPS){origin_form(uri);}}
This is blocking to forward the HTTPS request to the downstream after the TLS termination. We might be able to change the scheme to HTTP to skip the check, but the better thing without touching the request would be introducing keep_original_uri flag not to touch the URI. This will help users to use the Hyper client more flexibly for various purpose.
if !self.config.keep_original_uri{// New Suggestion// CONNECT always sends authority-form, so check it first...if req.method() == Method::CONNECT{authority_form(req.uri_mut());}elseif pooled.conn_info.is_proxied{absolute_form(req.uri_mut());}else{origin_form(req.uri_mut());}}
If you are okay with this idea, I can raise a PR to this Hyper 0.14 and Hyper-Util package. Thanks in advance.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, Folks,
Thank you for the awesome project and I really like to use this library.
While using this library, I have a quick suggestion to support more use case, such as proxy. This is similar with #2509.
The project I'm now working on is to send the original request to other downstream if the current server doesn't support it. It is kind of fallback mechanism. In this process, one of the requirement is that we want to keep the original request as it is and let the downstream sees the same requests. The downstream is on the same host. If it is HTTPS request, the main server will terminate it and forward to the downstream service.
In Hyper, the problem is that it enforces making
origin_form
if we call Hyper Client withis_proxied = true
andabsolute_form
. (Link)This is blocking to forward the HTTPS request to the downstream after the TLS termination. We might be able to change the scheme to HTTP to skip the check, but the better thing without touching the request would be introducing
keep_original_uri
flag not to touch the URI. This will help users to use the Hyper client more flexibly for various purpose.If you are okay with this idea, I can raise a PR to this Hyper 0.14 and Hyper-Util package. Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions