• Michael Hanselmann's avatar
    RAPI client: Add support for Python 2.6 · beba56ae
    Michael Hanselmann authored
    The httplib module used by urllib2 requires its sockets to have a
    makefile() method to provide a file-like interface (or rather
    file-in-Python-like) to the socket. PyOpenSSL doesn't implement
    makefile() as the semantics require files to call dup(2) on the
    underlying file descriptors, something not easily done on SSL sockets.
    Python up to and including 2.5 have a class to simulate makefile(),
    httplib.FakeSocket. With the addition of SSL support in Python 2.6, this
    class was deprecated and no longer functions.
    This patch adds a new, simpler wrapper class which is used in Python 2.6
    and above only. It's good enough for this use.
    There are general problems in these generic wrapper classes--none of
    them handles SSL I/O properly. They break, for example, when the server
    requests a renegotiation. This will need more work.
    Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
    Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
client.py 34.9 KB