[erlang-bugs] R12B-4: http_chunk:encode(iolist()) produces invalid chunk
Alexey Naidyonov
alexey.naidyonov@REDACTED
Fri Sep 26 13:23:01 CEST 2008
Hello;
http_chunk:encode of inets application is defined as
encode(Chunk) when is_list(Chunk)->
HEXSize = http_util:integer_to_hexlist(length(Chunk)),
[HEXSize, ?CR, ?LF, Chunk, ?CR, ?LF].
When mod_esi:deliver is called with iolist() containing binaries,
http_chink:encode produces an invalid chunk, e.g.
mod_esi:deliver(SessionID, [<<"abcd">>, <<"abcd">>]).
yields:
2
abcdabcd
I believe length/1 should be replaced with erlang:iolist_size/1, i.e.
encode(Chunk) when is_list(Chunk)->
HEXSize = http_util:integer_to_hexlist(erlang:iolist_size(Chunk)),
[HEXSize, ?CR, ?LF, Chunk, ?CR, ?LF].
this produces correct
8
abcdabcd
SY,
--
Alexey Naidyonov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20080926/da572fbb/attachment.htm>
More information about the erlang-bugs
mailing list