mirror of
https://github.com/openSUSE/osc.git
synced 2025-09-07 13:48:43 +02:00
- fix for python2.7/m2crypto: M2Crypto.httpslib.ProxyHTTPSConnection defines "endheaders" without parameters
Now "myProxyHTTPSConnection" inherits from "M2Crypto.httpslib.ProxyHTTPSConnection" _and_ "httplib.HTTPSConnection". The latter class is only used to call "httplib.HTTPSConnection.endheaders". This multiple inheritance shouldn't have any side-effects because "M2Crypto.httpslib.ProxyHTTPSConnection" already inherits from "httplib.HTTPSConnection" (and mro will pick the methods from "M2Crypto.httpslib.ProxyHTTPSConnection" first).
This commit is contained in:
@@ -10,6 +10,7 @@ import M2Crypto.m2urllib2
|
||||
import urlparse
|
||||
import socket
|
||||
import urllib
|
||||
import httplib
|
||||
|
||||
class TrustedCertStore:
|
||||
_tmptrusted = {}
|
||||
@@ -236,7 +237,7 @@ class myHTTPSConnection(M2Crypto.httpslib.HTTPSConnection):
|
||||
def getPort(self):
|
||||
return self.port
|
||||
|
||||
class myProxyHTTPSConnection(M2Crypto.httpslib.ProxyHTTPSConnection):
|
||||
class myProxyHTTPSConnection(M2Crypto.httpslib.ProxyHTTPSConnection, httplib.HTTPSConnection):
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.appname = kwargs.pop('appname', 'generic')
|
||||
M2Crypto.httpslib.ProxyHTTPSConnection.__init__(self, *args, **kwargs)
|
||||
@@ -245,6 +246,11 @@ class myProxyHTTPSConnection(M2Crypto.httpslib.ProxyHTTPSConnection):
|
||||
M2Crypto.httpslib.ProxyHTTPSConnection._start_ssl(self)
|
||||
verify_certificate(self)
|
||||
|
||||
def endheaders(self, *args, **kwargs):
|
||||
if not self._proxy_auth is None:
|
||||
self._proxy_auth = self._encode_auth()
|
||||
httplib.HTTPSConnection.endheaders(self, *args, **kwargs)
|
||||
|
||||
# broken in m2crypto: port needs to be an int
|
||||
def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0):
|
||||
#putrequest is called before connect, so can interpret url and get
|
||||
|
Reference in New Issue
Block a user