summaryrefslogtreecommitdiffstats
path: root/ipapython/nsslib.py
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2015-10-20 18:50:13 +0200
committerTomas Babej <tbabej@redhat.com>2015-10-27 17:23:25 +0100
commit6811b4be6ae462526a1c6bec222e939045879ba1 (patch)
tree502b3089743e8a14a9424daf775cf839b7feffff /ipapython/nsslib.py
parent4ddd1821b6c8556c79c202d8a9df19c576202ec1 (diff)
downloadfreeipa-6811b4be6ae462526a1c6bec222e939045879ba1.tar.gz
freeipa-6811b4be6ae462526a1c6bec222e939045879ba1.tar.xz
freeipa-6811b4be6ae462526a1c6bec222e939045879ba1.zip
ipapython.nsslib: Remove NSSHTTPS
This workaround is unused in Python 2.7+. Reviewed-By: Tomas Babej <tbabej@redhat.com>
Diffstat (limited to 'ipapython/nsslib.py')
-rw-r--r--ipapython/nsslib.py68
1 files changed, 0 insertions, 68 deletions
diff --git a/ipapython/nsslib.py b/ipapython/nsslib.py
index 52cf63f03..5ae79b65c 100644
--- a/ipapython/nsslib.py
+++ b/ipapython/nsslib.py
@@ -295,71 +295,3 @@ class NSSConnection(httplib.HTTPConnection, NSSAddressFamilyFallback):
except NSPRError as e:
self.close()
raise e
-
-
-class NSSHTTPS(httplib.HTTP):
- # We would like to use HTTP 1.1 not the older HTTP 1.0 but xmlrpc.client
- # and httplib do not play well together. httplib when the protocol
- # is 1.1 will add a host header in the request. But xmlrpc.client
- # always adds a host header irregardless of the HTTP protocol
- # version. That means the request ends up with 2 host headers,
- # but Apache freaks out if it sees 2 host headers, a known Apache
- # issue. httplib has a mechanism to skip adding the host header
- # (i.e. skip_host in HTTPConnection.putrequest()) but xmlrpc.client
- # doesn't use it. Oh well, back to 1.0 :-(
- #
- #_http_vsn = 11
- #_http_vsn_str = 'HTTP/1.1'
-
- _connection_class = NSSConnection
-
- def __init__(self, host='', port=None, strict=None, dbdir=None, no_init=False):
- # provide a default host, pass the X509 cert info
-
- # urf. compensate for bad input.
- if port == 0:
- port = None
- self._setup(self._connection_class(host, port, strict, dbdir=dbdir, no_init=no_init))
-
- def getreply(self):
- """
- Override so we can close duplicated file connection on non-200
- responses. This was causing nss_shutdown() to fail with a busy
- error.
- """
- (status, reason, msg) = httplib.HTTP.getreply(self)
- if status != 200:
- self.file.close()
- return (status, reason, msg)
-
-#------------------------------------------------------------------------------
-
-if __name__ == "__main__":
- standard_logging_setup('nsslib.log', debug=True, filemode='a')
- root_logger.info("Start")
-
- if False:
- conn = NSSConnection("www.verisign.com", 443, dbdir=paths.NSS_DB_DIR)
- conn.set_debuglevel(1)
- conn.connect()
- conn.request("GET", "/")
- response = conn.getresponse()
- print(response.status)
- #print response.msg
- print(response.getheaders())
- data = response.read()
- #print data
- conn.close()
-
- if True:
- h = NSSHTTPS("www.verisign.com", 443, dbdir=paths.NSS_DB_DIR)
- h.connect()
- h.putrequest('GET', '/')
- h.endheaders()
- http_status, http_reason, headers = h.getreply()
- print("status = %s %s" % (http_status, http_reason))
- print("headers:\n%s" % headers)
- f = h.getfile()
- data = f.read() # Get the raw HTML
- f.close()
- #print data