Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder4.news.weretis.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.019 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'wed,': 0.03; 'https': 0.07; 'urllib2': 0.07; 'python': 0.08; 'internally': 0.09; 'subject:DNS': 0.09; 'linux': 0.11; 'am,': 0.14; 'wrote:': 0.14; 'angelico': 0.16; 'curious,': 0.16; 'curl': 0.16; 'handshake': 0.16; 'received:192.168.2.2': 0.16; 'cc:addr:python-list': 0.17; 'awesome': 0.19; 'header:In-Reply-To:1': 0.21; 'cc:2**0': 0.22; 'cc:no real name:2**0': 0.23; 'trying': 0.23; 'thats': 0.23; 'load': 0.24; 'code': 0.24; 'subject:Question': 0.25; 'function': 0.25; 'script': 0.27; 'testing': 0.27; 'example': 0.27; 'thanks': 0.28; 'problem': 0.28; 'server': 0.29; 'host': 0.29; 'cc:addr:python.org': 0.30; 'calling': 0.31; 'apply': 0.32; 'list': 0.33; 'chris': 0.34; 'source': 0.34; 'received:192.168.2': 0.34; 'dns': 0.35; 'hacking': 0.35; 'received:74.125.83.174': 0.35; 'received:mail-pv0-f174.google.com': 0.35; 'using': 0.35; 'test': 0.35; 'message-id:@gmail.com': 0.36; 'running': 0.37; 'received:google.com': 0.37; 'something': 0.37; 'http': 0.37; 'case': 0.37; 'two': 0.37; 'received:74.125': 0.38; 'domain': 0.38; 'mailing': 0.38; 'but': 0.38; 'returning': 0.38; 'subject:: ': 0.38; 'some': 0.38; 'received:192': 0.38; 'don\x92t': 0.39; 'header:Mime-Version:1': 0.39; 'either': 0.39; 'add': 0.39; 'header': 0.40; 'plain': 0.40; 'worth': 0.60; 'more': 0.60; 'your': 0.60; 'header:Message-Id:1': 0.62; 'domains': 0.67; 'enjoy': 0.68; 'informative': 0.73; '2.7.1': 0.84; 'beside': 0.84; 'ipb': 0.84; 'touching': 0.84; 'can\x92t': 0.91; 'exposing': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:subject:mime-version:content-type:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to:x-mailer; bh=i6ZnKk0CN+d8Dwm0zMivm6AePhZFRGS7NsdGII1y9C4=; b=NKhT3wB2fD2vEuH+Zh8T19KLGpipL4KYa/zRlDjlB/VDNYvvusi1BYPkRXD+OPU3f/ cyw3Mx4V5Km2kZgZmasnWG9oQTlVJD8cfTz3oEIciMxs97hpcTC6VNNaeOKtrsto0zFM pAB2glRJREWIhis69tgxUFcUMpLyB+nyzjwJ4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; b=mNYSyZk/lNm3D0GhhxdKOSRkYe03QmJ3PihjnT7BImmIfWWYR8Q8EpPtnnwQr7HN8a su+QB/KRcxk78EdV8PBUV8ViOJQkPNFM+e/sjx24Lq8ZurxZnA+uYRzbWeTgZ9dFLshJ 4mpTWjlc2EE7NLQxzsv/sZ3eVJZG5Z941QopY= Subject: Re: Question regarding DNS resolution in urllib2 Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=windows-1252 From: saurabh verma In-Reply-To: Date: Wed, 15 Jun 2011 11:53:13 +0530 Content-Transfer-Encoding: quoted-printable References: To: Chris Angelico X-Mailer: Apple Mail (2.1084) Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 54 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1308118691 news.xs4all.nl 49183 [::ffff:82.94.164.166]:40991 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:7673 On 15-Jun-2011, at 6:13 AM, Chris Angelico wrote: > On Wed, Jun 15, 2011 at 4:34 AM, saurabh verma = wrote: >> hi , >>=20 >> 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 =93Host: domain=94 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=92t apply host header = in the request . >=20 > 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 .=20= Example ,=20 I have =93http://something.com=94 and =93https://something.com=94 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=20 curl =93http://IPA/=94 -H =93Host: something.com" curl =93http://IPB/=94 -H =93Host: something.com=94 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 ,=20 curl =93https://something.com=94 , now something.com will try to connect = to either IPA or IPB which I don=92t 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 .=20 Is it worth hacking libcurl2 code for something like , Also i=92m just = not more than 1 week exprienced in python , but i do enjoy your mailing = list , awesome participation .=20 Thanks ,=20 Saurabh Verma=20