nickva commented on code in PR #5326: URL: https://github.com/apache/couchdb/pull/5326#discussion_r1821388972
########## src/chttpd/src/chttpd.erl: ########## @@ -431,6 +431,34 @@ handle_req_after_auth(HandlerKey, HttpReq) -> {HttpReq, catch_error(HttpReq, ErrorType, Error, Stack)} end. +nonce(MochiReq) -> + case MochiReq:get_header_value("X-Couch-Request-ID") of + undefined -> + new_nonce(); + Value -> + case re:run(Value, nonce_regex(), [{capture, none}]) of Review Comment: This does call into a NIF but wonder if something like `Check = fun(C) -> (C >= $a andalso C =< $z) orelse (C >= $0 andalso C =< $9) end` but with guards with `lists:all(Check, Value)` would be quicker? I suspect it might not be as regexes are pretty fast. If it's a toss-up we at least we won't have to have a persistent term in the mix 🤷 -- 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...@couchdb.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org