Case sensitive method, trim trailing whitespace (correctly), host header may be empty

This commit is contained in:
Alex Hultman
2022-10-31 03:47:08 +01:00
parent cca4610d5d
commit 2b850f76d3
4 changed files with 94 additions and 50 deletions
+1 -2
View File
@@ -36,7 +36,6 @@ namespace uWS {
template <class USERDATA>
struct HttpRouter {
/* These are public for now */
std::vector<std::string> methods = {"get", "post", "head", "put", "delete", "connect", "options", "trace", "patch"};
std::vector<std::string> upperCasedMethods = {"GET", "POST", "HEAD", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE", "PATCH"};
static const uint32_t HIGH_PRIORITY = 0xd0000000, MEDIUM_PRIORITY = 0xe0000000, LOW_PRIORITY = 0xf0000000;
@@ -247,7 +246,7 @@ private:
public:
HttpRouter() {
int p = 0;
for (std::string &method : methods) {
for (std::string &method : upperCasedMethods) {
priority[method] = p++;
}
}