<div dir="ltr"><div>Hello;</div><div><br></div><div>http_chunk:encode of inets application is defined as</div><div><br></div><div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco">encode<span style="color: #32325a">(</span><span style="color: #966400">Chunk</span><span style="color: #32325a">) when </span>is_list<span style="color: #32325a">(</span><span style="color: #966400">Chunk</span><span style="color: #32325a">)</span><span style="color: #0032e6">-></span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span style="color: #32325a"> </span><span style="color: #966400">HEXSize</span><span style="color: #32325a"> = </span>http_util<span style="color: #32325a">:</span>integer_to_hexlist<span style="color: #32325a">(</span><span style="">length</span><span style="color: #32325a">(</span><span style="color: #966400">Chunk</span><span style="color: #32325a">)),</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #32325a"> [<span style="color: #966400">HEXSize</span>, <span style="color: #329632">?CR</span>, <span style="color: #329632">?LF</span>, <span style="color: #966400">Chunk</span>, <span style="color: #329632">?CR</span>, <span style="color: #329632">?LF</span>].</p>
</div><div><br></div><div>When mod_esi:deliver is called with iolist() containing binaries, http_chink:encode produces an invalid chunk, e.g.</div><div><br></div><div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #32325a">
<span style="color: #000000">mod_esi</span>:<span style="color: #000000">deliver</span>(<span style="color: #966400">SessionID</span>, [<<<span style="color: #9e1ca0">"abcd"</span>>>, <<<span style="color: #9e1ca0">"abcd"</span>>>]).</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #32325a"><br></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #32325a"><font class="Apple-style-span" color="#000000" face="arial" size="3"><span class="Apple-style-span" style="font-size: 13px;">yields:</span></font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #32325a"><font class="Apple-style-span" color="#000000" face="arial" size="3"><span class="Apple-style-span" style="font-size: 13px;"><br></span></font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #32325a"><font class="Apple-style-span" color="#000000" face="arial" size="3"><span class="Apple-style-span" style="font-size: 13px;">2</span></font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #32325a"><font class="Apple-style-span" color="#000000" face="arial" size="3"><span class="Apple-style-span" style="font-size: 13px;">abcdabcd</span></font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #32325a"><font class="Apple-style-span" color="#000000" face="arial" size="3"><span class="Apple-style-span" style="font-size: 13px;"><br></span></font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #32325a"><font class="Apple-style-span" color="#000000" face="arial" size="3"><span class="Apple-style-span" style="font-size: 13px;">I believe length/1 should be replaced with erlang:iolist_size/1, i.e.</span></font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #32325a"><font class="Apple-style-span" color="#000000" face="arial" size="3"><span class="Apple-style-span" style="font-size: 13px;"><br></span></font></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #32325a"><font class="Apple-style-span" color="#000000" face="arial" size="3"><span class="Apple-style-span" style="font-size: 13px;"></span></font></p>
<font class="Apple-style-span" color="#000000" face="arial" size="3"><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco">encode<span style="color: #32325a">(</span><span style="color: #966400">Chunk</span><span style="color: #32325a">) when </span>is_list<span style="color: #32325a">(</span><span style="color: #966400">Chunk</span><span style="color: #32325a">)</span><span style="color: #0032e6">-></span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span style="color: #32325a"> </span><span style="color: #966400">HEXSize</span><span style="color: #32325a"> = </span>http_util<span style="color: #32325a">:</span>integer_to_hexlist<span style="color: #32325a">(</span>erlang<span style="color: #32325a">:</span>iolist_size<span style="color: #32325a">(</span><span style="color: #966400">Chunk</span><span style="color: #32325a">)),</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #32325a"> [<span style="color: #966400">HEXSize</span>, <span style="color: #329632">?CR</span>, <span style="color: #329632">?LF</span>, <span style="color: #966400">Chunk</span>, <span style="color: #329632">?CR</span>, <span style="color: #329632">?LF</span>].</p>
</font><p></p></div><div><br></div><div>this produces correct</div><div><br></div><div>8</div><div>abcdabcd</div><br clear="all">SY,<br>-- <br> Alexey Naidyonov<br>
</div>