You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-commits@quetz.apache.org by nl...@apache.org on 2005/01/18 10:49:05 UTC

svn commit: r125475 - /httpd/mod_python/trunk/Doc/modpython4.tex /httpd/mod_python/trunk/lib/python/mod_python/Cookie.py

Author: nlehuen
Date: Tue Jan 18 01:49:01 2005
New Revision: 125475

URL: http://svn.apache.org/viewcvs?view=rev&rev=125475
Log:
Fix for bug [#MODPYTHON-3] : RFC-style cookie attributes are now ignored.
Modified:
   httpd/mod_python/trunk/Doc/modpython4.tex
   httpd/mod_python/trunk/lib/python/mod_python/Cookie.py

Modified: httpd/mod_python/trunk/Doc/modpython4.tex
Url: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/Doc/modpython4.tex?view=diff&rev=125475&p1=httpd/mod_python/trunk/Doc/modpython4.tex&r1=125474&p2=httpd/mod_python/trunk/Doc/modpython4.tex&r2=125475
==============================================================================
--- httpd/mod_python/trunk/Doc/modpython4.tex	(original)
+++ httpd/mod_python/trunk/Doc/modpython4.tex	Tue Jan 18 01:49:01 2005
@@ -1614,8 +1614,14 @@
   by most browsers is the original Netscape specification.
   Furthermore, true compliance with IETF standards is actually
   incompatible with many popular browsers, even those that claim to be
-  RFC-compliant.  Therefore, this module supports the current common
+  RFC-compliant. Therefore, this module supports the current common
   practice, and is not fully RFC compliant.
+  
+  More specifically, the biggest difference between Netscape and RFC cookies is 
+  that RFC cookies are sent from the browser to the server along with their 
+  attributes (like Path or Domain). The \module{Cookie} module ignore those 
+  incoming attributes, so all incoming cookies end up as Netscape-style cookies, 
+  without any of their attributes defined.
 \end{notice}
 
 \begin{seealso}

Modified: httpd/mod_python/trunk/lib/python/mod_python/Cookie.py
Url: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/lib/python/mod_python/Cookie.py?view=diff&rev=125475&p1=httpd/mod_python/trunk/lib/python/mod_python/Cookie.py&r1=125474&p2=httpd/mod_python/trunk/lib/python/mod_python/Cookie.py&r2=125475
==============================================================================
--- httpd/mod_python/trunk/lib/python/mod_python/Cookie.py	(original)
+++ httpd/mod_python/trunk/lib/python/mod_python/Cookie.py	Tue Jan 18 01:49:01 2005
@@ -297,41 +297,19 @@
     )
 
 def _parse_cookie(str, Class):
-
     # XXX problem is we should allow duplicate
     # strings
     result = {}
 
-    # max-age is a problem because of the '-'
-    # XXX there should be a more elegant way
-    valid = Cookie._valid_attr + ("max-age",)
-
-    c = None
     matchIter = _cookiePattern.finditer(str)
 
     for match in matchIter:
-
         key, val = match.group("key"), match.group("val")
 
-        if not c:
-            # new cookie
-            c = Class(key, val)
-            result[key] = c
-
-        l_key = key.lower()
-        
-        if (l_key in valid or key[0] == '$'):
-            
-            # "internal" attribute, add to cookie
-
-            if l_key == "max-age":
-                l_key = "max_age"
-            setattr(c, l_key, val)
-
-        else:
-            # start a new cookie
-            c = Class(l_key, val)
-            result[l_key] = c
+        # We just ditch the cookies names which start with a dollar sign since
+        # those are in fact RFC2965 cookies attributes. See bug [#MODPYTHON-3].
+        if key[0]!='$':
+            result[key] = Class(key, val)
 
     return result