aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGarrett Smith <[email protected]>2011-09-24 23:46:23 -0500
committerGarrett Smith <[email protected]>2011-09-24 23:46:23 -0500
commit166f4ccad9a1f7ecc9b0934faff8b9e913dc0fc5 (patch)
tree52803dda1df1c7b50a98f3afe40bab7fe7a55383 /lib
parent53cf0b70c705e0bf6c09f83f2ce2709d79593ce6 (diff)
downloadotp-166f4ccad9a1f7ecc9b0934faff8b9e913dc0fc5.tar.gz
otp-166f4ccad9a1f7ecc9b0934faff8b9e913dc0fc5.tar.bz2
otp-166f4ccad9a1f7ecc9b0934faff8b9e913dc0fc5.zip
Fix logging of content length in mod_log
mod_log uses content length from response headers when logging transfer length, which is a string. It needs to be converted to an integer when logged.
Diffstat (limited to 'lib')
-rw-r--r--lib/inets/src/http_server/mod_log.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/inets/src/http_server/mod_log.erl b/lib/inets/src/http_server/mod_log.erl
index c8a2ec0dc4..62faa285df 100644
--- a/lib/inets/src/http_server/mod_log.erl
+++ b/lib/inets/src/http_server/mod_log.erl
@@ -100,7 +100,7 @@ do(Info) ->
transfer_log(Info,"-",AuthUser,Date,StatusCode,Size),
{proceed,Info#mod.data};
{response, Head, _Body} ->
- Size = proplists:get_value(content_length,Head,unknown),
+ Size = content_length(Head),
Code = proplists:get_value(code,Head,unknown),
transfer_log(Info, "-", AuthUser, Date, Code, Size),
{proceed, Info#mod.data};
@@ -254,4 +254,10 @@ auth_user(Data) ->
RemoteUser
end.
-
+content_length(Head) ->
+ case proplists:get_value(content_length, Head) of
+ undefined ->
+ unknown;
+ Size ->
+ list_to_integer(Size)
+ end.