开发者

Is this response properly encoded?

I am receiving the following headers in response to a web request:

HTTP/1.1 200 OK
...
...
Pragma: no-cache
Content-Type: binary/octet-stream
Transfer-Encoding: chunked
...


Ÿ’âýÝ©ËIJ‹sç
ÿ-
// in hex the encoded data reads:
// 00000000  9f 92 开发者_开发百科e2 fd dd a9 cb 49 4a 8b 73 e7 0a ff 02 2d          IJ s    -

Question:

  1. Is this a valid or properly encoded chunked response? I don't see any 0 length chunks in there. What am I missing?


No, this does not seem to be properly encoded. In general, the commonly used chunked transfer encoding has the following scheme:

<chunk-size> <CRLF>
<chunk-data> <CRLF>
<chunk-size> <CRLF>
<chunk-data> <CRLF>
⋮
<chunk-size> <CRLF>
<chunk-data> <CRLF>
0 <CRLF>
<CRLF>

The chunk-size is a string of hex digits indicating the size of the following chunk-data, both terminated by a CRLF sequence. The chunked encoding is ended by any chunk whose size is zero which is terminated by an empty line.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜