aboutsummaryrefslogtreecommitdiffstats
path: root/multiple-auth-headers.patch
diff options
context:
space:
mode:
Diffstat (limited to 'multiple-auth-headers.patch')
-rw-r--r--multiple-auth-headers.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/multiple-auth-headers.patch b/multiple-auth-headers.patch
new file mode 100644
index 0000000..bb597e2
--- /dev/null
+++ b/multiple-auth-headers.patch
@@ -0,0 +1,38 @@
+# HG changeset patch
+# User Wagner Bruna <wbruna@softwareexpress.com.br>
+# Date 1338402998 10800
+# Node ID 5e53d94fdf9cb73304790a38ba24b19415de73ea
+# Parent 08f4f4f83058d9896a0debc2ff3899a9a358f942
+deal with multiple WWW-Authenticate headers
+
+A server supporting both Negotiate and Basic authentication methods
+could send both headers at once, but the get() method returns only
+the last one.
+
+--- a/urllib2_kerberos.py
++++ b/urllib2_kerberos.py
+@@ -41,15 +41,17 @@ class AbstractKerberosAuthHandler:
+ def negotiate_value(self, headers):
+ """checks for "Negotiate" in proper auth header
+ """
+- authreq = headers.get(self.auth_header, None)
++ authreqs = headers.getheaders(self.auth_header)
++
++ if authreqs:
+
+- if authreq:
+ rx = re.compile('(?:.*,)*\s*Negotiate\s*([^,]*),?', re.I)
+- mo = rx.search(authreq)
+- if mo:
+- return mo.group(1)
+- else:
+- log.debug("regex failed on: %s" % authreq)
++ for authreq in authreqs:
++ mo = rx.search(authreq)
++ if mo:
++ return mo.group(1)
++ else:
++ log.debug("regex failed on: %s" % authreq)
+
+ else:
+ log.debug("%s header not found" % self.auth_header)