Is custom name resolution implemented? #2592
-
Hello! I've searching through to find how to specify the destination IP without any issues related to SSL, and finally found an idea thread of @toppk , written an year ago. So, my question is, was there any advance? Can I specify which IP address to connect, along with the hostname? I've already tried to override Python socket package's resolution method as in Requests API, but it seems not to work properly with SOCKS5 proxy. About this, I suspect that since SOCKS5 implementations in HTTPX are actually SOCKS5h which the domain name is resolved at the remote(i.e. using SOCKS server), it does not call Python's Therefore, specifying an IP address with a hostname together is the best way in this case. Could I provide both of an IP address and a hostname, in a clearer way? Thanks, in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
Apologies for the slow reply...
So... I think there's an improvement that we could make here. Can you send a request to a specific IP, well yes... >>> httpx.get("http://142.250.200.36:80/", headers={"Host": "www.google.com"})
<Response [200 OK]> But this won't work for SSL requests... >>> httpx.get("https://142.250.200.36:443/", headers={"Host": "www.google.com"})
...
httpx.ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:997) This fails because it is attempting to sign the SSL cert with '142.250.200.36'. We could change this behaviour in |
Beta Was this translation helpful? Give feedback.
Apologies for the slow reply...
So... I think there's an improvement that we could make here.
Can you send a request to a specific IP, well yes...
But this won't work for SSL requests...
This fails because it is attempting to sign the SSL cert with '142.250.200.36'.
We could change this behaviour in
httpcore
, so that for…