diff options
author | Micael Karlberg <[email protected]> | 2011-03-03 19:12:36 +0100 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2011-03-03 19:12:36 +0100 |
commit | addf1fff40528d7de0b8ac0e290c8db4aee4694b (patch) | |
tree | 364babe2182865f52e02e103d6a1eb4314aafa34 /lib/inets/src/http_lib | |
parent | 8c4ece5c36e153e739f344eccadd01b4c3e7ccce (diff) | |
download | otp-addf1fff40528d7de0b8ac0e290c8db4aee4694b.tar.gz otp-addf1fff40528d7de0b8ac0e290c8db4aee4694b.tar.bz2 otp-addf1fff40528d7de0b8ac0e290c8db4aee4694b.zip |
Handling encoding of empty chunks.
Diffstat (limited to 'lib/inets/src/http_lib')
-rw-r--r-- | lib/inets/src/http_lib/http_chunk.erl | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/inets/src/http_lib/http_chunk.erl b/lib/inets/src/http_lib/http_chunk.erl index 621bc68eae..57647438e9 100644 --- a/lib/inets/src/http_lib/http_chunk.erl +++ b/lib/inets/src/http_lib/http_chunk.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2010. All Rights Reserved. +%% Copyright Ericsson AB 2004-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -17,7 +17,8 @@ %% %CopyrightEnd% %% %% Description: Implements chunked transfer encoding see RFC2616 section -%% 3.6.1 +%% 3.6.1 + -module(http_chunk). -include("http_internal.hrl"). @@ -28,6 +29,7 @@ %% little at a time on a socket. -export([decode_size/1, ignore_extensions/1, decode_data/1, decode_trailer/1]). + %%%========================================================================= %%% API %%%========================================================================= @@ -81,6 +83,9 @@ encode(Chunk) when is_binary(Chunk)-> HEXSize = list_to_binary(http_util:integer_to_hexlist(size(Chunk))), <<HEXSize/binary, ?CR, ?LF, Chunk/binary, ?CR, ?LF>>; +encode([<<>>]) -> + []; + encode(Chunk) when is_list(Chunk)-> HEXSize = http_util:integer_to_hexlist(erlang:iolist_size(Chunk)), [HEXSize, ?CR, ?LF, Chunk, ?CR, ?LF]. @@ -88,6 +93,7 @@ encode(Chunk) when is_list(Chunk)-> encode_last() -> <<$0, ?CR, ?LF, ?CR, ?LF >>. + %%------------------------------------------------------------------------- %% handle_headers(HeaderRecord, ChunkedHeaders) -> NewHeaderRecord %% |