Fix bug with large HTTP requests in osrm-routed
This commit is contained in:
parent
16b8a58fe0
commit
66b73866f8
@ -1,5 +1,7 @@
|
||||
# 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)
|
||||
|
||||
|
||||
@ -12,7 +12,8 @@ namespace osrm
|
||||
namespace server
|
||||
{
|
||||
|
||||
namespace {
|
||||
namespace
|
||||
{
|
||||
const size_t CHUNK_SIZE = 8192;
|
||||
|
||||
} // namespace
|
||||
@ -64,7 +65,8 @@ 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)
|
||||
{
|
||||
@ -95,11 +97,12 @@ void Connection::handle_read(const boost::system::error_code &error, std::size_t
|
||||
const auto current_size = incoming_data_buffer.size();
|
||||
incoming_data_buffer.resize(incoming_data_buffer.size() + CHUNK_SIZE);
|
||||
// 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.data() + current_size, CHUNK_SIZE),
|
||||
boost::bind(&Connection::handle_read,
|
||||
this->shared_from_this(),
|
||||
boost::asio::placeholders::error,
|
||||
boost::asio::placeholders::bytes_transferred));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user