diff options
author | Magnus Ahltorp <map@kth.se> | 2015-02-27 22:27:12 +0100 |
---|---|---|
committer | Magnus Ahltorp <map@kth.se> | 2015-02-27 22:27:12 +0100 |
commit | 0aff0f752fd4a5d342fbb1a9a9192ae239f48b1f (patch) | |
tree | 7c4e79713e380b0b1927ab9d4a9e0f14e6c90849 /src/plop.erl | |
parent | 565eeaa97a3502adddd2dac79435416501a6ad07 (diff) |
Handle case when no own_key has been definedauthentication2
Diffstat (limited to 'src/plop.erl')
-rw-r--r-- | src/plop.erl | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/plop.erl b/src/plop.erl index cfca343..6ff65f8 100644 --- a/src/plop.erl +++ b/src/plop.erl @@ -200,9 +200,13 @@ add_auth(Method, Path, Headers, Data) -> [{"X-Catlfish-Auth", AuthHeader} | Headers]. get_auth_header(Headers) -> - Result = binary_to_list(hackney_headers:get_value("X-Catlfish-Auth", Headers)), - lager:debug("received auth header: ~p", [Result]), - Result. + case hackney_headers:get_value("X-Catlfish-Auth", Headers) of + undefined -> + undefined; + Result when is_binary(Result) -> + lager:debug("received auth header: ~p", [Result]), + binary_to_list(Result) + end. send_http_request(TreeLeafHash, URL, Headers, RequestBody) -> ParentPid = self(), @@ -243,7 +247,8 @@ send_http_request(TreeLeafHash, URL, Headers, RequestBody) -> {StatusLine, RespHeaders, Body}}}; noauth -> lager:debug("no auth"), - drop + ParentPid ! {http, {RequestId, + {StatusLine, RespHeaders, Body}}} end end), RequestId. |