[python26-m2crypto/el5/master: 53/78] - Close the connection when an m2urllib2 response is closed Resolves: #460692 - Work around conf

gholms gholms at fedoraproject.org
Wed Feb 23 00:29:43 UTC 2011


commit fd29467e8d1e6fc5825416ff926d709ed769da6a
Author: Miloslav Trmac <mitr at fedoraproject.org>
Date:   Wed Feb 4 19:05:33 2009 +0000

    - Close the connection when an m2urllib2 response is closed Resolves:
        #460692
    - Work around conflicts between macros defined by gcc and swig

 m2crypto-0.19.1-close-HTTPResponse.patch |   42 ++++++++++++++++++++++++++++++
 m2crypto.spec                            |   13 ++++++++-
 2 files changed, 53 insertions(+), 2 deletions(-)
---
diff --git a/m2crypto-0.19.1-close-HTTPResponse.patch b/m2crypto-0.19.1-close-HTTPResponse.patch
new file mode 100644
index 0000000..791711a
--- /dev/null
+++ b/m2crypto-0.19.1-close-HTTPResponse.patch
@@ -0,0 +1,42 @@
+Index: x/M2Crypto/m2urllib2.py
+===================================================================
+--- a/M2Crypto/m2urllib2.py	(revision 662)
++++ b/M2Crypto/m2urllib2.py	(working copy)
+@@ -11,12 +11,28 @@
+  - Add the M2Crypto HTTPSHandler when building a default opener.
+ """
+ 
++import socket
+ from urllib2 import *
+ import urlparse
+ 
+ import SSL
+ import httpslib
+ 
++
++class _closing_fileobject(socket._fileobject):
++    '''socket._fileobject that propagates self.close() to the socket.
++
++    Python 2.5 provides this as socket._fileobject(sock, close=True).
++    '''
++
++    def __init__(self, sock):
++        socket._fileobject.__init__(self, sock)
++
++    def close(self):
++        sock = self._sock
++        socket._fileobject.close(self)
++        sock.close()
++
+ class HTTPSHandler(AbstractHTTPHandler):
+     def __init__(self, ssl_context = None):
+         AbstractHTTPHandler.__init__(self)
+@@ -81,7 +97,7 @@
+         # out of socket._fileobject() and into a base class.
+ 
+         r.recv = r.read
+-        fp = socket._fileobject(r)
++        fp = _closing_fileobject(r)
+ 
+         resp = addinfourl(fp, r.msg, req.get_full_url())
+         resp.code = r.status
diff --git a/m2crypto.spec b/m2crypto.spec
index 8e23e61..72eecd5 100644
--- a/m2crypto.spec
+++ b/m2crypto.spec
@@ -6,12 +6,14 @@
 Summary: Support for using OpenSSL in python scripts
 Name: m2crypto
 Version: 0.19.1
-Release: 4
+Release: 5
 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.18-timeouts.patch
 # This is only precautionary, it does fix anything - not sent upstream
 Patch1: m2crypto-0.18-gcc_macros.patch
+# https://bugzilla.osafoundation.org/show_bug.cgi?id=12718
+Patch2: m2crypto-0.19.1-close-HTTPResponse.patch
 License: MIT
 Group: System Environment/Libraries
 URL: http://wiki.osafoundation.org/bin/view/Projects/MeTooCrypto
@@ -27,6 +29,7 @@ This package allows you to call OpenSSL functions from python scripts.
 %setup -q -n M2Crypto-%{version}
 %patch0 -p1
 %patch1 -p1 -b .gcc_macros
+%patch2 -p1
 
 # Red Hat opensslconf.h #includes an architecture-specific file, but SWIG
 # doesn't follow the #include.
@@ -45,7 +48,8 @@ for i in SWIG/_ec.i SWIG/_evp.i; do
 done
 %endif
 
-gcc -E -dM - < /dev/null | grep -v __STDC__ > SWIG/gcc_macros.h
+gcc -E -dM - < /dev/null | grep -v __STDC__ \
+	| sed 's/^\(#define \([^ ]*\) .*\)$/#undef \2\n\1/' > SWIG/gcc_macros.h
 
 %build
 CFLAGS="$RPM_OPT_FLAGS" ; export CFLAGS
@@ -88,6 +92,11 @@ rm -rf $RPM_BUILD_ROOT
 %{python_sitearch}/M2Crypto-*.egg-info
 
 %changelog
+* Wed Feb  4 2009 Miloslav Trmač <mitr at redhat.com> - 0.19.1-5
+- Close the connection when an m2urllib2 response is closed
+  Resolves: #460692
+- Work around conflicts between macros defined by gcc and swig
+
 * Sat Jan 17 2009 Tomas Mraz <tmraz at redhat.com> - 0.19.1-4
 - rebuild with new openssl
 


More information about the scm-commits mailing list