我已通过套接字成功连接到带有ActionScript 3的HTTP服务器。唯一的问题是,服务器正在发送分块HTTP。是否有我可以看到的任何其他语言的通用函数,清楚地显示如何解码分块?我很确定没有ActionScript库。
答案 0 :(得分:4)
HTTP 1.1 specification(或来自W3C)提供了如何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