Skip to content

Commit

Permalink
Improve string compare performance
Browse files Browse the repository at this point in the history
  • Loading branch information
yhirose committed Jul 13, 2021
1 parent 8a803b3 commit 3d83cbb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions httplib.h
Original file line number Diff line number Diff line change
Expand Up @@ -4540,9 +4540,9 @@ inline bool Server::parse_request_line(const char *s, Request &req) {
if (count != 3) { return false; }
}

const std::set<std::string> methods{"GET", "HEAD", "POST", "PUT",
"DELETE", "CONNECT", "OPTIONS", "TRACE",
"PATCH", "PRI"};
static const std::set<std::string> methods{
"GET", "HEAD", "POST", "PUT", "DELETE",
"CONNECT", "OPTIONS", "TRACE", "PATCH", "PRI"};

if (methods.find(req.method) == methods.end()) { return false; }

Expand Down

0 comments on commit 3d83cbb

Please sign in to comment.