Skip to content

Commit bd559af

Browse files
authored
Moved minimal libmicrohttpd dep to v0.9.74 (#259)
This resolves the warnings on deprecated collections. * http_utils: Remove 'http_unordered_collection' That HTTP status code was removed from RFC and marked deprecated in libmicrohttpd from v0.9.64 onwards. MHD throws a deprecation warning now when using MHD_HTTP_UNORDERED_COLLECTION, leading to build failures if -Werror is set (as with libhttpserver debug builds). Fixes: #176 Suggested-by: Sebastiano Merlino <electrictwister2000@gmail.com> Signed-off-by: Alexander Dahl <ada@thorsis.com> * http_utils: Redefine deprecated MHD definitions libmicrohttpd deprecated those two definitions, and replaced them with new ones for the same numeric codes with version v0.9.74. Compiler throws a warning when using those definitions in libhttpserver, and thus debug build fails due to -Werror. Fixes: #258 Signed-off-by: Alexander Dahl <ada@thorsis.com> * Bump libmicrohttpd for CI builds We are about to update the minimal required version of libmicrohttpd to 0.9.64 and depend on that in configure.ac and CI should not fail then. * github: codeql: Move building libmicrohttpd before analyze init Previously analyze init came before building libmicrohttpd which let CodeQL analyze libmicrohttpd as well. Since libmicrohttpd is not under our control, each change in that could introduce distracting analyze warnings/errors. Apparently CodeQL analyzes everything built after that init step for compiled languages. Moving dependencies before init seems to solve that. * Bump libmicrohttpd required version to 0.9.64 libmicrohttpd deprecated the definition of MHD_HTTP_UNORDERED_COLLECTION with 0.9.64 without alternative. Thus `http_utils::http_unordered_collection` was removed from libhttpserver and the requirement bump reflects those changes. Goal is to get rid of the deprecation warnings reported with #176 and #258. libmicrohttpd 0.9.64 was released in June 2019 (2019-06-09), almost three years ago.
1 parent 6e58cd0 commit bd559af

File tree

7 files changed

+31
-27
lines changed

7 files changed

+31
-27
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ jobs:
3636
- run: git checkout HEAD^2
3737
if: ${{ github.event_name == 'pull_request' }}
3838

39+
- name: Install libmicrohttpd dependency
40+
run: |
41+
curl https://s3.amazonaws.com/libhttpserver/libmicrohttpd_releases/libmicrohttpd-0.9.64.tar.gz -o libmicrohttpd-0.9.64.tar.gz ;
42+
tar -xzf libmicrohttpd-0.9.64.tar.gz ;
43+
cd libmicrohttpd-0.9.64 ;
44+
./configure --disable-examples ;
45+
make ;
46+
sudo make install ;
47+
3948
# Initializes the CodeQL tools for scanning.
4049
- name: Initialize CodeQL
4150
uses: github/codeql-action/init@v1
@@ -54,20 +63,11 @@ jobs:
5463
# and modify them (or add more) to build your code if your project
5564
# uses a compiled language
5665

57-
- name: Install libmicrohttpd dependency
58-
run: |
59-
curl https://s3.amazonaws.com/libhttpserver/libmicrohttpd_releases/libmicrohttpd-0.9.59.tar.gz -o libmicrohttpd-0.9.59.tar.gz ;
60-
tar -xzf libmicrohttpd-0.9.59.tar.gz ;
61-
cd libmicrohttpd-0.9.59 ;
62-
./configure --disable-examples ;
63-
make ;
64-
sudo make install ;
65-
6666
- name: Manual steps to build the library
6767
run: |
6868
./bootstrap ;
6969
./configure --enable-same-directory-build;
7070
make ;
71-
71+
7272
- name: Perform CodeQL Analysis
7373
uses: github/codeql-action/analyze@v1

.github/workflows/verify-build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -396,20 +396,20 @@ jobs:
396396
id: cache-libmicrohttpd
397397
uses: actions/cache@v2
398398
with:
399-
path: libmicrohttpd-0.9.59
399+
path: libmicrohttpd-0.9.64
400400
key: ${{ matrix.os }}-${{ matrix.c-compiler }}-libmicrohttpd-pre-built
401401

402402
- name: Build libmicrohttpd dependency (if not cached)
403403
run: |
404-
curl https://s3.amazonaws.com/libhttpserver/libmicrohttpd_releases/libmicrohttpd-0.9.59.tar.gz -o libmicrohttpd-0.9.59.tar.gz ;
405-
tar -xzf libmicrohttpd-0.9.59.tar.gz ;
406-
cd libmicrohttpd-0.9.59 ;
404+
curl https://s3.amazonaws.com/libhttpserver/libmicrohttpd_releases/libmicrohttpd-0.9.64.tar.gz -o libmicrohttpd-0.9.64.tar.gz ;
405+
tar -xzf libmicrohttpd-0.9.64.tar.gz ;
406+
cd libmicrohttpd-0.9.64 ;
407407
./configure --disable-examples ;
408408
make ;
409409
if: steps.cache-libmicrohttpd.outputs.cache-hit != 'true'
410410

411411
- name: Install libmicrohttpd
412-
run: cd libmicrohttpd-0.9.59 ; sudo make install ;
412+
run: cd libmicrohttpd-0.9.64 ; sudo make install ;
413413

414414
- name: Refresh links to shared libs
415415
run: sudo ldconfig ;

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ libhttpserver can be used without any dependencies aside from libmicrohttpd.
7979

8080
The minimum versions required are:
8181
* g++ >= 5.5.0 or clang-3.6
82-
* libmicrohttpd >= 0.9.53
82+
* libmicrohttpd >= 0.9.64
8383
* [Optionally]: for TLS (HTTPS) support, you'll need [libgnutls](http://www.gnutls.org/).
8484
* [Optionally]: to compile the code-reference, you'll need [doxygen](http://www.doxygen.nl/).
8585

appveyor.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ init:
1717
install:
1818
- 'if "%compiler%"=="msys2" C:\msys64\msys2_shell.cmd -defterm -no-start -msys2 -c "pacman --noconfirm -S --needed mingw-w64-$MSYS2_ARCH-{libtool,make,pkg-config,libsystre,doxygen,gnutls,graphviz,curl}"'
1919
- 'if "%compiler%"=="msys2" C:\msys64\msys2_shell.cmd -defterm -no-start -msys2 -c "pacman --noconfirm -S --needed autotools"'
20-
- 'if "%compiler%"=="msys2" C:\msys64\msys2_shell.cmd -defterm -no-start -mingw64 -full-path -here -c "cd $APPVEYOR_BUILD_FOLDER && curl https://s3.amazonaws.com/libhttpserver/libmicrohttpd_releases/libmicrohttpd-0.9.59.tar.gz -o libmicrohttpd-0.9.59.tar.gz"'
21-
- 'if "%compiler%"=="msys2" C:\msys64\msys2_shell.cmd -defterm -no-start -mingw64 -full-path -here -c "cd $APPVEYOR_BUILD_FOLDER && tar -xzf libmicrohttpd-0.9.59.tar.gz"'
22-
- 'if "%compiler%"=="msys2" C:\msys64\msys2_shell.cmd -defterm -no-start -mingw64 -full-path -here -c "cd $APPVEYOR_BUILD_FOLDER/libmicrohttpd-0.9.59 && ./configure --disable-examples --enable-poll=no --prefix /C/msys64 && make && make install"'
20+
- 'if "%compiler%"=="msys2" C:\msys64\msys2_shell.cmd -defterm -no-start -mingw64 -full-path -here -c "cd $APPVEYOR_BUILD_FOLDER && curl https://s3.amazonaws.com/libhttpserver/libmicrohttpd_releases/libmicrohttpd-0.9.64.tar.gz -o libmicrohttpd-0.9.64.tar.gz"'
21+
- 'if "%compiler%"=="msys2" C:\msys64\msys2_shell.cmd -defterm -no-start -mingw64 -full-path -here -c "cd $APPVEYOR_BUILD_FOLDER && tar -xzf libmicrohttpd-0.9.64.tar.gz"'
22+
- 'if "%compiler%"=="msys2" C:\msys64\msys2_shell.cmd -defterm -no-start -mingw64 -full-path -here -c "cd $APPVEYOR_BUILD_FOLDER/libmicrohttpd-0.9.64 && ./configure --disable-examples --enable-poll=no --prefix /C/msys64 && make && make install"'
2323
- 'if "%compiler%"=="msys2" C:\msys64\msys2_shell.cmd -defterm -no-start -mingw64 -full-path -here -c "cd $APPVEYOR_BUILD_FOLDER && ./bootstrap"'
2424
- 'if "%compiler%"=="msys2" C:\msys64\msys2_shell.cmd -defterm -no-start -mingw64 -full-path -here -c "cd $APPVEYOR_BUILD_FOLDER && mkdir build && cd build && MANIFEST_TOOL=no; ../configure --disable-fastopen --prefix /C/msys64 CXXFLAGS=-I/C/msys64/include LDFLAGS=-L/C/msys64/lib; make"'
2525
build_script:

configure.ac

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,17 @@ AC_CHECK_HEADER([gnutls/gnutls.h],[have_gnutls="yes"],[AC_MSG_WARN("gnutls/gnutl
100100
if test x"$host" = x"$build"; then
101101
AC_CHECK_HEADER([microhttpd.h],
102102
AC_CHECK_LIB([microhttpd], [MHD_get_fdset2],
103-
[AC_MSG_CHECKING([for libmicrohttpd >= 0.9.53])
103+
[AC_MSG_CHECKING([for libmicrohttpd >= 0.9.64])
104104
AC_COMPILE_IFELSE(
105105
[AC_LANG_SOURCE([
106106
#include <microhttpd.h>
107-
#if (MHD_VERSION < 0x00095300)
108-
#error needs at least version 0.9.53
107+
#if (MHD_VERSION < 0x00096400)
108+
#error needs at least version 0.9.64
109109
#endif
110110
int main () { return 0; }
111111
])],
112112
[],
113-
[AC_MSG_ERROR("libmicrohttpd is too old - install libmicrohttpd >= 0.9.53")]
113+
[AC_MSG_ERROR("libmicrohttpd is too old - install libmicrohttpd >= 0.9.64")]
114114
)
115115
],
116116
[AC_MSG_ERROR(["libmicrohttpd not found"])]

src/http_utils.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ typedef unsigned char u_char;
6161

6262
#endif // CYGWIN
6363

64+
// libmicrohttpd deprecated some definitions with v0.9.74, and introduced new ones
65+
#if MHD_VERSION < 0x00097314
66+
#define MHD_HTTP_CONTENT_TOO_LARGE MHD_HTTP_PAYLOAD_TOO_LARGE
67+
#define MHD_HTTP_UNPROCESSABLE_CONTENT MHD_HTTP_UNPROCESSABLE_ENTITY
68+
#endif
69+
6470
namespace httpserver {
6571
namespace http {
6672

@@ -101,15 +107,14 @@ const int http_utils::http_conflict = MHD_HTTP_CONFLICT;
101107
const int http_utils::http_gone = MHD_HTTP_GONE;
102108
const int http_utils::http_length_required = MHD_HTTP_LENGTH_REQUIRED;
103109
const int http_utils::http_precondition_failed = MHD_HTTP_PRECONDITION_FAILED;
104-
const int http_utils::http_request_entity_too_large = MHD_HTTP_PAYLOAD_TOO_LARGE;
110+
const int http_utils::http_request_entity_too_large = MHD_HTTP_CONTENT_TOO_LARGE;
105111
const int http_utils::http_request_uri_too_long = MHD_HTTP_URI_TOO_LONG;
106112
const int http_utils::http_unsupported_media_type = MHD_HTTP_UNSUPPORTED_MEDIA_TYPE;
107113
const int http_utils::http_requested_range_not_satisfiable = MHD_HTTP_RANGE_NOT_SATISFIABLE;
108114
const int http_utils::http_expectation_failed = MHD_HTTP_EXPECTATION_FAILED;
109-
const int http_utils::http_unprocessable_entity = MHD_HTTP_UNPROCESSABLE_ENTITY;
115+
const int http_utils::http_unprocessable_entity = MHD_HTTP_UNPROCESSABLE_CONTENT;
110116
const int http_utils::http_locked = MHD_HTTP_LOCKED;
111117
const int http_utils::http_failed_dependency = MHD_HTTP_FAILED_DEPENDENCY;
112-
const int http_utils::http_unordered_collection = MHD_HTTP_UNORDERED_COLLECTION;
113118
const int http_utils::http_upgrade_required = MHD_HTTP_UPGRADE_REQUIRED;
114119
const int http_utils::http_retry_with = MHD_HTTP_RETRY_WITH;
115120

src/httpserver/http_utils.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ class http_utils {
150150
static const int http_unprocessable_entity;
151151
static const int http_locked;
152152
static const int http_failed_dependency;
153-
static const int http_unordered_collection;
154153
static const int http_upgrade_required;
155154
static const int http_retry_with;
156155

0 commit comments

Comments
 (0)