diff options
author | Zandra Hird <[email protected]> | 2015-02-03 12:55:45 +0100 |
---|---|---|
committer | Zandra Hird <[email protected]> | 2015-02-03 12:55:45 +0100 |
commit | 9a393fb5237b637cc4cfdb79443a1517743eadd8 (patch) | |
tree | 55137e2b85afd9bffdf9355673479878ed6f9d08 /lib/inets/src/http_lib/http_request.erl | |
parent | c8bbf52191e3c87eedde061051eebcd02dbb7fd5 (diff) | |
parent | 42d6afe554e11813385dbf175fce58f995c2f9e5 (diff) | |
download | otp-9a393fb5237b637cc4cfdb79443a1517743eadd8.tar.gz otp-9a393fb5237b637cc4cfdb79443a1517743eadd8.tar.bz2 otp-9a393fb5237b637cc4cfdb79443a1517743eadd8.zip |
Merge branch 'maint'
Conflicts:
OTP_VERSION
erts/emulator/sys/unix/sys.c
erts/vsn.mk
Diffstat (limited to 'lib/inets/src/http_lib/http_request.erl')
-rw-r--r-- | lib/inets/src/http_lib/http_request.erl | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/lib/inets/src/http_lib/http_request.erl b/lib/inets/src/http_lib/http_request.erl index f295453bdd..a0833ddf01 100644 --- a/lib/inets/src/http_lib/http_request.erl +++ b/lib/inets/src/http_lib/http_request.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2005-2014. All Rights Reserved. +%% Copyright Ericsson AB 2005-2015. 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 @@ -21,8 +21,16 @@ -include("http_internal.hrl"). --export([headers/2, http_headers/1, is_absolut_uri/1]). +-export([headers/2, http_headers/1, is_absolut_uri/1, key_value/1]). + +key_value(KeyValueStr) -> + case lists:splitwith(fun($:) -> false; (_) -> true end, KeyValueStr) of + {Key, [$: | Value]} -> + {http_util:to_lower(string:strip(Key)), string:strip(Value)}; + {_, []} -> + undefined + end. %%------------------------------------------------------------------------- %% headers(HeaderList, #http_request_h{}) -> #http_request_h{} %% HeaderList - ["HeaderField:Value"] @@ -34,14 +42,12 @@ %%------------------------------------------------------------------------- headers([], Headers) -> Headers; -headers([Header | Tail], Headers) -> - case lists:splitwith(fun($:) -> false; (_) -> true end, Header) of - {Key, [$: | Value]} -> - headers(Tail, headers(http_util:to_lower(string:strip(Key)), - string:strip(Value), Headers)); - {_, []} -> - headers(Tail, Headers) - end. +headers([{Key, Value} | Tail], Headers) -> + headers(Tail, headers(Key, Value, Headers)); +headers([undefined], Headers) -> + Headers; +headers(KeyValues, Headers) -> + headers([key_value(KeyValue) || KeyValue <- KeyValues], Headers). %%------------------------------------------------------------------------- %% headers(#http_request_h{}) -> HeaderList |