HTTP getreply() never returns

Steve Holden steve at holdenweb.com
Fri Apr 20 01:06:21 EDT 2007


Marko.Cain.23 at gmail.com wrote:
> On Apr 19, 2:39 pm, Steve Holden <s... at holdenweb.com> wrote:
>> Marko.Cain... at gmail.com wrote:
>>> Hi,
>>> I have the following code which send/receive HTTP request/response:
>>>    # where sampleUrl is '127.0.0.1' and
>>>    # url is 'www.cnn.com'
>>>    h = httplib.HTTP(self.sampleUrl, 8080)
>>>         h.putrequest('GET', '/sample?url=' + self.url)
>>>         h.endheaders()
>>>         errcode, errmsg, headers = h.getreply()
>>> But it never returns from h.getreply().
>>> I am using python 2.3.4. Can you please tell me what am I missing?
>>> I am sure the url is correctly. I try putting this 'http://
>>> 127.0.0.1:8080/sample?url=www.cnn.com'and it works.
>>> Thank you for any help.
>[...]
>>
>> For what it's worth you *do* appear to have formed the calls correctly,
>> so something a little more complex is going on here.
>>
>> You might consider using WireShark (nee Ethereal) to look at the data
>> passing across the wire when you use the browser and when you use
>> httplib then comparing the data. That won't work on Windows because it
>> disobligingly refuses to let you tap into the loopback (127) network.
>>
>> regards
>>   Steve
> 
> 
> Thanks. I run the same script hits the same server (a tomcat server):
> One is on Fedora 5 with python 2.4, this works.
> But one is on Red Hat 4 with python 2.3, this one does not work.
> 
> Can you please tell me how can I make the script works on RHEL 4
> without upgrading it to python 2.3?
> 
I can't see anything in

http://svn.python.org/view/python/trunk/Lib/httplib.py?rev=54581&view=log

that screams it might have fixed a problem. But I'd be tempted to try 
and "borrow" a copy of 2.4's httplib, run your program with that in a 
directory where it will be found before the standard library 2.3 module 
and see if it fixes the problem.

If so, would it be a usable workaround just to use the 2.4 httplib for 
that one program?

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb     http://del.icio.us/steve.holden
Recent Ramblings       http://holdenweb.blogspot.com




More information about the Python-list mailing list