[Twisted-Python] t.p.http handling of multipart/form-data

Stephen C. Waterbury golux at comcast.net
Thu May 6 15:57:13 MDT 2004


Hey http rewriting team ...
(or more specifically foom, I think :)

I'm (for my sins, no doubt) using the multipart/form-data
implementation in t.p.http to transfer files, and it works
okay but could be improved.  I'm sure this is not at the
top of your priority list for the rewrite (or even *on* it,
probably :), but I'd just like to go on record as in favor
of a possible enhancement.  Let me know if I should put
this into the issue tracker as a feature request.

(1)  Access to enclosure headers

The way request arg processing works currently, it doesn't
parse the headers from the MIME enclosure, which includes some
useful stuff:  Content-Type, Content-Transfer-Encoding, and
Content-Disposition (which has the "filename" attribute that
browsers use for the local filename -- nice to have for some
use cases).  This is a documented deficiency of
cgi.parse_multipart -- it's recommended to use cgi.FieldStorage
to parse the nested parts (also for more "flexibility" in
handling of large data, according to the cgi module docs).
I discussed this earlier with Itamar, and IIRC he didn't want
to use FieldStorage because it blocked (right Itamar? :).

(2)  [not a big deal] Multiple enclosures.

This is just a "would be nice".  It's easy enough to do several
transfers, but a single one would be more efficient, especially
in the case of a lot of small files ... arguably there are lots
of ways to get around it (zip, etc.), which is why it's not
a high priority.

Cheers,
Steve





More information about the Twisted-Python mailing list