[Twisted-Python] reading multipart/form-data headers

Burak Arslan burak.arslan at arskom.com.tr
Fri Aug 12 03:58:28 MDT 2016


Hey Adi, hey Glyph,

Thanks a lot for your answers.


On 08/12/16 12:28, Adi Roiban wrote:
> On 11 August 2016 at 21:52, Glyph Lefkowitz <glyph at twistedmatrix.com> wrote:
>> Thanks for using Twisted, and sorry about this shortcoming.

Nothing to be sorry about, twisted is made of man-years of good work.
Once you twist your point of view enough, it becomes quite elegant and
predictable. Some wars *had* to be fought uphill while integrating with
twisted's HTTP implementation but it's the way things are, I'm not
complaining.


> I have some coding which is doing a best effort to parse the request
> body in a streaming mode... but it is using a fork based on the code
> submitted for this ticket http://twistedmatrix.com/trac/ticket/6928

This is for a library I'm developing, so I can only depend on what's
already released. However, thanks for the code -- it will certainly give
me ideas.

> For my project I need to handle files larger than 5GB, so I ended up
> with the modified request/resource
>

As I said, I can't make any assumptions on file size but I *think* I can
pretend that my requests fit in memory as long as I keep them in
memory-mapped files. mmap is wonderful -- It's both a file and a string!

With that assumption, this is what I came up with:

https://github.com/plq/spyne/blob/7f52ab0f11773535c6a73702b4b838b49ecdd9e6/spyne/server/twisted/http.py#L321

I'd love to hear your feedback about it. Do you think I can get away
with relying on mmap here?

Best regards,
Burak




More information about the Twisted-Python mailing list