Wednesday, 15 June 2011

python - How should Transfer-encoding: chunked be rendered? -



python - How should Transfer-encoding: chunked be rendered? -

when browser renders info trasfered using chunked encoding browser should render origional info without chunk size , crlfs added encode data, correct?

using code example:

https://gist.github.com/josiahcarlson/3250376

my browser (chrome , ff) renders

12 chunk: 0 12 chunk: 1 12 chunk: 2 12 chunk: 3 12 chunk: 4 12 chunk: 5 12 chunk: 6 12 chunk: 7 12 chunk: 8 12 chunk: 9 0

i not expecting see chunk sizes.

should info rendered our without endcoding info in browser?

http 1.0 clients not required decode chunked data. default http version sent python's basehttpserver class http 1.0. if send version of 1.1 browser render info you'd expect. imagine curl trying smart doing right thing thought server sending wrong protocol version.

patch code set basehttpserver instance's protocol_version attribute before sending response. add together @ line 73 of example.

self.protocol_version = 'http/1.1'

for more detailed info on differences between http 1.0 , http 1.1 can reference http://www8.org/w8-papers/5c-protocols/key/key.html

python http transfer-encoding

No comments:

Post a Comment