[mod_python] util.FieldStorage wrong about method restrictions

Nic James Ferrier nferrier at tapsellferrier.co.uk
Mon Aug 14 10:06:35 EDT 2006

Mike Looijmans <nlv11281 at natlab.research.philips.com> writes:

>>>>Really that is the only difference. Which is why both cgi.FieldStorage
>>>>and util.FieldStorage should allow PUT as well as POST.
>>>Your patch will also break any existing code that uses PUT to upload files to the server in any 
>>>form. By assuming that the body contains form data, the FieldStorage object will consume the body 
>>>and it is lost for the request.
>> Will it?
>> util.FieldStorage tests the content type before doing anything.
> You never know what a client might provide as content-type.

So someone is going to send a file to me with content type
"application/x-www-form-urlencoded" but it won't really be that as
content type?

>> Also, why would you use util.FieldStorage to retrieve a submitted
>> file? Surely you'd just read it?
> One might want to allow something like:
> http://my.server/upload/filename?access=755&sendmail=true
> and use a fieldstorage to parse the URL.

Gotcha. That does make sense.

This would work with my patch, as long as they didn't pass a file and
give it the application/x-www-form-urlencoded content type (if they
did they would be silly IMHO).

Nic Ferrier
http://www.tapsellferrier.co.uk   for all your tapsell ferrier needs

More information about the Mod_python mailing list