From 3d83cbb872c82b37579d1bf0f2d44bc0b767eb11 Mon Sep 17 00:00:00 2001 From: yhirose Date: Mon, 12 Jul 2021 23:51:56 -0400 Subject: [PATCH] Improve string compare performance --- httplib.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/httplib.h b/httplib.h index 96855ea..8943f25 100644 --- a/httplib.h +++ b/httplib.h @@ -4540,9 +4540,9 @@ inline bool Server::parse_request_line(const char *s, Request &req) { if (count != 3) { return false; } } - const std::set methods{"GET", "HEAD", "POST", "PUT", - "DELETE", "CONNECT", "OPTIONS", "TRACE", - "PATCH", "PRI"}; + static const std::set methods{ + "GET", "HEAD", "POST", "PUT", "DELETE", + "CONNECT", "OPTIONS", "TRACE", "PATCH", "PRI"}; if (methods.find(req.method) == methods.end()) { return false; }