aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFredrik Gustafsson <[email protected]>2013-03-13 13:49:28 +0100
committerFredrik Gustafsson <[email protected]>2013-03-13 13:49:28 +0100
commit9b75046d2e14e1d75f9bcf1915d2cf38b89ced7f (patch)
treef3d579285ad34152625636fde64c70116cfc0495
parentdc2463d1ffcc34ff009ae555f984f10d9e0e920b (diff)
parent09fa1ba9b2f4becf68912bcfc4692d226344d920 (diff)
downloadotp-9b75046d2e14e1d75f9bcf1915d2cf38b89ced7f.tar.gz
otp-9b75046d2e14e1d75f9bcf1915d2cf38b89ced7f.tar.bz2
otp-9b75046d2e14e1d75f9bcf1915d2cf38b89ced7f.zip
Merge branch 'maint'
-rw-r--r--lib/inets/src/http_client/httpc.erl16
-rw-r--r--lib/inets/test/httpc_SUITE.erl7
2 files changed, 19 insertions, 4 deletions
diff --git a/lib/inets/src/http_client/httpc.erl b/lib/inets/src/http_client/httpc.erl
index ede649a5a9..64a60b82aa 100644
--- a/lib/inets/src/http_client/httpc.erl
+++ b/lib/inets/src/http_client/httpc.erl
@@ -163,8 +163,13 @@ request(Method,
{error, Reason} ->
{error, Reason};
{ok, ParsedUrl} ->
- handle_request(Method, Url, ParsedUrl, Headers, [], [],
- HTTPOptions, Options, Profile)
+ case header_parse(Headers) of
+ {error, Reason} ->
+ {error, Reason};
+ _ ->
+ handle_request(Method, Url, ParsedUrl, Headers, [], [],
+ HTTPOptions, Options, Profile)
+ end
end;
request(Method,
@@ -1247,7 +1252,12 @@ uri_parse(URI, Opts) ->
%%--------------------------------------------------------------------------
-
+header_parse([]) ->
+ ok;
+header_parse([{Field, Value}|T]) when is_list(Field), is_list(Value) ->
+ header_parse(T);
+header_parse(_) ->
+ {error, {headers_error, not_strings}}.
child_name2info(undefined) ->
{error, no_such_service};
child_name2info(httpc_manager) ->
diff --git a/lib/inets/test/httpc_SUITE.erl b/lib/inets/test/httpc_SUITE.erl
index 8df5964193..c20ec63448 100644
--- a/lib/inets/test/httpc_SUITE.erl
+++ b/lib/inets/test/httpc_SUITE.erl
@@ -83,7 +83,8 @@ real_requests()->
stream_through_fun,
stream_through_mfa,
streaming_error,
- inet_opts
+ inet_opts,
+ invalid_headers
].
only_simulated() ->
@@ -795,6 +796,10 @@ headers_dummy(Config) when is_list(Config) ->
%%-------------------------------------------------------------------------
+invalid_headers(Config) ->
+ Request = {url(group_name(Config), "/dummy.html", Config), [{"cookie", undefined}]},
+ {error, _} = httpc:request(get, Request, [], []).
+
remote_socket_close(Config) when is_list(Config) ->
URL = url(group_name(Config), "/just_close.html", Config),
{error, socket_closed_remotely} = httpc:request(URL).