[erlang-bugs] R12B-4: http_chunk:encode(iolist()) produces invalid chunk
Ingela Anderton Andin
ingela@REDACTED
Tue Oct 14 10:40:04 CEST 2008
Hi!
Thank you for pointing this out it has been corrected for R1B-5.
Regards Ingela Erlang/OTP - Ericsson
Alexey Naidyonov wrote:
> 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
> ------------------------------------------------------------------------
>
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-bugs
More information about the erlang-bugs
mailing list