[Twisted-Python] x-www-urlencoded information loss
Matthias Urlichs
smurf at noris.de
Fri May 9 19:32:37 MDT 2003
Hi,
if somebody uploads a file, the x-url-encoded part with the file data
typically has an extended header along the lines of
-----some-boundary
Content-Disposition: form-data; name="file"; filename="foo.txt"
Content-Type: application/octet-stream
...the.actual.contents...
-----some-boundary
At the moment, Twisted doesn't seem to store that information (i.e.,
filename and content-type) anywhere. I consider that to be a bug; I don't
want to de-MIMEify the content a second time.
To fix this, the arguments should probably acquire their own "headers"
hash. For instance, in the above example:
request.args["file"][0].headers = \
{"content-type": ["application/octet-stream"],
"Content-Disposition":["form-data; name=\"file\";
filename=\"foo.txt\""]}
That would require to use a subclass of "str" for the arguments (you can't
directly attach a property to a string), but with Python 2.2 this should
be nicely transparent.
--
Matthias
More information about the Twisted-Python
mailing list