diff options
author | Micael Karlberg <[email protected]> | 2013-09-16 12:44:50 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2013-11-12 18:24:47 +0100 |
commit | 1b39c3289665b82d0dd8d3d232bc9de1d7fb5237 (patch) | |
tree | 1f8f42d5207a9d562aa38656b9b5c65f989465a5 /lib/inets | |
parent | b6447a51da5e601ce24b20b9059143e7db5f981d (diff) | |
download | otp-1b39c3289665b82d0dd8d3d232bc9de1d7fb5237.tar.gz otp-1b39c3289665b82d0dd8d3d232bc9de1d7fb5237.tar.bz2 otp-1b39c3289665b82d0dd8d3d232bc9de1d7fb5237.zip |
[inets/httpd] Improved access log entry
Sometimes the size of a response could be as a string.
Diffstat (limited to 'lib/inets')
-rw-r--r-- | lib/inets/src/http_server/httpd_log.erl | 15 | ||||
-rw-r--r-- | lib/inets/src/http_server/httpd_request_handler.erl | 2 |
2 files changed, 12 insertions, 5 deletions
diff --git a/lib/inets/src/http_server/httpd_log.erl b/lib/inets/src/http_server/httpd_log.erl index a34435e0e8..7ff73669f9 100644 --- a/lib/inets/src/http_server/httpd_log.erl +++ b/lib/inets/src/http_server/httpd_log.erl @@ -39,14 +39,21 @@ Size :: 0 | pos_integer() | string()) -> {Log :: atom() | pid(), Entry :: string()} | term() . -access_entry(Log, NoLog, Info, RFC931, AuthUser, Date, StatusCode, SizeStr) - when is_list(SizeStr) -> +%% Somethime the size in the form of the content_length is put here, which +%% is actually in the form of a string +%% So it can either be the size as an integer, the size as a string +%% or, worst case scenario, bytes. +access_entry(Log, NoLog, Info, RFC931, AuthUser, Date, StatusCode, + SizeStrOrBytes) + when is_list(SizeStrOrBytes) -> Size = - case (catch list_to_integer(SizeStr)) of + case (catch list_to_integer(SizeStrOrBytes)) of I when is_integer(I) -> + %% This is from using the content_length (which is a string) I; _ -> - SizeStr % This is better then nothing + %% This is better than nothing + httpd_util:flatlength(SizeStrOrBytes) end, access_entry(Log, NoLog, Info, RFC931, AuthUser, Date, StatusCode, Size); access_entry(Log, NoLog, diff --git a/lib/inets/src/http_server/httpd_request_handler.erl b/lib/inets/src/http_server/httpd_request_handler.erl index 57beb1e403..2e4a35d031 100644 --- a/lib/inets/src/http_server/httpd_request_handler.erl +++ b/lib/inets/src/http_server/httpd_request_handler.erl @@ -267,7 +267,7 @@ handle_info({ssl_error, _, _} = Reason, State) -> {stop, Reason, State}; %% Timeouts -handle_info(timeout, #state{mod = ModData, mfa = {_, parse, _}} = State) -> +handle_info(timeout, #state{mfa = {_, parse, _}} = State) -> %% error_log("No request received on keep-alive connection " %% "before server side timeout", ModData), %% No response should be sent! |