Compare commits

..

4 Commits

10 changed files with 508 additions and 660 deletions
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1,9 +1,9 @@
# Unreleased
- Changes from 5.27.0
- Misc:
- FIXED: Fix bug with large HTTP requests leading to Bad Request in osrm-routed. [#6403](https://github.com/Project-OSRM/osrm-backend/pull/6403)
- Routing:
- CHANGED: Add support for surface=metal,grass_paver,woodchips in bicyle profile. [#6395](https://github.com/Project-OSRM/osrm-backend/pull/6395)
- Tools:
- FIXED: Always use original weights when handling `--parse-conditionals-from-now` option. [#6399](https://github.com/Project-OSRM/osrm-backend/pull/6399)
# 5.27.0
- Changes from 5.26.0
+2 -6
View File
@@ -492,9 +492,6 @@ if(ENABLE_CONAN)
set(TBB_SHARED True)
endif()
if(NOT CONAN_CMAKE_SYSTEM_PROCESSOR)
set(CONAN_CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR})
endif()
set(CONAN_ARGS
REQUIRES
"boost/${CONAN_BOOST_VERSION}"
@@ -506,7 +503,6 @@ if(ENABLE_CONAN)
GENERATORS cmake_find_package json # json generator generates a conanbuildinfo.json in the build folder so (non-CMake) projects can easily parse OSRM's dependencies
KEEP_RPATHS
NO_OUTPUT_DIRS
ENV CONAN_CMAKE_SYSTEM_PROCESSOR=aarch64
OPTIONS boost:filesystem_version=3 # https://stackoverflow.com/questions/73392648/error-with-boost-filesystem-version-in-cmake
onetbb:shared=${TBB_SHARED}
boost:without_stacktrace=True # Apple Silicon cross-compilation fails without it
@@ -515,8 +511,8 @@ if(ENABLE_CONAN)
# explicitly say Conan to use x86 dependencies if build for x86 platforms (https://github.com/conan-io/cmake-conan/issues/141)
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
conan_cmake_run("${CONAN_ARGS};ARCH;x86")
# cross-compilation for arm64 processors
elseif((CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64")
# cross-compilation for Apple Silicon
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64")
conan_cmake_run("${CONAN_ARGS};ARCH;armv8")
else()
conan_cmake_run("${CONAN_ARGS}")
@@ -353,6 +353,28 @@ Feature: Car - Turn restrictions
| b | a | bj,jc,jc,aj,aj |
| b | d | bj,jd,jd |
# here we check that conditional restrictions can be updated via re-run of `contract`/`customize` with updated `--parse-conditionals-from-now`
# 10am utc, sat
When I run "osrm-contract {osm_file} --time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1494064800"
When I run "osrm-customize {osm_file} --time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1494064800"
When I route I should get
| from | to | route |
| b | c | bj,jc,jc |
| b | a | bj,aj,aj |
| b | d | bj,jd,jd |
# 10am utc, wed
When I run "osrm-contract {osm_file} --time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493805600"
When I run "osrm-customize {osm_file} --time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493805600"
When I route I should get
| from | to | route |
| b | c | bj,jc,jc |
| b | a | bj,jc,jc,aj,aj |
| b | d | bj,jd,jd |
@no_turning @conditionals
Scenario: Car - Conditional restriction with multiple time windows
Given the extract extra arguments "--parse-conditional-restrictions"
+3 -3
View File
@@ -4,7 +4,7 @@ module.exports = function () {
this.When(/^I request \/(.*)$/, (path, callback) => {
this.reprocessAndLoadData((e) => {
if (e) return callback(e);
this.requestUrl(path, (err, res, body) => {
this.requestPath(path, {}, (err, res, body) => {
this.response = res;
callback(err, res, body);
});
@@ -23,13 +23,13 @@ module.exports = function () {
this.ShouldBeWellFormed();
});
this.Then(/^status code should be (.+)$/, (code, callback) => {
this.Then(/^status code should be (\d+)$/, (code, callback) => {
try {
this.json = JSON.parse(this.response.body);
} catch(e) {
return callback(e);
}
assert.equal(this.json.code, code);
assert.equal(this.json.status, parseInt(code));
callback();
});
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -69,7 +69,7 @@ class Connection : public std::enable_shared_from_this<Connection>
boost::asio::deadline_timer timer;
RequestHandler &request_handler;
std::optional<RequestParser> http_request_parser;
std::vector<char> incoming_data_buffer;
boost::array<char, 8192> incoming_data_buffer;
http::request current_request;
http::reply current_reply;
std::vector<char> compressed_output;
+8 -19
View File
@@ -12,16 +12,10 @@ namespace osrm
namespace server
{
namespace
{
const size_t CHUNK_SIZE = 8192;
} // namespace
Connection::Connection(boost::asio::io_context &io_context, RequestHandler &handler)
: strand(boost::asio::make_strand(io_context)), TCP_socket(strand), timer(strand),
request_handler(handler), http_request_parser(std::make_optional<RequestParser>())
{
http_request_parser->header_limit(std::numeric_limits<std::uint32_t>::max());
}
boost::asio::ip::tcp::socket &Connection::socket() { return TCP_socket; }
@@ -65,8 +59,7 @@ void Connection::start()
}
}
void Connection::handle_read(const boost::system::error_code &error,
std::size_t /*bytes_transferred*/)
void Connection::handle_read(const boost::system::error_code &error, std::size_t bytes_transferred)
{
if (error)
{
@@ -86,7 +79,7 @@ void Connection::handle_read(const boost::system::error_code &error,
}
boost::beast::error_code ec;
http_request_parser->put(boost::asio::buffer(incoming_data_buffer), ec);
http_request_parser->put(boost::asio::buffer(incoming_data_buffer, bytes_transferred), ec);
// no error detected, let's parse the request
http::compression_type compression_type(http::no_compression);
@@ -94,15 +87,12 @@ void Connection::handle_read(const boost::system::error_code &error,
{
if (ec == boost::beast::http::error::need_more)
{
const auto current_size = incoming_data_buffer.size();
incoming_data_buffer.resize(incoming_data_buffer.size() + CHUNK_SIZE, 0);
// we don't have a result yet, so continue reading
TCP_socket.async_read_some(
boost::asio::buffer(incoming_data_buffer.data() + current_size, CHUNK_SIZE),
boost::bind(&Connection::handle_read,
this->shared_from_this(),
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred));
TCP_socket.async_read_some(boost::asio::buffer(incoming_data_buffer),
boost::bind(&Connection::handle_read,
this->shared_from_this(),
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred));
}
else
{
@@ -193,8 +183,7 @@ void Connection::handle_write(const boost::system::error_code &error)
current_request = http::request();
current_reply = http::reply();
http_request_parser.emplace();
http_request_parser->header_limit(std::numeric_limits<std::uint32_t>::max());
incoming_data_buffer.resize(CHUNK_SIZE, 0);
incoming_data_buffer = boost::array<char, 8192>();
output_buffer.clear();
this->start();
}
+11 -2
View File
@@ -583,8 +583,17 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector<extractor::EdgeBasedEdge> &e
[&] { extractor::files::readNodeData(config.GetPath(".osrm.ebg_nodes"), node_data); },
[&] {
extractor::files::readTurnWeightPenalty(
config.GetPath(".osrm.turn_weight_penalties"), turn_weight_penalties);
// we are going to overwrite this `.turn_weight_penalties` afterwards,
// so here we backup the original turn penalties if we didn't do that yet in order
// to guarantee that subsequent runs of this code will work on top of original
// weights
auto path = config.GetPath(".osrm.turn_weight_penalties").string() + ".original";
if (!boost::filesystem::exists(path))
{
boost::filesystem::copy_file(config.GetPath(".osrm.turn_weight_penalties"),
path);
}
extractor::files::readTurnWeightPenalty(path, turn_weight_penalties);
},
[&] {
extractor::files::readTurnDurationPenalty(
-78
View File
@@ -1,78 +0,0 @@
# Conan automatically generated toolchain file
# DO NOT EDIT MANUALLY, it will be overwritten
# Avoid including toolchain file several times (bad if appending to variables like
# CMAKE_CXX_FLAGS. See https://github.com/android/ndk/issues/323
include_guard()
message(STATUS "Using Conan toolchain: ${CMAKE_CURRENT_LIST_FILE}")
if(${CMAKE_VERSION} VERSION_LESS "3.15")
message(FATAL_ERROR "The 'CMakeToolchain' generator only works with CMake >= 3.15")
endif()
# Extra c, cxx, linkflags and defines
if(DEFINED CONAN_CXX_FLAGS)
string(APPEND CMAKE_CXX_FLAGS_INIT " ${CONAN_CXX_FLAGS}")
endif()
if(DEFINED CONAN_C_FLAGS)
string(APPEND CMAKE_C_FLAGS_INIT " ${CONAN_C_FLAGS}")
endif()
if(DEFINED CONAN_SHARED_LINKER_FLAGS)
string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " ${CONAN_SHARED_LINKER_FLAGS}")
endif()
if(DEFINED CONAN_EXE_LINKER_FLAGS)
string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${CONAN_EXE_LINKER_FLAGS}")
endif()
get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
if(_CMAKE_IN_TRY_COMPILE)
message(STATUS "Running toolchain IN_TRY_COMPILE")
return()
endif()
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
# Definition of CMAKE_MODULE_PATH
# the generators folder (where conan generates files, like this toolchain)
list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
# Definition of CMAKE_PREFIX_PATH, CMAKE_XXXXX_PATH
# The Conan local "generators" folder, where this toolchain is saved.
list(PREPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_LIST_DIR} )
message(STATUS "Conan toolchain: Setting BUILD_SHARED_LIBS = ON")
set(BUILD_SHARED_LIBS ON)
set(CMAKE_INSTALL_PREFIX "/home/runner/.conan/data/onetbb/2021.3.0/_/_/package/a36e366b2b0ea0e76bafba6092e0a74838fad5fd")
set(CMAKE_INSTALL_BINDIR "bin")
set(CMAKE_INSTALL_SBINDIR "bin")
set(CMAKE_INSTALL_LIBEXECDIR "bin")
set(CMAKE_INSTALL_LIBDIR "lib")
set(CMAKE_INSTALL_INCLUDEDIR "include")
set(CMAKE_INSTALL_OLDINCLUDEDIR "include")
set(CMAKE_SYSTEM_PROCESSOR "aarch64")
# Variables
set(TBB_TEST OFF CACHE BOOL "Variable TBB_TEST conan-toolchain defined")
set(TBB_STRICT OFF CACHE BOOL "Variable TBB_STRICT conan-toolchain defined")
# Variables per configuration
# Preprocessor definitions
# Preprocessor definitions per configuration