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

> On Wed, Jun 15, 2011 at 4:34 AM, saurabh verma <nitw.saur...@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 


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to