[m2crypto] Fix HTTPS proxy support

Miloslav Trmac mitr at fedoraproject.org
Thu Mar 15 02:38:42 UTC 2012


commit a3bcfc5cf4131c7a1a3f012d992615e67a240a1e
Author: Miloslav Trmač <mitr at redhat.com>
Date:   Thu Mar 15 03:37:56 2012 +0100

    Fix HTTPS proxy support

 m2crypto-0.21.1-https-proxy.patch |   43 +++++++++++++++++++++++++++++++++++++
 m2crypto.spec                     |    9 +++++++-
 2 files changed, 51 insertions(+), 1 deletions(-)
---
diff --git a/m2crypto-0.21.1-https-proxy.patch b/m2crypto-0.21.1-https-proxy.patch
new file mode 100644
index 0000000..21b7b94
--- /dev/null
+++ b/m2crypto-0.21.1-https-proxy.patch
@@ -0,0 +1,43 @@
+diff -urN M2Crypto/M2Crypto/httpslib.py M2Crypto-0.21.1/M2Crypto/httpslib.py
+--- M2Crypto/M2Crypto/httpslib.py	2012-03-15 03:27:22.181524406 +0100
++++ M2Crypto-0.21.1/M2Crypto/httpslib.py	2012-03-15 03:27:40.467485033 +0100
+@@ -182,14 +182,14 @@
+         else:
+             HTTPSConnection.putheader(self, header, value)
+ 
+-    def endheaders(self):
++    def endheaders(self, *args, **kwargs):
+         # We've recieved all of hte headers. Use the supplied username
+         # and password for authorization, possibly overriding the authstring
+         # supplied in the headers.
+         if not self._proxy_auth:
+             self._proxy_auth = self._encode_auth()
+ 
+-        HTTPSConnection.endheaders(self)
++        HTTPSConnection.endheaders(self, *args, **kwargs)
+ 
+     def connect(self):
+         HTTPConnection.connect(self)
+diff -urN M2Crypto/M2Crypto/m2urllib2.py M2Crypto-0.21.1/M2Crypto/m2urllib2.py
+--- M2Crypto/M2Crypto/m2urllib2.py	2011-01-15 20:10:05.000000000 +0100
++++ M2Crypto-0.21.1/M2Crypto/m2urllib2.py	2012-03-15 03:27:40.467485033 +0100
+@@ -64,8 +64,10 @@
+         target_host = urlparse.urlparse(full_url)[1]
+ 
+         if (target_host != host):
++            request_uri = urlparse.urldefrag(full_url)[0]
+             h = httpslib.ProxyHTTPSConnection(host = host, ssl_context = self.ctx)
+         else:
++            request_uri = req.get_selector()
+             h = httpslib.HTTPSConnection(host = host, ssl_context = self.ctx)
+         # End our change
+         h.set_debuglevel(self._debuglevel)
+@@ -80,7 +82,7 @@
+         # request.
+         headers["Connection"] = "close"
+         try:
+-            h.request(req.get_method(), req.get_selector(), req.data, headers)
++            h.request(req.get_method(), request_uri, req.data, headers)
+             r = h.getresponse()
+         except socket.error, err: # XXX what error?
+             raise URLError(err)
diff --git a/m2crypto.spec b/m2crypto.spec
index a383ed0..29b787a 100644
--- a/m2crypto.spec
+++ b/m2crypto.spec
@@ -6,7 +6,7 @@
 Summary: Support for using OpenSSL in python scripts
 Name: m2crypto
 Version: 0.21.1
-Release: 7%{?dist}
+Release: 8%{?dist}
 Source0: http://pypi.python.org/packages/source/M/M2Crypto/M2Crypto-%{version}.tar.gz
 # https://bugzilla.osafoundation.org/show_bug.cgi?id=2341
 Patch0: m2crypto-0.21.1-timeouts.patch
@@ -24,6 +24,8 @@ Patch5: m2crypto-0.21.1-smime-doc.patch
 Patch6: m2crypto-0.21.1-AES_crypt.patch
 # https://bugzilla.osafoundation.org/show_bug.cgi?id=13044
 Patch7: m2crypto-0.21.1-IPv6.patch
+# https://bugzilla.osafoundation.org/show_bug.cgi?id=13049
+Patch8: m2crypto-0.21.1-https-proxy.patch
 License: MIT
 Group: System Environment/Libraries
 URL: http://wiki.osafoundation.org/bin/view/Projects/MeTooCrypto
@@ -46,6 +48,7 @@ This package allows you to call OpenSSL functions from python scripts.
 %patch5 -p0
 %patch6 -p0 -b .AES_crypt
 %patch7 -p1 -b .IPv6
+%patch8 -p1 -b .https-proxy
 
 # Red Hat opensslconf.h #includes an architecture-specific file, but SWIG
 # doesn't follow the #include.
@@ -111,6 +114,10 @@ rm -rf $RPM_BUILD_ROOT
 %{python_sitearch}/M2Crypto-*.egg-info
 
 %changelog
+* Thu Mar 15 2012 Miloslav Trmač <mitr at redhat.com> - 0.21.1-8
+- Fix HTTPS proxy support
+  Resolves: #803554
+
 * Tue Mar 13 2012 Miloslav Trmač <mitr at redhat.com> - 0.21.1-7
 - Support IPv6 in M2Crypto.httpslib
   Resolves: #742914


More information about the scm-commits mailing list