Question regarding DNS resolution in urllib2

Chris Angelico rosuav at gmail.com
Wed Jun 15 02:45:11 EDT 2011


On Wed, Jun 15, 2011 at 4:23 PM, saurabh verma <nitw.saurabh at gmail.com> wrote:
> But in the case of https , I can do above because https handshake is based on the domain i am trying to connect , so lets say I want to following inside a python  script using libcurl2 but without touching /etc/hosts ,
>
> curl “https://something.com” , now something.com will try to connect to either IPA or IPB which I don’t have control over , I know internally it must be calling a DNS resolver libarary of python , I want to control over that , may be libcurl2 exposing a function to do some DNS altering .

If you edit your hosts file, it will affect where something.com points
- you can force it to be IPA and then test, then force it to IPB and
test. You'll still be downloading https://something.com so the HTTPS
handshake should work exactly the same way.

Chris Angelico



More information about the Python-list mailing list