[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/authentication/httpplugins.py Merge revision 41542 from 3.2 branch.

Gary Poster gary at zope.com
Thu Feb 2 11:28:46 EST 2006


Log message for revision 41543:
  Merge revision 41542 from 3.2 branch.
  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/trunk/src/zope/app/authentication/httpplugins.py

-=-
Modified: Zope3/trunk/src/zope/app/authentication/httpplugins.py
===================================================================
--- Zope3/trunk/src/zope/app/authentication/httpplugins.py	2006-02-02 16:09:54 UTC (rev 41542)
+++ Zope3/trunk/src/zope/app/authentication/httpplugins.py	2006-02-02 16:28:36 UTC (rev 41543)
@@ -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