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


Groups > comp.lang.python > #7673 > unrolled thread

Re: Question regarding DNS resolution in urllib2

Started bysaurabh verma <nitw.saurabh@gmail.com>
First post2011-06-15 11:53 +0530
Last post2011-06-15 11:53 +0530
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#7673 — Re: Question regarding DNS resolution in urllib2

Fromsaurabh verma <nitw.saurabh@gmail.com>
Date2011-06-15 11:53 +0530
SubjectRe: Question regarding DNS resolution in urllib2
Message-ID<mailman.258.1308118691.11593.python-list@python.org>
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 

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web