mirror of
https://github.com/drogonframework/drogon.git
synced 2025-07-18 00:00:46 -04:00
Compare commits
No commits in common. "88ce2115c3c028adf3896a7433295cd6739fba95" and "a18df843c109e8e0ea4ff54b806c2e2474ab2137" have entirely different histories.
88ce2115c3
...
a18df843c1
@ -524,42 +524,6 @@ void HttpControllersRouter::route(
|
||||
}
|
||||
return;
|
||||
}
|
||||
std::vector<std::string> params;
|
||||
for (size_t j = 1; j < result.size(); ++j)
|
||||
{
|
||||
if (!result[j].matched)
|
||||
continue;
|
||||
size_t place = j;
|
||||
if (j <= binder->parameterPlaces_.size())
|
||||
{
|
||||
place = binder->parameterPlaces_[j - 1];
|
||||
}
|
||||
if (place > params.size())
|
||||
params.resize(place);
|
||||
params[place - 1] = result[j].str();
|
||||
LOG_TRACE << "place=" << place << " para:" << params[place - 1];
|
||||
}
|
||||
|
||||
if (!binder->queryParametersPlaces_.empty())
|
||||
{
|
||||
auto &queryPara = req->getParameters();
|
||||
for (auto const ¶Place : binder->queryParametersPlaces_)
|
||||
{
|
||||
auto place = paraPlace.second;
|
||||
if (place > params.size())
|
||||
params.resize(place);
|
||||
auto iter = queryPara.find(paraPlace.first);
|
||||
if (iter != queryPara.end())
|
||||
{
|
||||
params[place - 1] = iter->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
params[place - 1] = std::string{};
|
||||
}
|
||||
}
|
||||
}
|
||||
req->setRoutingParameters(std::move(params));
|
||||
if (!postRoutingObservers_.empty())
|
||||
{
|
||||
for (auto &observer : postRoutingObservers_)
|
||||
@ -675,11 +639,41 @@ void HttpControllersRouter::doControllerHandler(
|
||||
}
|
||||
}
|
||||
|
||||
auto ¶msVector = req->getRoutingParameters();
|
||||
std::deque<std::string> params(paramsVector.size());
|
||||
for (int i = 0; i < paramsVector.size(); i++)
|
||||
std::deque<std::string> params(ctrlBinderPtr->parameterPlaces_.size());
|
||||
|
||||
for (size_t j = 1; j < matchResult.size(); ++j)
|
||||
{
|
||||
params[i] = paramsVector[i];
|
||||
if (!matchResult[j].matched)
|
||||
continue;
|
||||
size_t place = j;
|
||||
if (j <= ctrlBinderPtr->parameterPlaces_.size())
|
||||
{
|
||||
place = ctrlBinderPtr->parameterPlaces_[j - 1];
|
||||
}
|
||||
if (place > params.size())
|
||||
params.resize(place);
|
||||
params[place - 1] = matchResult[j].str();
|
||||
LOG_TRACE << "place=" << place << " para:" << params[place - 1];
|
||||
}
|
||||
|
||||
if (!ctrlBinderPtr->queryParametersPlaces_.empty())
|
||||
{
|
||||
auto &queryPara = req->getParameters();
|
||||
for (auto const ¶Place : ctrlBinderPtr->queryParametersPlaces_)
|
||||
{
|
||||
auto place = paraPlace.second;
|
||||
if (place > params.size())
|
||||
params.resize(place);
|
||||
auto iter = queryPara.find(paraPlace.first);
|
||||
if (iter != queryPara.end())
|
||||
{
|
||||
params[place - 1] = iter->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
params[place - 1] = std::string{};
|
||||
}
|
||||
}
|
||||
}
|
||||
ctrlBinderPtr->binderPtr_->handleHttpRequest(
|
||||
params,
|
||||
|
Loading…
x
Reference in New Issue
Block a user