iilyak commented on a change in pull request #3637:
URL: https://github.com/apache/couchdb/pull/3637#discussion_r656980512



##########
File path: src/couch/src/couch_httpd_auth.erl
##########
@@ -71,22 +71,39 @@ special_test_authentication_handler(Req) ->
 basic_name_pw(Req) ->
     AuthorizationHeader = header_value(Req, "Authorization"),
     case AuthorizationHeader of
-    "Basic " ++ Base64Value ->
-        try re:split(base64:decode(Base64Value), ":",
-                      [{return, list}, {parts, 2}]) of
-        ["_", "_"] ->
-            % special name and pass to be logged out
+        % undefined is sent during startup process
+        undefined ->
             nil;
-        [User, Pass] ->
-            {User, Pass};
         _ ->
-            nil
-        catch
-        error:function_clause ->
-            throw({bad_request, "Authorization header has invalid base64 
value"})
-        end;
-    _ ->
-        nil
+            try string:split(AuthorizationHeader, " ") of

Review comment:
       I think `string:split/2` can fail only if non string is passed into it. 
Therefore `try` is not needed here.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to