使用 Actionscript 解码分块 HTTP [英] Decoding chunked HTTP with Actionscript
本文介绍了使用 Actionscript 解码分块 HTTP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已通过套接字成功连接到带有 ActionScript 3 的 HTTP 服务器.唯一的问题是,服务器正在发送分块的 HTTP.是否有任何其他语言的通用函数可以清楚地显示如何解码分块?我很确定这里没有 ActionScript 库.
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 other language I can look at that clearly shows how to decode the chunking? I'm pretty sure there are no ActionScript libraries around for this.
推荐答案
HTTP 1.1规范(或来自W3C)提供了如何解码分块传输编码:
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
这篇关于使用 Actionscript 解码分块 HTTP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文