Decoding chunked HTTP with Actionscript

前端 未结 1 613
情话喂你
情话喂你 2021-01-07 14:19

I have successfully connected to an HTTP server with ActionScript 3 over sockets. The only problem is, the server is sending chunked HTTP. Is there a generic function in any

1条回答
  •  一生所求
    2021-01-07 14:59

    The HTTP 1.1 specification (or from W3C) provides a pseudocode example of how to decode chunked transfer-coding:

    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
    

    0 讨论(0)
提交回复
热议问题