72 {
73 LOG(TRACE) <<
"======================= APPLICATION 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
88
89 if (methodMatchesResult) {
90 const MountMatchResult
match =
92
93 if (
match.requestMatched) {
94 LOG(TRACE) <<
"----------------------- APPLICATION MATCH -----------------------";
95
96 dispatched = true;
97
98 if (!
match.decodeError) {
99 express::Request& request = *controller.
getRequest();
100 request.
queries.insert(
match.requestQueryPairs.begin(),
match.requestQueryPairs.end());
101
102
103 const ScopedPathStrip pathStrip(request,
match.isPrefix,
match.consumedLength);
104 const ScopedParams scopedParams(request,
match.params, mergeParams);
105
106 if (!replayingNext) {
108 } else {
109 dispatched = controller.
dispatchNext(strictRouting, caseInsensitiveRouting, mergeParams);
110 }
111 } else {
113 }
114
115 } else {
116 LOG(TRACE) <<
"----------------------- APPLICATION NOMATCH -----------------------";
117 }
118 } else {
119 LOG(TRACE) <<
"----------------------- APPLICATION NOMATCH -----------------------";
120 }
121
122 return dispatched;
123 }
bool dispatchNext(bool strictRouting, bool caseInsensitiveRouting, bool mergeParams)
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