Skip to content

Commit

Permalink
Merge branch 'master' into mbell/replace_travis_ga
Browse files Browse the repository at this point in the history
  • Loading branch information
mjjbell authored Sep 3, 2021
2 parents 415bd81 + 8af4f70 commit d42cfa6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
- Changes from 5.25.0
- Build:
- CHANGED: Replace Travis with Github Actions for CI builds [#6071](https://github.com/Project-OSRM/osrm-backend/pull/6071)
- API:
- FIXED: Allow for special characters in the profile/method as part of the HTTP URL.

# 5.25.0
- Changes from 5.24.0
- Build:
Expand Down Expand Up @@ -119,7 +122,7 @@
](https://github.com/Project-OSRM/osrm-backend/pull/5076/)
- CHANGED: Foot profile now blacklists barriers instead of whitelisting them [#5077
](https://github.com/Project-OSRM/osrm-backend/pull/5077/)
- CHANGED: Support maxlength and maxweight in car profile [#5101](https://github.com/Project-OSRM/osrm-backend/pull/5101]
- CHANGED: Support maxlength and maxweight in car profile [#5101](https://github.com/Project-OSRM/osrm-backend/pull/5101)
- Bugfixes:
- FIXED: collapsing of ExitRoundabout instructions [#5114](https://github.com/Project-OSRM/osrm-backend/issues/5114)
- Misc:
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindLua.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ unset(_lua_append_versions)

# this is a function only to have all the variables inside go away automatically
function(_lua_set_version_vars)
set(LUA_VERSIONS5 5.3 5.2 5.1 5.0)
set(LUA_VERSIONS5 5.4 5.3 5.2 5.1 5.0)

if (Lua_FIND_VERSION_EXACT)
if (Lua_FIND_VERSION_COUNT GREATER 1)
Expand Down
12 changes: 6 additions & 6 deletions src/server/api/url_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ struct URLParser final : qi::grammar<Iterator, Into>
{
using boost::spirit::repository::qi::iter_pos;

alpha_numeral = qi::char_("a-zA-Z0-9");
identifier = qi::char_("a-zA-Z0-9_.~:-");
percent_encoding =
qi::char_('%') > qi::uint_parser<unsigned char, 16, 2, 2>()[qi::_val = qi::_1];
polyline_chars = qi::char_("a-zA-Z0-9_.--[]{}@?|\\~`^") | percent_encoding;
all_chars = polyline_chars | qi::char_("=,;:&().");
polyline_chars = qi::char_("a-zA-Z0-9_[]{}@?|\\~`^") | percent_encoding;
all_chars = polyline_chars | qi::char_("=,;:&().-");

service = +alpha_numeral;
service = +identifier;
version = qi::uint_;
profile = +alpha_numeral;
profile = +identifier;
query = +all_chars;

// Example input: /route/v1/driving/7.416351,43.731205;7.420363,43.736189
Expand All @@ -54,7 +54,7 @@ struct URLParser final : qi::grammar<Iterator, Into>
qi::rule<Iterator, std::string()> profile;
qi::rule<Iterator, std::string()> query;

qi::rule<Iterator, char()> alpha_numeral;
qi::rule<Iterator, char()> identifier;
qi::rule<Iterator, char()> all_chars;
qi::rule<Iterator, char()> polyline_chars;
qi::rule<Iterator, char()> percent_encoding;
Expand Down
12 changes: 11 additions & 1 deletion unit_tests/server/url_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE(invalid_urls)
BOOST_CHECK_EQUAL(testInvalidURL("/route/"), 7UL);
BOOST_CHECK_EQUAL(testInvalidURL("/route/bla"), 7UL);
BOOST_CHECK_EQUAL(testInvalidURL("/route/1/1,2;3;4"), 7UL);
BOOST_CHECK_EQUAL(testInvalidURL("/route/v1/pro_file/1,2;3,4"), 13UL);
BOOST_CHECK_EQUAL(testInvalidURL("/route/v1/pro[]file/1,2;3,4"), 13UL);
BOOST_CHECK_EQUAL(testInvalidURL("/route/v1/profile"), 17UL);
BOOST_CHECK_EQUAL(testInvalidURL("/route/v1/profile/"), 18UL);
}
Expand Down Expand Up @@ -124,6 +124,16 @@ BOOST_AUTO_TEST_CASE(valid_urls)
BOOST_CHECK_EQUAL(reference_8.profile, result_8->profile);
CHECK_EQUAL_RANGE(reference_8.query, result_8->query);
BOOST_CHECK_EQUAL(reference_8.prefix_length, result_8->prefix_length);

// profile with special characters
api::ParsedURL reference_9{"route", 1, "foo-bar_baz.profile", "0,1;2,3;4,5?options=value&foo=bar", 30UL};
auto result_9 = api::parseURL("/route/v1/foo-bar_baz.profile/0,1;2,3;4,5?options=value&foo=bar");
BOOST_CHECK(result_9);
BOOST_CHECK_EQUAL(reference_9.service, result_9->service);
BOOST_CHECK_EQUAL(reference_9.version, result_9->version);
BOOST_CHECK_EQUAL(reference_9.profile, result_9->profile);
CHECK_EQUAL_RANGE(reference_9.query, result_9->query);
BOOST_CHECK_EQUAL(reference_9.prefix_length, result_9->prefix_length);
}

BOOST_AUTO_TEST_SUITE_END()

0 comments on commit d42cfa6

Please sign in to comment.