Decoding chunked HTTP with ActionScript

I have successfully connected to an HTTP server using ActionScript 3 over sockets. The only problem is the server is sending chunked HTTP. Is there a generic function in any other language I can look at that clearly shows how to decode a chunk? I'm pretty sure there are no ActionScript libraries for this.

0


source to share


1 answer


the HTTP 1.1 specification (or from the W3C ) provides pseudocode, an example of how to decode an encoded transmission encoding :



length := 0
read chunk-size, chunk-extension (if any) and CRLF
while (chunk-size > 0) {
   read chunk-data and CRLF
   append chunk-data to entity-body
   length := length + chunk-size
   read chunk-size and CRLF
}
read entity-header
while (entity-header not empty) {
   append entity-header to existing header fields
   read entity-header
}
Content-Length := length
Remove "chunked" from Transfer-Encoding

      

+4


source







All Articles