72 {
73 LOG(TRACE) <<
"======================= MIDDLEWARE DISPATCH =======================";
74 LOG(TRACE) << controller.
getResponse()->getSocketContext()->getSocketConnection()->getConnectionName();
75 LOG(TRACE) <<
" Request Method: " << controller.
getRequest()->method;
76 LOG(TRACE) <<
" Request Url: " << controller.
getRequest()->url;
77 LOG(TRACE) <<
" Request Path: " << controller.
getRequest()->path;
78 LOG(TRACE) <<
" Mountpoint Method: " << mountPoint.
method;
80 LOG(TRACE) <<
" StrictRouting: " << strictRouting;
81 LOG(TRACE) <<
" CaseInsensitiveRouting: " << caseInsensitiveRouting;
82 LOG(TRACE) <<
" MergeParams: " << mergeParams;
83
84 bool dispatched = false;
85
87
89 const MountMatchResult
match =
91
92 if (
match.requestMatched) {
93 LOG(TRACE) <<
"----------------------- MIDDLEWARE MATCH -----------------------";
94
95 dispatched = true;
96
97 if (!
match.decodeError) {
98 express::Request& request = *controller.
getRequest();
99 request.
queries.insert(
match.requestQueryPairs.begin(),
match.requestQueryPairs.end());
100
101
102 const ScopedPathStrip pathStrip(request,
match.isPrefix,
match.consumedLength);
103 const ScopedParams scopedParams(request,
match.params, mergeParams);
104
105 Next next(controller);
107
108
110 LOG(TRACE) <<
"Express: M - Next called - set to NO MATCH";
111 dispatched = false;
112 controller = next.controller;
113 }
114 } else {
116 }
117
118 } else {
119 LOG(TRACE) <<
"----------------------- MIDDLEWARE NOMATCH -----------------------";
120 }
121 } else {
122 LOG(TRACE) <<
"----------------------- MIDDLEWARE NOMATCH -----------------------";
123 }
124
125 return dispatched;
126 }
const std::shared_ptr< Request > & getRequest() const
const std::shared_ptr< Response > & getResponse() const
std::map< std::string, std::string > queries
std::vector< std::string > names
bool match(const char *first, const char *second)
MountMatchResult matchMountPoint(express::Controller &controller, const std::string &absoluteMountPath, const express::MountPoint &mountPoint, std::regex &cachedRegex, std::vector< std::string > &cachedNames, bool strictRouting, bool caseInsensitiveRouting)
bool methodMatches(std::string_view requestMethod, const std::string &mountMethod)
std::string relativeMountPath