diff options
author | rcrit <rcrit@moon.greyoak.com> | 2009-06-30 16:34:40 -0400 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2009-07-01 08:51:23 -0400 |
commit | 9352d2fc10dde6ed8cc57f2acee3e27ed7e340c2 (patch) | |
tree | 27215373f629572ee8b6ca15a001eabc3aeabc98 /ipapython/nsslib.py | |
parent | 79029e8179e4f49aa54e25363db08ba0ebf7b73d (diff) | |
download | freeipa-9352d2fc10dde6ed8cc57f2acee3e27ed7e340c2.tar.gz freeipa-9352d2fc10dde6ed8cc57f2acee3e27ed7e340c2.tar.xz freeipa-9352d2fc10dde6ed8cc57f2acee3e27ed7e340c2.zip |
Add a local implementation of httplib.SSLFile and httplib.FakeSocket
Python 2.6 changed its internal implementation which makes it difficult
to override in a way that is backwards compatible.
508953
Diffstat (limited to 'ipapython/nsslib.py')
-rw-r--r-- | ipapython/nsslib.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ipapython/nsslib.py b/ipapython/nsslib.py index fd27028e7..1b678305b 100644 --- a/ipapython/nsslib.py +++ b/ipapython/nsslib.py @@ -27,6 +27,13 @@ import nss.io as io import nss.nss as nss import nss.ssl as ssl +try: + from httplib import SSLFile + from httplib import FakeSocket +except ImportError: + from ipapython.ipasslfile import SSLFile + from ipapython.ipasslfile import FakeSocket + def client_auth_data_callback(ca_names, chosen_nickname, password, certdb): cert = None if chosen_nickname: @@ -49,7 +56,7 @@ def client_auth_data_callback(ca_names, chosen_nickname, password, certdb): return False return False -class SSLFile(httplib.SSLFile): +class SSLFile(SSLFile): """ Override the _read method so we can use the NSS recv method. """ @@ -64,7 +71,7 @@ class SSLFile(httplib.SSLFile): break return buf -class NSSFakeSocket(httplib.FakeSocket): +class NSSFakeSocket(FakeSocket): def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise httplib.UnimplementedFileMode() |