• Jeremy Hylton's avatar
    Fixes for two separate HTTP/1.1 bugs: 100 responses and HTTPS connections. · be4fcf18
    Jeremy Hylton yazdı
    The HTTPResponse class now handles 100 continue responses, instead of
    choking on them.  It detects them internally in the _begin() method
    and ignores them.  Based on a patch by Bob Kline.
    
    This closes SF bugs 498149 and 551273.
    
    The FakeSocket class (for SSL) is now usable with HTTP/1.1
    connections.  The old version of the code could not work with
    persistent connections, because the makefile() implementation read
    until EOF before returning.  If the connection is persistent, the
    server sends a response and leaves the connection open.  A client that
    reads until EOF will block until the server gives up on the connection
    -- more than a minute in my test case.
    
    The problem was fixed by implementing a reasonable makefile().  It
    reads data only when it is needed by the layers above it.  It's
    implementation uses an internal buffer with a default size of 8192.
    
    Also, rename begin() method of HTTPResponse to _begin() because it
    should only be called by the HTTPConnection.
    be4fcf18
httplib.py 32.2 KB