[Catalyst] Large requests with JSON?

Tomas Doran bobtfish at bobtfish.net
Sat Feb 6 04:56:39 GMT 2010


On 5 Feb 2010, at 20:54, Bill Moseley wrote:
> AFAIK, there's no way to stream parse JSON (so that only part is in  
> memory at any given time).  What would be the recommended  
> serialization for uploaded files -- just use multipart/form-data for  
> the uploads?

Don't?

Why not just do a PUT request with all the data as unmangled binary?

> BTW -- I don't see any code in HTTP::Body to limit body size.   
> Doesn't that seem like a pretty easy DoS for Catalyst apps?  I do  
> set a request size limit in the web server, but if I need to allow  
> 1/2GB uploads or so then could kill the machine pretty easily, no?

Well, you set it at the web server.. That stops both overlarge content- 
length requests, and when the body exceeds the specified content length.

But yes, you have to provision temp file space for n files in flight x  
max file size...

(I have an HTTP::Body subclass I use to stream stuff directly into  
mogilefs rather than getting a temp file - code on request)...

Cheers
t0m




More information about the Catalyst mailing list