Is this response properly encoded?

4.2k views Asked by At

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?
1

There are 1 answers

0
Gumbo On

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.