From c204360aa0959f16ce147391b485b73d09c6ea6c Mon Sep 17 00:00:00 2001 From: Michael Bell Date: Thu, 25 Aug 2022 17:49:35 +0100 Subject: [PATCH] Fix HTTP compression precedence (#6331) There is a bug in the deflate compression. Therefore, we do not want to select this in the default choice for HTTP response compression. Instead we revert back to the previous precedence, selecting gzip as the priority. --- CHANGELOG.md | 1 + src/server/connection.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dd58e3af..e31e267ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - CHANGED: Add `data_version` field to responses of all services. [#5387](https://github.com/Project-OSRM/osrm-backend/pull/5387) - FIXED: Use Boost.Beast to parse HTTP request. [#6294](https://github.com/Project-OSRM/osrm-backend/pull/6294) - FIXED: Fix inefficient osrm-routed connection handling [#6113](https://github.com/Project-OSRM/osrm-backend/pull/6113) + - FIXED: Fix HTTP compression precedence [#6113](https://github.com/Project-OSRM/osrm-backend/pull/6113) - NodeJS: - FIXED: Support `skip_waypoints` in Node bindings [#6060](https://github.com/Project-OSRM/osrm-backend/pull/6060) - Misc: diff --git a/src/server/connection.cpp b/src/server/connection.cpp index 6ba5ed242..a9800ed83 100644 --- a/src/server/connection.cpp +++ b/src/server/connection.cpp @@ -27,14 +27,14 @@ http::compression_type select_compression(const boost::beast::http::fields &fiel { const auto header_value = fields[boost::beast::http::field::accept_encoding]; /* giving gzip precedence over deflate */ - if (boost::icontains(header_value, "deflate")) - { - return http::deflate_rfc1951; - } if (boost::icontains(header_value, "gzip")) { return http::gzip_rfc1952; } + if (boost::icontains(header_value, "deflate")) + { + return http::deflate_rfc1951; + } return http::no_compression; }