-
-
Notifications
You must be signed in to change notification settings - Fork 906
Deprecate passing DEFAULT proxy mode to HTTPCore #927
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
Conversation
😞 I'm getting different linting results locally than in CI. |
Okay. Most likely due to different package versions. I’d drop your virtualenv and reinstall. Really we ought to be pining our deps. |
I've rebuilt and it's now consistent, the problem is black and isort don't agree with each other. Maybe we should remove the isort check? |
Hey, @yeraydiazdiaz nice job! I was wondering if you deliberately left the mode default value of |
I wasn't sure at the time so and was hoping to discuss it in this PR but forgot to leave a TODO comment or something so thanks for bringing it up. Thinking about it now I'm leaning towards leaving it because That being said this PR will pass the Proxy as is, without changing its mode, to httpcore which was the point of removing it in the first place, so maybe we should prevent that by internally change the mode? |
Actually, I think a better flow would be to not warn at all and change the semantics of the proxy mode: That way we keep the |
I agree with you. I thought that a None option can be included. That way we can warn the users who use default mode explicitly. Others can be changed silently.
|
If we are going to go this route, then something that might? make sense at the |
Yup, that'd be good. It would be a breaking change in the API though, shall we defer to a later PR? Or are we confident enough on the change to do it now eyeing 0.13? |
Milestoning for 1.0 discussion. I feel like this could probably use a bit of "from the top" talk through of what the motivation is here. Since we've worked through things a bit now I guess the synopsis at this point would be...
I guess I can see the value in that from the perspective of keeping the Just to get my bearing a bit here...
|
To me there's two motivations:
I don't have a ton of experience in this area but I think it's about allowing the choice but being safe by default when people don't know/care. From my limited experience it seems most proxies implement both tunneling and forwarding. |
I think we probably want to punt this out of 0.13, since I think this design decision impacts on a bunch of other stuff that I'd like us to work through super carefully first. For example, it makes the We might even want to talk through the Transport API with the |
Sure thing, moving to 1.0. |
Client.proxies can only be a dict with keys http and https
Okay this was worth investigating, but at this point I'm going to suggest that we consider punting on this? I think it's beneficial that What do we think? |
Never been 100% sure I fully groked the debate about dropping It looks like the original motivation in encode/httpcore#65 was about "does choosing between FORWARD/TUNNEL belong to HTTPCore of high-level clients?".
What I do think though, regardless of this (or maybe as a pre-requisite?) is that our documentation on tunnel vs forward is not super clear right now. I think we ought to have a dedicated "FORWARD vs TUNNEL" section, which clearly explains what each approach does, and then provides key insights for the user to decide between both. (Ideally they shouldn't have to choose anything because the defaults would be sensible and secure enough?) |
Prompted by encode/httpcore#65 (comment)
The
DEFAULT
proxy mode is used to signal httpcore's proxy connection pools to use forwarding or tunnelling based on the request URL.However,
Client.dispatcher_for_url
usesClient.proxies
to pick a dispatcher based on the request URL, at which point HTTPX is able to choose between one proxy mode or the other. The only case where we want to delay the decision to httpcore is when the user has specified a single proxy string or URL or anall
-prefixed proxy config key in theproxies
dict effectively indicating both the proxy should be used for both HTTP and HTTPS.This PR removes the use of
all
-prefixed proxy config keys inClient.proxies
expanding them intohttp
andhttps
keys and mapping them to separateProxy
instances withFORWARD_ONLY
andTUNNEL_ONLY
modes respectively.