-
-
Notifications
You must be signed in to change notification settings - Fork 807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement HTTP Forwarding Proxy #202
Comments
What's the difference between this and #201? |
Forwarding is sending a request to a proxy and that proxy makes the request on your behalf and then gives you back the response. Tunnel/CONNECT is asking the proxy for a TCP tunnel via CONNECT and then proceeding with HTTP(S) as normal through that tunnel. The second one makes TLS possible as the proxy can't prove it is the website you're trying to connect to without some MITM stuff happening there but forwarding is a valid proxying method for HTTP. |
So in the requests API, where we have |
@sethmlarson in my case i need to be able to add extra headers to those CONNECT/tunnel when proxy is used will be possible? |
@GnubiBORED Yes that will be possible via configuring your proxy like so (or something similar, API isn't nailed down yet): import httpx
proxy = httpx.HTTPProxy(
"http://127.0.0.1:8080",
proxy_headers={"Proxy-Authorization": "..."}
)
client = httpx.Client(
proxies={"http": proxy, "https": proxy}
) For HTTP (forwarding) the headers are sent with the request. Does that handle your use-case? :) |
yep it handle my case totally if those headers are JUST SENT IN THE CONNECT and not in post/get, i mean if just are used when CONNECT requests happens, only question more is thath if i can order headers passing and collections.OrderectDict like i do in requests. but i think its possible and works, correct me if im wrong |
@GnubiBORED: To answer your questions: For HTTP Forwarding proxies (http://...) the proxy headers are joined to the request headers that are sent to the proxy. It's up to the proxy to strip them ( For HTTP CONNECT proxies (https://...) the proxy headers are only sent for the CONNECT request. The actual request won't include any of the proxy headers. And yes if you pass an iterable of tuples order is preserved. |
any update in proxy implementation in httpx? |
I'm working on combining the proxy implementations. I have them working I believe the issue now is writing tests for them. Will push what I have today and continue writing tests. |
you will comment it on HTTP(S) Proxy Support (TODO) in readme once its done? |
Yeah I'll be removing that and in the docs. :) |
Awesome work @sethmlarson , this has been a long-standing reason why I couldn't use HttpX just yet. |
@adrianmeraz I'm so glad! :) Have you tested the PR to see if it works properly for your user-case? Would love more eyes on it. |
@sethmlarson I'll be sure to test it out ASAP! |
im new to python/coding but its already testeable? if yes i would like to test these feature even if dosnt work good or whatever |
Yeah @GnubiBORED you would have to pull this exact branch though. Once it lands in master I'll be tagging a new release so everyone waiting for proxies can try the new feature. :) |
@sethmlarson i downloaded these
|
also with
|
@GnubiBORED @adrianmeraz Proxies are in the latest release! 🎉 Could you give them a try? |
Related: #36
The text was updated successfully, but these errors were encountered: