[Trac-tickets] Re: [The Trac Project] #2284: Delete page exhibits same behaviour as delete version

The Trac Project noreply at edgewall.com
Thu Nov 3 03:21:25 CST 2005


#2284: Delete page exhibits same behaviour as delete version
-----------------------------------+----------------------------------------
 Reporter:  trac-form at swapoff.org  |        Owner:  mgood   
     Type:  defect                 |       Status:  assigned
 Priority:  normal                 |    Milestone:  0.9.1   
Component:  general                |      Version:  0.9     
 Severity:  normal                 |   Resolution:          
 Keywords:                         |  
-----------------------------------+----------------------------------------
Comment (by cmlenz):

 That behavior of the mod_python frontend was introduced in [1467] to fix
 #1370:
   The problem here is that the FieldStorage implementation of mod_python
 behaves differently from the implementation in cgi.py. While the latter
 adds query-string parameters after POST body parameters, and does so only
 if the the parameter isn't already in the body, the mod_python
 implementation adds query string parameters first and unconditionally.

 Looking at the Python `cgi` module (in 2.3), I think this analysis is
 correct, at least for forms that aren't multipart encoded:
 {{{
 #!python
     if environ['REQUEST_METHOD'] == 'POST':
         ctype, pdict = parse_header(environ['CONTENT_TYPE'])
         if ctype == 'multipart/form-data':
             return parse_multipart(fp, pdict)
         elif ctype == 'application/x-www-form-urlencoded':
             clength = int(environ['CONTENT_LENGTH'])
             if maxlen and clength > maxlen:
                 raise ValueError, 'Maximum content length exceeded'
             qs = fp.read(clength)
         else:
             qs = ''                     # Unknown content-type
         if 'QUERY_STRING' in environ:
             if qs: qs = qs + '&'
             qs = qs + environ['QUERY_STRING']
         elif sys.argv[1:]:
             if qs: qs = qs + '&'
             qs = qs + sys.argv[1]
         environ['QUERY_STRING'] = qs    # XXX Shouldn't, really
     elif 'QUERY_STRING' in environ:
         qs = environ['QUERY_STRING']
 }}}

 So, for a form with the standard `application/x-www-form-urlencoded`
 encoding, the parameters in the request body are simply appended to the
 query string, which is then later parsed to populate the `FieldStorage`
 fields. Maybe this has been changed in Python 2.4?

-- 
Ticket URL: <http://projects.edgewall.com/trac/ticket/2284>
The Trac Project <http://trac.edgewall.com/>


More information about the Trac-Tickets mailing list