implementation issue with t.w.http.Request
|Reported by:||rikyu||Owned by:|
I've noticed a problem with the standard twisted.web Request object that I'd like to get some feedback on.
The issue is in the way the Request parses POST data. Basically, since the request body is parsed before the Request is handed off to any user code, it makes it impossible to implement interactive file uploads, or to prohibit large attachment sizes.
My fix was to create an UnparsedRequest subclass, and re-implement requestReceived(), but that required duplicating a lot of code. Also, it was only a solution in my case because I was parsing POST data myself, and was not relying on request.args.
As an alternative, I've attached a patch to t.w.http.Request which breaks off the body parsing into a separate function. This allows a subclass of Request to override handling of the request body, or ignore it completely, without affecting other twisted.web code that depends on pre-parsed POST data.