All pastes #973593 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-04-06 06:02 UTC
rendered paste body


# This file exists as a workaround for bug 508157 in python, which
# was causing us to get VERY slow download rates.

from httplib import HTTPConnection as HTTPConnectionOld
from httplib import HTTPSConnection as HTTPSConnectionOld
from httplib import HTTPResponse as HTTPResponseOld


class HTTPResponse(HTTPResponseOld):
    def __init__(self, sock, debuglevel=0, strict=0, method=None):
        HTTPResponseOld.__init__(self, sock, debuglevel, strict, method)
        del self.fp # is there a better way to do this?
        self.fp = sock.makefile('rb', 4096)

class HTTPConnection(HTTPConnectionOld):
    response_class = HTTPResponse

class HTTPSConnection(HTTPSConnectionOld):
    response_class = HTTPResponse