Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #7673

Re: Question regarding DNS resolution in urllib2

Subject Re: Question regarding DNS resolution in urllib2
From saurabh verma <nitw.saurabh@gmail.com>
Date 2011-06-15 11:53 +0530
References <E284F771-80D9-4F21-9935-1D61E76F8B01@gmail.com> <BANLkTik8pc5aAiS2Y0KQqPfa80jU1ckFDQ@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.258.1308118691.11593.python-list@python.org> (permalink)

Show all headers | View raw


On 15-Jun-2011, at 6:13 AM, Chris Angelico wrote:

> On Wed, Jun 15, 2011 at 4:34 AM, saurabh verma <nitw.saurabh@gmail.com> wrote:
>> hi ,
>> 
>> I trying to use urllib2 in my script , but the problem is lets say a domains resolves to multiple IPs , If the URL is served by plain http , I can add “Host: domain” header and check whether all IPs are returning proper responses or not , but in case of https , I have to trust on my local machines dns resolver and I can’t apply host header in the request .
> 
> Regarding Host: headers, experimentation showed that urllib2 did
> indeed send one (I tested using Python 2.7.1 on Windows, talking to a
> snooping HTTPS server running on a Linux box beside me - source code
> available if you're curious, but it's not Python).

Ok thats informative , thanks :)  . But my problem lies in testing https based virtual served by nginx when the domain is load balanced by DNS . 

Example , 

I have “http://something.com” and “https://something.com” both served by two servers and something.com resolves to two ips IPA,IPB . lets say i want to test both servers on http i can do the following 

curl “http://IPA/” -H “Host: something.com"
curl “http://IPB/” -H “Host: something.com”


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 . 

Is it worth hacking libcurl2 code for something like , Also i’m just not more than 1 week exprienced in python , but i do enjoy your mailing list , awesome participation . 


Thanks , 

Saurabh Verma 

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Question regarding DNS resolution in urllib2 saurabh verma <nitw.saurabh@gmail.com> - 2011-06-15 11:53 +0530

csiph-web