Patch: httplib.py default timeout

Phil Mayes nospam at bitbucket.com
Thu Dec 23 04:27:36 EST 1999


Aahz Maruch wrote in message <83r0lh$mj6$1 at nntp6.atl.mindspring.net>...
>No, I'm not including the actual patch here.  I just wanted to see if
>anyone had an objection to changing httplib.py so that by default it
>times out after sixty seconds.  To maintain the current behavior, you'd
>have to pass in a parameter of 'timeout=0'.
>
>The background is that we've been (okay, foolishly) trying to use urllib
>in a production environment.  We've also been using httplib directly
>when urllib's behavior is inappropriate.  In both cases we've been
>having hangs in our programs; we fixed the latter problem by
>manipulating HTTP.socket directly.  That's not an option for urllib, and
>we'd rather not dump urllib because we've already put in a fair amount
>of time subclassing urllib to fix its behavior.  Jeremy's urllib2 isn't
>the answer, either, because it doesn't address the timeout problem.
>
>I don't think subclassing HTTP would help.  ;-)
>
>I've got a patch more-or-less ready to go to Guido; I'll probably send
>it next week after we've tested it a bit more thoroughly.


It seems to me that this is a subset of the more general problem of
socket timeouts.  There is a timeout_socket class and a method of
injecting it into existing Python modules at
    http://www.vex.net/parnassus/apyllo.py?i=97250001
that -might- work for you.
--
Phil Mayes    pmayes AT olivebr DOT com







More information about the Python-list mailing list