Conversation
|
Okay... interesting. I was expecting this to be applied in We actually support this in Perhaps that distinction is subtle enough that it makes sense for us to apply this extension at the Note to self our Request/Response/URL docs are missing here... https://github.com/encode/httpcore/blob/d4678e61b0af24747676c18fb0cb0b2027867bb0/docs/requests-responses-urls.md |
|
I thought it is more natural to have this kind of extension logic in the httpcore package + all the transports will support it. |
|
How does this (does this?) effect (affect?) the proxies? |
|
So here's where I was expecting we'd implement this... Thoughts? |
|
I don't see any differences, If you like to see this at the httpx layer, I can close this one and open a new PR. But, is there anything wrong with this one? Passing the target extension directly to the H11 target makes more sense to me. |
You're probably right that it's sensible to implement this directly in I think the neatest way is implementing this elsewhere... Line 354 in 908013c if 'target' in extensions:
self.url = URL(
scheme=self.url.scheme,
host=self.url.host,
port=self.url.port,
target=extensions['target'],
)That'll update the target once, and be passed through everywhere. Reasonable? |
Much neater, thanks. |
|
Looks good, thanks. 😊 I'd suggest also updating the Lines 212 to 219 in 908013c Since we can now express this with... url = "http://127.0.0.1:8080"
extensions = {"target: "http://www.example.com"}
with httpcore.stream("CONNECT", url, extensions=extensions) as response: Then, yep let's get this in. |
lovelydinosaur
left a comment
There was a problem hiding this comment.
Made a couple of additional docs changes on top of this.
Fantastic addition, thanks @karpetrosyan. 🎉
Refs: encode/httpx#2949 (reply in thread)
This PR adds a target extension, which can be used to force HTTP target to a specific bytes-encoded string.
Check out https://developer.mozilla.org/en-US/docs/Web/HTTP/Messages#request_line to read more about HTTP message structure and what HTTP target is.