Skip to content

Commit 3d83cbb

Browse files
committed
Improve string compare performance
1 parent 8a803b3 commit 3d83cbb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

httplib.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4540,9 +4540,9 @@ inline bool Server::parse_request_line(const char *s, Request &req) {
45404540
if (count != 3) { return false; }
45414541
}
45424542

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

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

0 commit comments

Comments
 (0)