aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-04-17 13:23:48 +0200
committerLoïc Hoguin <[email protected]>2014-04-17 13:23:48 +0200
commit5c2adc167aff5e799f2a676fe5682784898e9d93 (patch)
tree0d3e5e618bb69be59fbad5c4b8c90cbdd43f8b21
parente9198e73871972d14819926540f3e3f50c242432 (diff)
parentd145cbb7457889eaf67943ef634b8784745c8b06 (diff)
downloadcowboy-5c2adc167aff5e799f2a676fe5682784898e9d93.tar.gz
cowboy-5c2adc167aff5e799f2a676fe5682784898e9d93.tar.bz2
cowboy-5c2adc167aff5e799f2a676fe5682784898e9d93.zip
Merge branch 'fix/basic-auth-empty-password' of git://github.com/soundrop/cowboy
-rw-r--r--src/cowboy_http.erl4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cowboy_http.erl b/src/cowboy_http.erl
index bc8b289..754e74a 100644
--- a/src/cowboy_http.erl
+++ b/src/cowboy_http.erl
@@ -725,8 +725,6 @@ authorization_basic_userid(<<C, Rest/binary>>, Fun, Acc) ->
authorization_basic_password(Data, Fun) ->
authorization_basic_password(Data, Fun, <<>>).
-authorization_basic_password(<<>>, _Fun, <<>>) ->
- {error, badarg};
authorization_basic_password(<<C, _Rest/binary>>, _Fun, _Acc)
when C < 32; C=:= 127 ->
{error, badarg};
@@ -1012,6 +1010,8 @@ http_authorization_test_() ->
Tests = [
{<<"basic">>, <<"QWxsYWRpbjpvcGVuIHNlc2FtZQ==">>,
{<<"basic">>, {<<"Alladin">>, <<"open sesame">>}}},
+ {<<"basic">>, <<"dXNlcm5hbWU6">>,
+ {<<"basic">>, {<<"username">>, <<>>}}},
{<<"basic">>, <<"dXNlcm5hbWUK">>,
{error, badarg}},
{<<"basic">>, <<"_[]@#$%^&*()-AA==">>,