How to set a timeout?

Steve Holden sholden at holdenweb.com
Wed Jul 18 15:42:39 EDT 2001


"Matthias Huening" <mhuening at zedat.fu-berlin.de> wrote in message
news:9j4ntg$m8l0k$1 at fu-berlin.de...
> Thanks, Marco, for pointing me to the signal-module.
>
> And, Steve, thank you very much for your 'other suggestion'.
> I have to admit that I don't understand how it works but - it works!!
> The asyncore-module is really great! Exactly what I was looking for.
>
> One question: while playing around with your example I noticed that there
> seems to be a problem with virtual servers. Your http_client-class seems
to
> ignore virtual servers. E.g. the page:
> http://www.niederlandistik.fu-berlin.de/mitarbeiter.html
> is not found (but it exists...).
> Any ideas?

You might find you need to examine the HTTP response headers and access
another page. I think that httplib does that for you, but you will have to
code it yourself with asyncore. Here's a trace from a proxy trying to access
that page on my browser's behalf. Did I get anything wrong? I cam certainly
access the page in IE. In this case the server might not have liked the
apparently-spoofed "Host:" header which the proxy just dumbly echoes out.

By the way, the proxy is another Rushing-inspired tool!

D:\Book1\Code\Ch7>python proxysample.py www.niederlandistik.fu-berlin.de 80
<==(0) 'GET /mitarbeiter.html HTTP/1.0\015'
<==(0) 'Accept: application/vnd.ms-excel, application/msword,
application/vnd.ms-powerpoint, image/gif, image/x-xbitmap, image/jpeg,
image/pjpeg, */*\015'
<==(0) 'Accept-Language: en-us\015'
<==(0) 'User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; MSNIA; Windows
98)\015'
<==(0) 'Host: 127.0.0.1:8080\015'
<==(0) 'Connection: Keep-Alive\015'
<==(0) '\015'
Connected
==>(0) 'HTTP/1.1 404 Not Found\015'
==>(0) 'Date: Wed, 18 Jul 2001 19:38:16 GMT\015'
==>(0) 'Server: Apache/1.3.9 (Unix) Debian/GNU PHP/4.0.3pl1 mod_ssl/2.4.10
OpenSSL/0.9.4\015'
==>(0) 'Connection: close\015'
==>(0) 'Content-Type: text/html; charset=iso-8859-1\015'
==>(0) '\015'
==>(0) '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">'
==>(0) '<HTML><HEAD>'
==>(0) '<TITLE>404 Not Found</TITLE>'
==>(0) '</HEAD><BODY>'
==>(0) '<H1>Not Found</H1>'
==>(0) 'The requested URL /mitarbeiter.html was not found on this
server.<P>'
==>(0) '</BODY></HTML>'

regards
 Steve
--
http://www.holdenweb.com/








More information about the Python-list mailing list