Patch: httplib.py default timeout

Phil Mayes nospam at bitbucket.com
Tue Dec 28 01:31:36 EST 1999


Aahz Maruch wrote in message <840anc$9j8$1 at nntp8.atl.mindspring.net>...
>
>Here's the top part of httplib.py; the end hasn't changed at all.  I'm
>going to clean it up a bit more before submitting it to Guido.  The one
>question I have left is whether the timeout should be specified in its
>raw form (milliseconds) or in a more user-friendly form (seconds); I'm
>currently leaving it as milliseconds:
>
>"""HTTP client class
> [big snip]
>        if timeout is None:
>            self.sock.setsockopt ( socket.SOL_SOCKET, socket.SO_RCVTIMEO,
defaultTimeout )
>        elif timeout > 0:
>            self.sock.setsockopt ( socket.SOL_SOCKET, socket.SO_RCVTIMEO,
timeout )


Winsock v1.1 doesn't support SO_RCVTIMEO:
  BSD options not supported for setsockopt() are:
  Value            Type    Meaning
  SO_ACCEPTCONN    BOOL    Socket is listening
  SO_ERROR         int     Get error status and clear
  SO_RCVLOWAT      int     Receive low water mark
  SO_RCVTIMEO      int     Receive timeout
  SO_SNDLOWAT      int     Send low water mark
  SO_SNDTIMEO      int     Send timeout
  SO_TYPE          int     Type of the socket
  IP_OPTIONS               Set options field in IP header.

Winsock v2 does:
  Socket Option for NT 4.0 and Win95
  [This is preliminary documentation and subject to change.]
  Details on SO_SNDTIMEO and SO_RCVTIMEO

Quotes are from the MSDN CD-ROM.  Not being an expert on cross-platform
socket implementations, I don't know how much of a problem this is, if any.
--
Phil Mayes    pmayes AT olivebr DOT com







More information about the Python-list mailing list