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 gr...@apache.org on 2006/10/02 05:08:17 UTC

svn commit: r451861 - in /httpd/mod_python/trunk: Doc/appendixc.tex lib/python/mod_python/util.py test/test.py

Author: grahamd
Date: Sun Oct  1 20:08:17 2006
New Revision: 451861

URL: http://svn.apache.org/viewvc?view=rev&rev=451861
Log:
(MODPYTHON-159) Fix FieldStorage class so that it can handle multiline
headers.


Modified:
    httpd/mod_python/trunk/Doc/appendixc.tex
    httpd/mod_python/trunk/lib/python/mod_python/util.py
    httpd/mod_python/trunk/test/test.py

Modified: httpd/mod_python/trunk/Doc/appendixc.tex
URL: http://svn.apache.org/viewvc/httpd/mod_python/trunk/Doc/appendixc.tex?view=diff&rev=451861&r1=451860&r2=451861
==============================================================================
--- httpd/mod_python/trunk/Doc/appendixc.tex (original)
+++ httpd/mod_python/trunk/Doc/appendixc.tex Sun Oct  1 20:08:17 2006
@@ -301,6 +301,9 @@
       \code{PythonInterpPerDirectory} was enabled and request was against
       a directory but client didn't provide the trailing slash.
     \item
+      (\citetitle[http://issues.apache.org/jira/browse/MODPYTHON-159]{MODPYTHON-159})
+      Fix \code{FieldStorage} class so that it can handle multiline headers.
+    \item
       (\citetitle[http://issues.apache.org/jira/browse/MODPYTHON-160]{MODPYTHON-160})
       Using \code{PythonInterpPerDirective} when setting content handler to
       run dynamically with \code{req.add_handler()} would cause Apache to

Modified: httpd/mod_python/trunk/lib/python/mod_python/util.py
URL: http://svn.apache.org/viewvc/httpd/mod_python/trunk/lib/python/mod_python/util.py?view=diff&rev=451861&r1=451860&r2=451861
==============================================================================
--- httpd/mod_python/trunk/lib/python/mod_python/util.py (original)
+++ httpd/mod_python/trunk/lib/python/mod_python/util.py Sun Oct  1 20:08:17 2006
@@ -174,6 +174,10 @@
   
             skip_this_part = False
             while line not in ('\r','\r\n'):
+                nextline = req.readline(readBlockSize)
+                while nextline and nextline[0] in [ ' ', '\t']:
+                    line = line + nextline
+                    nextline = req.readline(readBlockSize)
                 # we read the headers until we reach an empty line
                 # NOTE : a single \n would mean the entity is malformed, but
                 # we're tolerating it anyway
@@ -192,7 +196,7 @@
                     if ctype.find('/') == -1:
                         ctype = 'application/octet-stream'
             
-                line = req.readline(readBlockSize)
+                line = nextline
                 match = boundary.match(line)
                 if (not line) or match:
                     # we stop if we reached the end of the stream or a stop boundary

Modified: httpd/mod_python/trunk/test/test.py
URL: http://svn.apache.org/viewvc/httpd/mod_python/trunk/test/test.py?view=diff&rev=451861&r1=451860&r2=451861
==============================================================================
--- httpd/mod_python/trunk/test/test.py (original)
+++ httpd/mod_python/trunk/test/test.py Sun Oct  1 20:08:17 2006
@@ -428,7 +428,7 @@
             entity.write(boundary)
             entity.write('\r\n')
             entity.write('Content-Type: text/plain\r\n')
-            entity.write('Content-Disposition: form-data; name="%s"\r\n'%name)
+            entity.write('Content-Disposition: form-data;\r\n name="%s"\r\n'%name)
             entity.write('\r\n')
             entity.write(str(value))
             entity.write('\r\n')