0

我已通过套接字成功连接到带有 ActionScript 3 的 HTTP 服务器。唯一的问题是,服务器正在发送分块的 HTTP。是否有任何其他语言的通用函数可以清楚地显示如何解码分块?我很确定这方面没有 ActionScript 库。

4

1 回答 1

4

HTTP 1.1 规范(或来自W3C)提供了如何解码分块传输编码的伪代码示例:

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
于 2008-11-14T10:21:16.527 回答