[Web-SIG] httplib.HTTPConnection and Broken Pipe

Robert Brewer fumanchu at amor.org
Thu Apr 26 22:53:41 CEST 2007

Bart Whiteley wrote:
> On Wed, 2007-04-25 at 23:30 -0300, Sidnei da Silva wrote:
> > Subclass HTTPConnection and implement your own send()?
> Yes.  That seemed to be the best (or only) solution.  I believe anyone
> using HTTPConnection for a POST where authentication may be required
> will have to do the same thing. 

Sounds like an excellent candidate for a ticket and patch to Python.

Since socket error numbers are platform-specific, CherryPy's HTTP server
does this:

    import errno
    socket_errors_to_ignore = []
    # Not all of these names will be defined for every platform.
              "EHOSTDOWN", "EHOSTUNREACH",
        if _ in dir(errno):
            socket_errors_to_ignore.append(getattr(errno, _))
    # de-dupe the list
    socket_errors_to_ignore =
    socket_errors_to_ignore.append("timed out")

...the stdlib might benefit from a similar (overridable) list.

Robert Brewer
System Architect
Amor Ministries
fumanchu at amor.org

More information about the Web-SIG mailing list