aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2011-03-28 11:09:46 +0200
committerMicael Karlberg <[email protected]>2011-03-28 11:09:46 +0200
commit3b9072a22c8050215c3d72e46c31e73c2a95532d (patch)
treec6a6a250a9f6ec5da7aa5b3d3bee841572bfe5d2 /lib
parent04623176f365ac58eba1df64d3054eba6c482ce4 (diff)
parentcbe8b2e034a8b2cd6052df5e27f1b229ded9748e (diff)
downloadotp-3b9072a22c8050215c3d72e46c31e73c2a95532d.tar.gz
otp-3b9072a22c8050215c3d72e46c31e73c2a95532d.tar.bz2
otp-3b9072a22c8050215c3d72e46c31e73c2a95532d.zip
Merge branch 'rj/fix-httpd-format' into bmk/inets/inet56_integration
OTP-9157
Diffstat (limited to 'lib')
-rw-r--r--lib/inets/doc/src/notes.xml6
-rw-r--r--lib/inets/src/http_server/httpd_file.erl17
-rw-r--r--lib/inets/src/http_server/httpd_log.erl4
-rw-r--r--lib/inets/src/http_server/httpd_request_handler.erl6
-rw-r--r--lib/inets/src/inets_app/inets.appup.src12
5 files changed, 31 insertions, 14 deletions
diff --git a/lib/inets/doc/src/notes.xml b/lib/inets/doc/src/notes.xml
index 7d8d81ab71..5adbfbade8 100644
--- a/lib/inets/doc/src/notes.xml
+++ b/lib/inets/doc/src/notes.xml
@@ -71,6 +71,12 @@
<p>Own Id: OTP-9124</p>
</item>
+ <item>
+ <p>[httpd] Improved error messages. </p>
+ <p>Ricardo Catalinas Jim�nez</p>
+ <p>Own Id: OTP-9157</p>
+ </item>
+
</list>
</section>
diff --git a/lib/inets/src/http_server/httpd_file.erl b/lib/inets/src/http_server/httpd_file.erl
index 7e21d9e158..ccc1f7874a 100644
--- a/lib/inets/src/http_server/httpd_file.erl
+++ b/lib/inets/src/http_server/httpd_file.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2006-2010. All Rights Reserved.
+%% Copyright Ericsson AB 2006-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
@@ -26,22 +26,21 @@
handle_error(eacces, Op, ModData, Path) ->
- handle_error(403, Op, ModData, Path,"Forbidden");
+ handle_error(403, Op, ModData, Path, ": Forbidden");
handle_error(enoent, Op, ModData, Path) ->
- handle_error(404, Op, ModData, Path,"File not found");
+ handle_error(404, Op, ModData, Path, ": File not found");
handle_error(enotdir, Op, ModData, Path) ->
handle_error(404, Op, ModData, Path,
- ": A component of the file name is not a directory");
+ ": A component of the file name is not a directory");
handle_error(emfile, Op, _ModData, Path) ->
handle_error(500, Op, none, Path, ": To many open files");
handle_error({enfile,_}, Op, _ModData, Path) ->
handle_error(500, Op, none, Path, ": File table overflow");
handle_error(_Reason, Op, ModData, Path) ->
- handle_error(404, Op, ModData, Path, "File not found").
-
-handle_error(StatusCode, Op, none, Path, Reason) ->
- {StatusCode, none, ?NICE("Can't " ++ Op ++ Path ++ Reason)};
+ handle_error(404, Op, ModData, Path, ": File not found").
+handle_error(StatusCode, Op, none, Path, Reason) ->
+ {StatusCode, none, ?NICE("Can't " ++ Op ++ " " ++ Path ++ Reason)};
handle_error(StatusCode, Op, ModData, Path, Reason) ->
{StatusCode, ModData#mod.request_uri,
- ?NICE("Can't " ++ Op ++ Path ++ Reason)}.
+ ?NICE("Can't " ++ Op ++ " " ++ Path ++ Reason)}.
diff --git a/lib/inets/src/http_server/httpd_log.erl b/lib/inets/src/http_server/httpd_log.erl
index f3ea3aa0e2..db1e2c627a 100644
--- a/lib/inets/src/http_server/httpd_log.erl
+++ b/lib/inets/src/http_server/httpd_log.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
+%% Copyright Ericsson AB 2008-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
@@ -113,7 +113,7 @@ do_error_entry(ConfigDB, RemoteHost, undefined, Date, Reason) ->
do_error_entry(ConfigDB, RemoteHost, URI, Date, Reason) ->
case httpd_util:lookup(ConfigDB, error_log_format, pretty) of
pretty ->
- io_lib:format("[~s] access to ~s failed for ~s reason: ~n~p~n",
+ io_lib:format("[~s] access to ~s failed for ~s, reason: ~n~p~n",
[Date, URI, RemoteHost, Reason]);
compact ->
io_lib:format( "[~s] access to ~s failed for ~s, reason: ~w~n",
diff --git a/lib/inets/src/http_server/httpd_request_handler.erl b/lib/inets/src/http_server/httpd_request_handler.erl
index a9db6e2058..c3b47ce390 100644
--- a/lib/inets/src/http_server/httpd_request_handler.erl
+++ b/lib/inets/src/http_server/httpd_request_handler.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1997-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
@@ -240,13 +240,13 @@ handle_info({ssl_error, _, _} = Reason, State) ->
%% Timeouts
handle_info(timeout, #state{mod = ModData, mfa = {_, parse, _}} = State) ->
- error_log("No request received on keep-alive connection"
+ error_log("No request received on keep-alive connection "
"before server side timeout", ModData),
%% No response should be sent!
{stop, normal, State#state{response_sent = true}};
handle_info(timeout, #state{mod = ModData} = State) ->
httpd_response:send_status(ModData, 408, "Request timeout"),
- error_log("The client did not send the whole request before the"
+ error_log("The client did not send the whole request before the "
"server side timeout", ModData),
{stop, normal, State#state{response_sent = true}};
diff --git a/lib/inets/src/inets_app/inets.appup.src b/lib/inets/src/inets_app/inets.appup.src
index cabc9c9834..df18ffa9e8 100644
--- a/lib/inets/src/inets_app/inets.appup.src
+++ b/lib/inets/src/inets_app/inets.appup.src
@@ -23,9 +23,12 @@
{load_module, ftp, soft_purge, soft_purge, []},
{load_module, http_util, soft_purge, soft_purge, []},
{load_module, httpd_util, soft_purge, soft_purge, [http_util]},
+ {load_module, httpd_file, soft_purge, soft_purge, []},
+ {load_module, httpd_log, soft_purge, soft_purge, []},
{load_module, mod_esi, soft_purge, soft_purge, []},
{load_module, httpc, soft_purge, soft_purge, [httpc_handler]},
{load_module, httpc_request, soft_purge, soft_purge, []},
+ {update, httpd_request_handler, soft, soft_purge, soft_purge, []},
{update, httpc_handler, soft, soft_purge, soft_purge, [httpc_request]}
]
},
@@ -35,9 +38,12 @@
{load_module, http_chunk, soft_purge, soft_purge, []},
{load_module, http_util, soft_purge, soft_purge, []},
{load_module, httpd_util, soft_purge, soft_purge, [http_util]},
+ {load_module, httpd_file, soft_purge, soft_purge, []},
+ {load_module, httpd_log, soft_purge, soft_purge, []},
{load_module, mod_esi, soft_purge, soft_purge, []},
{load_module, httpc, soft_purge, soft_purge, [httpc_handler]},
{load_module, httpc_request, soft_purge, soft_purge, []},
+ {update, httpd_request_handler, soft, soft_purge, soft_purge, []},
{update, httpc_handler, soft, soft_purge, soft_purge,
[httpc_request, http_chunk]}
]
@@ -59,9 +65,12 @@
{load_module, ftp, soft_purge, soft_purge, []},
{load_module, http_util, soft_purge, soft_purge, []},
{load_module, httpd_util, soft_purge, soft_purge, [http_util]},
+ {load_module, httpd_file, soft_purge, soft_purge, []},
+ {load_module, httpd_log, soft_purge, soft_purge, []},
{load_module, mod_esi, soft_purge, soft_purge, []},
{load_module, httpc, soft_purge, soft_purge, [httpc_handler]},
{load_module, httpc_request, soft_purge, soft_purge, []},
+ {update, httpd_request_handler, soft, soft_purge, soft_purge, []},
{update, httpc_handler, soft, soft_purge, soft_purge, [httpc_request]}
]
},
@@ -71,9 +80,12 @@
{load_module, http_chunk, soft_purge, soft_purge, []},
{load_module, http_util, soft_purge, soft_purge, []},
{load_module, httpd_util, soft_purge, soft_purge, [http_util]},
+ {load_module, httpd_file, soft_purge, soft_purge, []},
+ {load_module, httpd_log, soft_purge, soft_purge, []},
{load_module, mod_esi, soft_purge, soft_purge, []},
{load_module, httpc, soft_purge, soft_purge, [httpc_handler]},
{load_module, httpc_request, soft_purge, soft_purge, []},
+ {update, httpd_request_handler, soft, soft_purge, soft_purge, []},
{update, httpc_handler, soft, soft_purge, soft_purge,
[httpc_request, http_chunk]}
]