mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-09-03 20:52:56 -05:00
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
This commit is contained in:
+9
-2
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user