aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/src/http_lib/http_request.erl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2018-04-12 14:24:08 +0200
committerIngela Anderton Andin <[email protected]>2018-05-22 18:07:50 +0200
commitdaba7e0abe4a5642543676e966298b08dee83eb9 (patch)
tree244a35a9694091b697b257a1fe915cca89fcf116 /lib/inets/src/http_lib/http_request.erl
parent40ab3958644be3fc14682c54233514fdf880386a (diff)
downloadotp-daba7e0abe4a5642543676e966298b08dee83eb9.tar.gz
otp-daba7e0abe4a5642543676e966298b08dee83eb9.tar.bz2
otp-daba7e0abe4a5642543676e966298b08dee83eb9.zip
inets: Gracefully handle bad headers
max_headers operated on the individual header length instead of the total length of all headers. Also headers with empty keys are now discarded.
Diffstat (limited to 'lib/inets/src/http_lib/http_request.erl')
-rw-r--r--lib/inets/src/http_lib/http_request.erl6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/inets/src/http_lib/http_request.erl b/lib/inets/src/http_lib/http_request.erl
index f68b233e10..8ca1542164 100644
--- a/lib/inets/src/http_lib/http_request.erl
+++ b/lib/inets/src/http_lib/http_request.erl
@@ -27,10 +27,12 @@
key_value(KeyValueStr) ->
case lists:splitwith(fun($:) -> false; (_) -> true end, KeyValueStr) of
- {Key, [$: | Value]} ->
+ {Key, [$: | Value]} when Key =/= [] ->
{http_util:to_lower(string:strip(Key)), string:strip(Value)};
{_, []} ->
- undefined
+ undefined;
+ _ ->
+ undefined
end.
%%-------------------------------------------------------------------------
%% headers(HeaderList, #http_request_h{}) -> #http_request_h{}