How to set a timeout?

Steve Holden sholden at
Wed Jul 18 21:42:39 CEST 2001

"Matthias Huening" <mhuening at> wrote in message
news:9j4ntg$m8l0k$1 at
> 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
> ignore virtual servers. E.g. the page:
> 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 80
<==(0) 'GET /mitarbeiter.html HTTP/1.0\015'
<==(0) 'Accept: application/, application/msword,
application/, 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
<==(0) 'Host:\015'
<==(0) 'Connection: Keep-Alive\015'
<==(0) '\015'
==>(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
==>(0) 'Connection: close\015'
==>(0) 'Content-Type: text/html; charset=iso-8859-1\015'
==>(0) '\015'
==>(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
==>(0) '</BODY></HTML>'


More information about the Python-list mailing list