[python26-m2crypto/el5/master: 45/78] - Don't remove the User-Agent header from proxied requests Related: #448858 - Update m2urllib2.py to

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


commit 5c5ec444ad7a746ffa0049adc2717cf545a4658f
Author: Miloslav Trmac <mitr at fedoraproject.org>
Date:   Sat Jun 7 23:29:08 2008 +0000

    - Don't remove the User-Agent header from proxied requests Related: #448858
    - Update m2urllib2.py to work with Python 2.5

 m2crypto-0.18.2-inspect.patch  |   11 +++++++++++
 m2crypto-0.18.2-proxy-ua.patch |   22 +++++++++++-----------
 m2crypto.spec                  |    9 ++++++++-
 3 files changed, 30 insertions(+), 12 deletions(-)
---
diff --git a/m2crypto-0.18.2-inspect.patch b/m2crypto-0.18.2-inspect.patch
new file mode 100644
index 0000000..3dacd9e
--- /dev/null
+++ b/m2crypto-0.18.2-inspect.patch
@@ -0,0 +1,11 @@
+diff -urN m2crypto/M2Crypto/m2urllib2.py m2crypto-0.18.2/M2Crypto/m2urllib2.py
+--- m2crypto/M2Crypto/m2urllib2.py	2007-06-08 20:56:57.000000000 +0200
++++ m2crypto-0.18.2/M2Crypto/m2urllib2.py	2008-06-07 22:18:26.000000000 +0200
+@@ -11,6 +11,7 @@
+  - Add the M2Crypto HTTPSHandler when building a default opener.
+ """
+ 
++import inspect
+ from urllib2 import *
+ import urlparse
+ 
diff --git a/m2crypto-0.18.2-proxy-ua.patch b/m2crypto-0.18.2-proxy-ua.patch
index 3c2f93b..49ac2c4 100644
--- a/m2crypto-0.18.2-proxy-ua.patch
+++ b/m2crypto-0.18.2-proxy-ua.patch
@@ -1,14 +1,14 @@
-Allow setting User-agent on HTTPS proxy connections.  Patch by
+Allow setting User-agent on HTTPS proxy connections.  Based on a patch by
 James Antill <james.antill at redhat.com>.
 
 diff -urN m2crypto/M2Crypto/httpslib.py m2crypto-0.18.2/M2Crypto/httpslib.py
---- m2crypto/M2Crypto/httpslib.py	2008-06-07 00:46:44.000000000 +0200
-+++ m2crypto-0.18.2/M2Crypto/httpslib.py	2008-06-07 00:50:05.000000000 +0200
+--- m2crypto/M2Crypto/httpslib.py	2008-06-07 22:26:35.000000000 +0200
++++ m2crypto-0.18.2/M2Crypto/httpslib.py	2008-06-07 22:33:55.000000000 +0200
 @@ -103,6 +103,7 @@
  
      _ports = {'http' : 80, 'https' : 443}
      _AUTH_HEADER = "Proxy-Authorization"
-+    _UA_HEADER   = "User-Agent"
++    _UA_HEADER = "User-Agent"
  
      def __init__(self, host, port=None, strict=None, username=None,
          password=None, **ssl):
@@ -16,25 +16,25 @@ diff -urN m2crypto/M2Crypto/httpslib.py m2crypto-0.18.2/M2Crypto/httpslib.py
          self._username = username
          self._password = password
          self._proxy_auth = None
-+        self._proxy_UA   = None
++        self._proxy_UA = None
  
      def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0):
          #putrequest is called before connect, so can interpret url and get
-@@ -141,6 +143,8 @@
+@@ -139,6 +141,8 @@
+ 
+     def putheader(self, header, value):
          # Store the auth header if passed in.
++        if header.lower() == self._UA_HEADER.lower():
++            self._proxy_UA = value
          if header.lower() == self._AUTH_HEADER.lower():
              self._proxy_auth = value
-+        elif header.lower() == self._UA_HEADER.lower():
-+            self._proxy_UA   = value
          else:
-             HTTPSConnection.putheader(self, header, value)
- 
 @@ -173,6 +177,8 @@
          """ Return an HTTP CONNECT request to send to the proxy. """
          msg = "CONNECT %s:%d HTTP/1.1\r\n" % (self._real_host, self._real_port)
          msg = msg + "Host: %s:%d\r\n" % (self._real_host, self._real_port)
 +        if self._proxy_UA:
-+            msg = msg + "%s: %s\r\n" % (self._UA_HEADER,   self._proxy_UA) 
++            msg = msg + "%s: %s\r\n" % (self._UA_HEADER, self._proxy_UA)
          if self._proxy_auth:
              msg = msg + "%s: %s\r\n" % (self._AUTH_HEADER, self._proxy_auth) 
          msg = msg + "\r\n"
diff --git a/m2crypto.spec b/m2crypto.spec
index 769199a..1c96db0 100644
--- a/m2crypto.spec
+++ b/m2crypto.spec
@@ -6,11 +6,12 @@
 Summary: Support for using OpenSSL in python scripts
 Name: m2crypto
 Version: 0.18.2
-Release: 5
+Release: 6
 Source0: http://wiki.osafoundation.org/pub/Projects/MeTooCrypto/m2crypto-%{version}.tar.gz
 Patch0: m2crypto-0.18-timeouts.patch
 Patch1: m2crypto-0.18-proxy.patch
 Patch2: m2crypto-0.18.2-proxy-ua.patch
+Patch3: m2crypto-0.18.2-inspect.patch
 License: MIT
 Group: System Environment/Libraries
 URL: http://wiki.osafoundation.org/bin/view/Projects/MeTooCrypto
@@ -27,6 +28,7 @@ This package allows you to call OpenSSL functions from python scripts.
 %patch0 -p1
 %patch1 -p0
 %patch2 -p1
+%patch3 -p1
 
 # Red Hat opensslconf.h #includes an architecture-specific file, but SWIG
 # doesn't follow the #include.
@@ -79,6 +81,11 @@ rm -rf $RPM_BUILD_ROOT
 %{python_sitearch}/M2Crypto-*.egg-info
 
 %changelog
+* Sun Jun  8 2008 Miloslav Trmač <mitr at redhat.com> - 0.18.2-6
+- Don't remove the User-Agent header from proxied requests
+  Related: #448858
+- Update m2urllib2.py to work with Python 2.5
+
 * Sat Jun  7 2008 Miloslav Trmač <mitr at redhat.com> - 0.18.2-5
 - Use User-Agent in HTTP proxy CONNECT requests
   Related: #448858


More information about the scm-commits mailing list