[erlang-questions] Fwd: how: Chunked input encoding with {packet, http}

Vlad Dumitrescu vladdu55@REDACTED
Thu Mar 27 19:28:46 CET 2008


Hi,


 On Thu, Mar 27, 2008 at 7:19 PM, Christian S <chsu79@REDACTED> wrote:
 > Typically, one use the http packet to get the Content-Length and then
 >  proceed to {packet, raw} and read that number of bytes.
 >
 >  But how should one handle a request that comes in with an unknown
 >  length such as a chunk encoded entity?
 >
 >  I don't know how much to read, and if I read, I do not seem to be able
 >  to put data back (say if I received the beginning of the next
 >  request).

 You can keep a binary as a buffer: any incoming data gets appended to
 it and when you know how big a chunk is, you extract it from the front
 of the binary.

 regards,
 Vlad



-- 
.......__o
.......\<,
....( )/ ( )...



More information about the erlang-questions mailing list