<div dir="ltr"><div><div><div>A problem with chunked IIRC is that the frame headers are variable-length (a CRLF followed by a hex number followed by some optional gunk followed by CRLF) so you have to drop back into one-byte-at-a-time to read it. (Well, I suppose you could read 5 bytes, which is the minimum: CR, LF, X, CR, LF, and when the second CR isn't among these, you have a lower bound for how much more to read, although at that point you better load up on coffee before writing the rest of the code. :-)<br>
<br></div>Some good things about it:<br><br></div>- Explicit final frame (byte count zero), so no need to rely on the data to know the end.<br></div><br>- The redundancy in the format (start and end with CRLF, hex numbers) makes it more likely that framing errors (e.g. due to an incorrect counting or some layer collapsing CRLF into LF) are detected.<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Nov 20, 2013 at 7:44 AM, "Martin v. Löwis" <span dir="ltr"><<a href="mailto:martin@v.loewis.de" target="_blank">martin@v.loewis.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Am 20.11.13 06:18, schrieb Tim Peters:<br>
<div class="im">> BTW, I'm not a web guy: in what way is HTTP chunked transfer mode<br>
> viewed as being flawed? Everything I ever read about it seemed to<br>
> think it was A Good Idea.<br>
<br>
</div>It just didn't work for some time, see e.g.<br>
<br>
<a href="http://bugs.python.org/issue1486335" target="_blank">http://bugs.python.org/issue1486335</a><br>
<a href="http://bugs.python.org/issue1966" target="_blank">http://bugs.python.org/issue1966</a><br>
<a href="http://bugs.python.org/issue1312980" target="_blank">http://bugs.python.org/issue1312980</a><br>
<a href="http://bugs.python.org/issue3761" target="_blank">http://bugs.python.org/issue3761</a><br>
<br>
It's not that the protocol was underspecified - just the implementation<br>
was "brittle" (if I understand that word correctly). And I believe (and<br>
agree with you) that the cause for this "difficult to implement"<br>
property is that the framing is in putting framing "in the middle"<br>
of the stack (i.e. not really *below* pickle itself, but into pickle<br>
but below the opcodes - just like http chunked transfer is "in" http,<br>
but below the content encoding).<br>
<br>
Regards,<br>
Martin<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/guido%40python.org" target="_blank">https://mail.python.org/mailman/options/python-dev/guido%40python.org</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>--Guido van Rossum (<a href="http://python.org/~guido">python.org/~guido</a>)
</div>