Fix syntax error position indicators in parameters queries

To fix #2193 prefix_length member variable has been added to ParsedURL
that is set to the length of "/service/version/profile/" prefix
when the prefix is accepted by the parser.
Also BOOST_FUSION_ADAPT_STRUCT for osrm::server::api::ParsedURL
has been moved from header to url_parser.cpp to speed up compilation
of CUs that do not use the fusion adaption.
This commit is contained in:
Michael Krasnyk
2016-04-26 21:20:24 +02:00
parent e9e935303c
commit 5186b9490d
18 changed files with 64 additions and 51 deletions
+2 -2
View File
@@ -57,7 +57,7 @@ std::string getWrongOptionHelp(const engine::api::TableParameters &parameters)
}
} // anon. ns
engine::Status TableService::RunQuery(std::string &query, ResultT &result)
engine::Status TableService::RunQuery(std::size_t prefix_length, std::string &query, ResultT &result)
{
result = util::json::Object();
auto &json_result = result.get<util::json::Object>();
@@ -70,7 +70,7 @@ engine::Status TableService::RunQuery(std::string &query, ResultT &result)
const auto position = std::distance(query.begin(), query_iterator);
json_result.values["code"] = "InvalidQuery";
json_result.values["message"] =
"Query string malformed close to position " + std::to_string(position);
"Query string malformed close to position " + std::to_string(prefix_length + position);
return engine::Status::Error;
}
BOOST_ASSERT(parameters);