
I have been successfully using pion 1.0.16 in a project up to this day, but have now run into an isssue. I am running a WebServer and have some classes registered as handlers for given URI's which implement the WebService contract.
One of these request handlers receives a large file as a PUT operation. The sender of this file sends it as chunked data. I am trying to figure out how to parse that chunked data, to iterate over all of the chunks and stream them out to the file I'm storing to disk.
The documentation is quite sparse in this area.. from just looking around I believe I am supposed to be using the HTTPRequestReader class and calling parse on it with my HTTPRequest object that I receive from the operator()() call in my WebService. When I call that and then turn around and call any of the methods about how many bytes were read or are available, they all return 0.
I also noticed that the HTTPRequest object I have already contains a few functions such as isChunked() (which returns true in my case), getChunksSupported(), and getChunkCache() but based on what those return it looks like they're only there to support the HTTPRequestReader's parsing.
So, the bottom line is I don't understand how the HTTPRequestReader is meant to be used to iterate over the chunks.
Most of the other classes I have been able to figure out how to use because of the unit test suite, but there is nothing in the unit test suite about HTTPRequestReader or parsing chunked data (I found a little class which sends chunked data but that doesn't help me here).
Could someone please provide a quick and dirty pseudocode about what steps I need to take to iterate over all the data chunks? Again, I am starting with a HTTPRequestPtr object.
Thanks!

I've dug into this a bit more.. it's clear now that by the time I receive the HTTPRequest, it would already have been parsed, even if chunked.. so I stepped into the code and found that when the parser is created it is given a max content length of 1 MB, and the data is just being truncated.
Found a different post where you are allowing overriding the max content length and saying that was checked into trunk.. I'm going to pull down the latest 2.x and try that and see if that solves the problem, but I would prefer to use a stable version of pion (1.0.x, since that is what you're currently calling stable). Any chance of getting a 1.0.17 with just that change set in it?
- Login or register to post comments
Submitted by malawar on Wed, 07/29/2009 - 08:51.We're not planning to backport this into 1.0.x. However, you're welcome to give it a try. The patch is attached to this trac ticket:
http://trac.atomiclabs.com/ticket/589
I recommend using 2.1.4 though. Very little has changed in the network library (it's extremely stable) and we're no longer planning to support 1.0.x.
- Login or register to post comments
Submitted by Mike Dickey on Fri, 07/31/2009 - 17:08.I got around the issue and was able to keep using pion 1.0.16 by extending WebService and overriding handleConnection method (thank goodness it was virtual) and setting a max content length on the HTTPRequestReader prior to calling receive().
- Login or register to post comments
Submitted by malawar on Wed, 07/29/2009 - 12:20.