diff options
author | Micael Karlberg <[email protected]> | 2011-11-01 18:39:48 +0100 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2011-11-01 18:39:48 +0100 |
commit | f8f0496c1b85169f6e72b6f875c521f09a471bbf (patch) | |
tree | 26c5761f96eabdd7f4f1ec83e5edb7853b180db6 /lib/inets/test/httpd_test_lib.erl | |
parent | 2da7b99f186e7a8f9a74b1c7aa60b1354cbc31ea (diff) | |
parent | 5fdd7be5b5b99658f7f9d05e7df3a572d73dd6cb (diff) | |
download | otp-f8f0496c1b85169f6e72b6f875c521f09a471bbf.tar.gz otp-f8f0496c1b85169f6e72b6f875c521f09a471bbf.tar.bz2 otp-f8f0496c1b85169f6e72b6f875c521f09a471bbf.zip |
[httpd] GET request with malformed header date caused
server crash (non-fatal) with no reply to client. Will
now result in a reply with status code 400.
OTP-9674
Merge branch 'bmk/inets/httpd/xss_with_bad_header_date/OTP-9674' into bmk/inets/inets536_integration
Conflicts:
lib/inets/doc/src/notes.xml
lib/inets/src/inets_app/inets.appup.src
lib/inets/test/httpd_test_lib.erl
lib/inets/vsn.mk
Diffstat (limited to 'lib/inets/test/httpd_test_lib.erl')
-rw-r--r-- | lib/inets/test/httpd_test_lib.erl | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/lib/inets/test/httpd_test_lib.erl b/lib/inets/test/httpd_test_lib.erl index becb54e479..8d748defd8 100644 --- a/lib/inets/test/httpd_test_lib.erl +++ b/lib/inets/test/httpd_test_lib.erl @@ -102,11 +102,20 @@ verify_request(SocketType, Host, Port, Node, RequestStr, Options, TimeOut) -> ValidateResult end. -request(#state{mfa = {Module, Function, Args}, - request = RequestStr, socket = Socket} = State, TimeOut) -> +request(#state{mfa = {Module, Function, Args}, + request = RequestStr, + socket = Socket} = State, TimeOut) -> + io:format("~p ~w[~w]request -> entry with" + "~n Module: ~p" + "~n Function: ~p" + "~n Args: ~p" + "~n", [self(), ?MODULE, ?LINE, Module, Function, Args]), HeadRequest = lists:sublist(RequestStr, 1, 4), receive {tcp, Socket, Data} -> + io:format("~p ~w[~w]request -> received (tcp) data" + "~n Data: ~p" + "~n", [self(), ?MODULE, ?LINE, Data]), print(tcp, Data, State), case Module:Function([Data | Args]) of {ok, Parsed} -> @@ -117,11 +126,19 @@ request(#state{mfa = {Module, Function, Args}, request(State#state{mfa = NewMFA}, TimeOut) end; {tcp_closed, Socket} when Function == whole_body -> + io:format("~p ~w[~w]request -> " + "received (tcp) closed when whole_body" + "~n", [self(), ?MODULE, ?LINE]), print(tcp, "closed", State), State#state{body = hd(Args)}; {tcp_closed, Socket} -> + io:format("~p ~w[~w]request -> received (tcp) closed" + "~n", [self(), ?MODULE, ?LINE]), test_server:fail(connection_closed); {tcp_error, Socket, Reason} -> + io:format("~p ~w[~w]request -> received (tcp) error" + "~n Reason: ~p" + "~n", [self(), ?MODULE, ?LINE, Reason]), test_server:fail({tcp_error, Reason}); {ssl, Socket, Data} -> print(ssl, Data, State), @@ -141,11 +158,21 @@ request(#state{mfa = {Module, Function, Args}, {ssl_error, Socket, Reason} -> test_server:fail({ssl_error, Reason}) after TimeOut -> + io:format("~p ~w[~w]request -> timeout" + "~n", [self(), ?MODULE, ?LINE]), test_server:fail(connection_timed_out) end. handle_http_msg({Version, StatusCode, ReasonPharse, Headers, Body}, State = #state{request = RequestStr}) -> + io:format("~p ~w[~w]handle_http_msg -> entry with" + "~n Version: ~p" + "~n StatusCode: ~p" + "~n ReasonPharse: ~p" + "~n Headers: ~p" + "~n Body: ~p" + "~n", [self(), ?MODULE, ?LINE, + Version, StatusCode, ReasonPharse, Headers, Body]), case is_expect(RequestStr) of true -> State#state{status_line = {Version, |