[Zope3-checkins] SVN: Zope3/branches/3.2/src/zope/app/authentication/httpplugins.py Make basic auth quote the realm, per the basic auth spec.

Gary Poster gary at zope.com
Thu Feb 2 11:09:54 EST 2006


Log message for revision 41542:
  Make basic auth quote the realm, per the basic auth spec.
  Without this, urllib2 cannot log in to Zope.
  
  

Changed:
  U   Zope3/branches/3.2/src/zope/app/authentication/httpplugins.py

-=-
Modified: Zope3/branches/3.2/src/zope/app/authentication/httpplugins.py
===================================================================
--- Zope3/branches/3.2/src/zope/app/authentication/httpplugins.py	2006-02-02 13:29:23 UTC (rev 41541)
+++ Zope3/branches/3.2/src/zope/app/authentication/httpplugins.py	2006-02-02 16:09:54 UTC (rev 41542)
@@ -109,8 +109,10 @@
           >>> response._status
           401
           >>> response.getHeader('WWW-Authenticate', literal=True)
-          'basic realm=Zope'
+          'basic realm="Zope"'
 
+        Notice that the realm is quoted, as per RFC 2617.
+
         The plugin only works with HTTP requests.
 
           >>> from zope.publisher.base import TestRequest
@@ -123,7 +125,8 @@
         if not IHTTPRequest.providedBy(request):
             return False
         request.response.setHeader("WWW-Authenticate",
-                                   "basic realm=%s" % self.realm, literal=True)
+                                   'basic realm="%s"' % self.realm,
+                                   literal=True)
         request.response.setStatus(401)
         return True
 



More information about the Zope3-Checkins mailing list