8
8
% %%
9
9
% %% MIT License
10
10
% %%
11
- % %% Copyright (c) 2012-2018 Michael Truog <mjtruog at protonmail dot com>
11
+ % %% Copyright (c) 2012-2020 Michael Truog <mjtruog at protonmail dot com>
12
12
% %%
13
13
% %% Permission is hereby granted, free of charge, to any person obtaining a
14
14
% %% copy of this software and associated documentation files (the "Software"),
29
29
% %% DEALINGS IN THE SOFTWARE.
30
30
% %%
31
31
% %% @author Michael Truog <mjtruog at protonmail dot com>
32
- % %% @copyright 2012-2018 Michael Truog
33
- % %% @version 1.7.5 {@date} {@time}
32
+ % %% @copyright 2012-2020 Michael Truog
33
+ % %% @version 1.8.1 {@date} {@time}
34
34
% %%------------------------------------------------------------------------
35
35
36
36
-module (cloudi_http_cowboy1_handler ).
@@ -146,7 +146,6 @@ handle(Req0,
146
146
if
147
147
(OutputType =:= external ) orelse
148
148
(OutputType =:= binary ) orelse (OutputType =:= list ) ->
149
- % cloudi_request_info text_pairs format
150
149
{get_query_string_external (QSVals ), Req3 };
151
150
OutputType =:= internal ->
152
151
% cloudi_key_value format
@@ -900,12 +899,7 @@ header_content_type(Headers) ->
900
899
901
900
% format for external services, http headers passed as key-value pairs
902
901
headers_external_incoming (L ) ->
903
- erlang :iolist_to_binary (headers_external_incoming_text (L )).
904
-
905
- headers_external_incoming_text ([] = L ) ->
906
- L ;
907
- headers_external_incoming_text ([{K , V } | L ]) when is_binary (K ) ->
908
- [[K , 0 , V , 0 ] | headers_external_incoming_text (L )].
902
+ cloudi_request_info :key_value_new (L , text_pairs ).
909
903
910
904
headers_external_outgoing (<<>>) ->
911
905
[];
@@ -917,29 +911,10 @@ headers_external_outgoing([{_, _} | _] = ResponseInfo) ->
917
911
ResponseInfo ;
918
912
headers_external_outgoing (ResponseInfo )
919
913
when is_binary (ResponseInfo ) ->
920
- headers_external_outgoing_text (binary :split (ResponseInfo , <<0 >>, [global ])).
921
-
922
- headers_external_outgoing_text ([<<>>]) ->
923
- [];
924
- headers_external_outgoing_text ([K , <<>>]) ->
925
- [{K , <<>>}];
926
- headers_external_outgoing_text ([K , V | L ]) ->
927
- [{K , V } | headers_external_outgoing_text (L )].
914
+ cloudi_response_info :key_value_parse (ResponseInfo , list ).
928
915
929
- get_query_string_external ([]) ->
930
- <<>>;
931
916
get_query_string_external (QsVals ) ->
932
- erlang :iolist_to_binary (get_query_string_external_text (QsVals )).
933
-
934
- get_query_string_external_text ([] = L ) ->
935
- L ;
936
- get_query_string_external_text ([{K , V } | L ]) ->
937
- if
938
- V =:= true ->
939
- [[K , 0 , <<" true" >>, 0 ] | get_query_string_external_text (L )];
940
- is_binary (V ) ->
941
- [[K , 0 , V , 0 ] | get_query_string_external_text (L )]
942
- end .
917
+ cloudi_request_info :key_value_new (QsVals , text_pairs ).
943
918
944
919
request_time_start () ->
945
920
cloudi_timestamp :microseconds_monotonic ().
0 commit comments