bzp2010 commented on code in PR #12539: URL: https://github.com/apache/apisix/pull/12539#discussion_r2291031797
########## t/plugin/basic-auth.t: ########## @@ -252,7 +288,7 @@ GET /t -=== TEST 13: invalid schema, not field given +=== TEST 16: invalid schema, not field given Review Comment: Do these tests need to be added in the middle? Can it be in a new file or at the end of the old one? ########## apisix/plugins/ldap-auth.lua: ########## @@ -66,23 +67,27 @@ function _M.check_schema(conf, schema_type) return ok, err end -local function extract_auth_header(authorization) +local function extract_auth_header(auth) local obj = { username = "", password = "" } + -- Check format of Authorization header. + local matches, err = ngx_re.split(auth, "\\s+", nil, nil, 2) - local m, err = ngx.re.match(authorization, "Basic\\s(.+)", "jo") Review Comment: Why not use regex to do the pattern matching and data extraction directly? `Basic` is short, and in the worst case we only need to assert the uppercase and lowercase format of each letter. There doesn't seem to be a significant means from using split. `[Bb][Aa][Ss][Ii][Cc]\\s(.*)` `(?i:basic)\\s(.*)` -- 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. To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org