0
我已通過套接字成功地連接到帶有ActionScript 3的HTTP服務器。唯一的問題是,服務器正在發送分塊的HTTP。在我看到的任何其他語言中是否有一個通用函數,清楚地顯示瞭如何解碼分塊?我很確定這裏沒有ActionScript庫。使用Actionscript對分塊的HTTP進行解碼
我已通過套接字成功地連接到帶有ActionScript 3的HTTP服務器。唯一的問題是,服務器正在發送分塊的HTTP。在我看到的任何其他語言中是否有一個通用函數,清楚地顯示瞭如何解碼分塊?我很確定這裏沒有ActionScript庫。使用Actionscript對分塊的HTTP進行解碼
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