【发布时间】:2010-09-22 05:20:00
【问题描述】:
我已通过套接字成功连接到带有 ActionScript 3 的 HTTP 服务器。唯一的问题是,服务器正在发送分块的 HTTP。是否有任何其他语言的通用函数可以清楚地显示如何解码分块?我很确定这方面没有 ActionScript 库。
【问题讨论】:
标签: actionscript-3 http sockets chunking
我已通过套接字成功连接到带有 ActionScript 3 的 HTTP 服务器。唯一的问题是,服务器正在发送分块的 HTTP。是否有任何其他语言的通用函数可以清楚地显示如何解码分块?我很确定这方面没有 ActionScript 库。
【问题讨论】:
标签: actionscript-3 http sockets chunking
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
【讨论】: