@@ -31,7 +31,7 @@ request_builder(Map) -> request_from_map(Map).
3131handle_args (# epp_request {method = get , url = URL ,
3232 headers = Headers , cookies = Cookies ,
3333 epp_verb = ? helloCommand }) ->
34- [get , URL , Headers , " " , [{ cookie , Cookies }, insecure ] ];
34+ [get , URL , Headers , " " , hackney_options ( Cookies ) ];
3535% % For error command, we convert the message and code into query parameters,
3636% % and append them to the original URL.
3737handle_args (# epp_request {method = get , url = URL ,
@@ -40,13 +40,13 @@ handle_args(#epp_request{method = get, url = URL,
4040 QueryString = hackney_url :qs (Payload ),
4141 CompleteURL = [URL , <<" ?" >>, QueryString ],
4242 [get , CompleteURL , Headers , " " ,
43- [{ cookie , Cookies }, insecure ] ];
43+ hackney_options ( Cookies ) ];
4444% % For valid commands, we set the multipart body earlier, now we just pass it on.
4545handle_args (# epp_request {method = post , url = URL ,
4646 payload = Payload , headers = Headers ,
4747 cookies = Cookies }) ->
4848 [post , URL , Headers , Payload ,
49- [{ cookie , Cookies }, insecure ] ].
49+ hackney_options ( Cookies ) ].
5050
5151% % Map request and return values.
5252request_from_map (#{command := ? errorCommand ,
@@ -82,6 +82,13 @@ request_from_map(#{command := Command,
8282 lager :info (" Request from map: [~p ]~n " , [Request ]),
8383 Request .
8484
85+ % % Get hackney options
86+ hackney_options (Cookies ) ->
87+ case application :get_env (epp_proxy , insecure ) of
88+ false -> [{cookies , Cookies }, insecure ];
89+ _ -> [{cookies , Cookies }]
90+ end .
91+
8592% % Return form data or an empty list.
8693request_body (? helloCommand , _ , _ ) -> " " ;
8794request_body (_Command , RawFrame , nomatch ) ->
0 commit comments