From 05365beaeaa0546fff9e38136811edb846ec74a5 Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Sat, 7 Mar 2020 21:00:02 -0800 Subject: [PATCH 01/30] Force windows build Remove windows from the list of OS to avoid matrix creation. Remove windows from the exclusion list (which seems to have reversed priority with include). Left windows as explicit inclusion --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0971f0e3..a299d749 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ language: cpp os: - linux - osx - - windows compiler: - gcc - clang @@ -156,7 +155,6 @@ matrix: exclude: - compiler: clang env: DEBUG="debug" COVERAGE="coverage" - - os: windows include: - os: windows env: DEBUG="nodebug" COVERAGE="nocoverage" YARN_GPG=no From a2c17d57a55ddd22e2ae1c4bffe08a3d98f9a9b1 Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Sat, 7 Mar 2020 21:43:27 -0800 Subject: [PATCH 02/30] Temporarily reverting the re-ordering of includes This to test whether this is the reason for the missing inet_ntop on windows builds --- src/http_utils.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/http_utils.cpp b/src/http_utils.cpp index ae577a9c..3b25904f 100644 --- a/src/http_utils.cpp +++ b/src/http_utils.cpp @@ -18,8 +18,9 @@ USA */ -#include "httpserver/http_utils.hpp" - +#include +#include +#include #if defined(__MINGW32__) || defined(__CYGWIN32__) #define _WINDOWS #undef _WIN32_WINNT @@ -31,17 +32,15 @@ #include #include #endif - -#include -#include -#include -#include +#include #include +#include #include -#include + #include #include "httpserver/string_utilities.hpp" +#include "httpserver/http_utils.hpp" #pragma GCC diagnostic ignored "-Warray-bounds" #define CHECK_BIT(var,pos) ((var) & (1<<(pos))) From 60a2e4577bc830829955d5123c0f6c0d9ff7c18e Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Sun, 8 Mar 2020 06:16:43 -0700 Subject: [PATCH 03/30] Moving back http_utils to be the first include This respects the ordering of the libraries we have just established --- src/http_utils.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/http_utils.cpp b/src/http_utils.cpp index 3b25904f..728bde6e 100644 --- a/src/http_utils.cpp +++ b/src/http_utils.cpp @@ -18,6 +18,8 @@ USA */ +#include "httpserver/http_utils.hpp" + #include #include #include @@ -40,7 +42,6 @@ #include #include "httpserver/string_utilities.hpp" -#include "httpserver/http_utils.hpp" #pragma GCC diagnostic ignored "-Warray-bounds" #define CHECK_BIT(var,pos) ((var) & (1<<(pos))) From a84933c8d3e9d3bcd55a368750f8e90e50416563 Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Sun, 8 Mar 2020 07:16:51 -0700 Subject: [PATCH 04/30] Forcing libmicro on _WIN32_WINNT 0x600 --- src/httpserver/http_utils.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/httpserver/http_utils.hpp b/src/httpserver/http_utils.hpp index fdfe48e0..9b22ea97 100644 --- a/src/httpserver/http_utils.hpp +++ b/src/httpserver/http_utils.hpp @@ -28,6 +28,15 @@ #ifdef HAVE_GNUTLS #include #endif + +// needed to force Vista as a bare minimum to have inet_ntop (libmicro defines +// this to include XP support as a lower version). +#if defined(__MINGW32__) || defined(__CYGWIN32__) +#define _WINDOWS +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x600 +#endif + #include #include #include From d7d788db2da52bb0e7e8a143ada4f154948ff857 Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Sun, 8 Mar 2020 07:19:14 -0700 Subject: [PATCH 05/30] Re-establishing the correct order of inclusion --- src/http_utils.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/http_utils.cpp b/src/http_utils.cpp index 728bde6e..fe9f2ab4 100644 --- a/src/http_utils.cpp +++ b/src/http_utils.cpp @@ -20,13 +20,7 @@ #include "httpserver/http_utils.hpp" -#include -#include -#include #if defined(__MINGW32__) || defined(__CYGWIN32__) -#define _WINDOWS -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x600 #include #include #else @@ -34,11 +28,14 @@ #include #include #endif -#include + +#include +#include +#include #include #include #include - +#include #include #include "httpserver/string_utilities.hpp" From d76ea70375666daf49819f7e46547f14ec4f2e94 Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Sun, 8 Mar 2020 08:15:03 -0700 Subject: [PATCH 06/30] Standardize msys2 installation Use the recommended way from travis: https://docs.travis-ci.com/user/reference/windows/#how-do-i-use-msys2 --- .travis.yml | 90 +++++++++++++++++++++++++++-------------------------- 1 file changed, 46 insertions(+), 44 deletions(-) diff --git a/.travis.yml b/.travis.yml index a299d749..c62e28e6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,18 @@ env: - DEBUG="debug" COVERAGE="coverage" - DEBUG="nodebug" COVERAGE="nocoverage" - LINKING="static" +before_cache: +- |- + case $TRAVIS_OS_NAME in + windows) + # https://unix.stackexchange.com/a/137322/107554 + $msys2 pacman --sync --clean --noconfirm + ;; + esac +cache: + directories: + - $HOME/AppData/Local/Temp/chocolatey + - /C/tools/msys64 before_install: - ps -ef - if [ "$TRAVIS_OS_NAME" = "windows" ]; then ps -Wla | sort ; fi @@ -17,42 +29,43 @@ before_install: - if [ "$TRAVIS_OS_NAME" != "windows" ]; then export PATH=$PATH:/usr/local/lib; fi - if [ "$TRAVIS_OS_NAME" != "windows" ]; then export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib; fi - if [ "$TRAVIS_OS_NAME" != "windows" ]; then export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/usr/local/lib; fi + - if [ "$TRAVIS_OS_NAME" != "windows" ]; then export buildshell=''; fi - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get install info install-info; fi - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo pip install codecov; fi - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo pip install gcovr; fi - if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get install cppcheck; fi - if [ "$TRAVIS_OS_NAME" = "osx" ]; then export CFLAGS='-mtune=generic'; fi - - if [ "$TRAVIS_OS_NAME" = "windows" ]; then choco install -r --no-progress -y msys2 make; fi - - if [ "$TRAVIS_OS_NAME" = "windows" ]; then PATH=$PATH:/c/tools/msys64/usr/bin/ ; fi - - if [ "$TRAVIS_OS_NAME" = "windows" ]; then powershell -executionpolicy bypass "pacman -Syu --noconfirm autoconf libtool automake make autoconf-archive pkg-config mingw-w64-x86_64-libsystre" ; fi - - if [ "$TRAVIS_OS_NAME" = "windows" ]; then - ln -s /c/tools/msys64/usr/share/autoconf* /usr/share/ ; - ln -s /c/tools/msys64/usr/share/automake* /usr/share/ ; - ln -s /c/tools/msys64/usr/share/aclocal* /usr/share/ ; - ln -s /c/tools/msys64/usr/share/libtool* /usr/share/ ; - ln -s /c/tools/msys64/usr/share/pkgconfig /usr/share/ ; - ln -s /c/tools/msys64/usr/bin/autom4te /usr/bin/ ; - ln -s /c/tools/msys64/usr/bin/autoconf /usr/bin/ ; - ln -s /c/tools/msys64/usr/bin/autoheader /usr/bin/ ; - ln -s /c/tools/msys64/usr/bin/m4 /usr/bin/ ; - - PATH=$PATH:/c/tools/msys64/usr/bin/ ; - export SHELL=/usr/bin/sh.exe ; - fi + - |- + case $TRAVIS_OS_NAME in + windows) + [[ ! -f C:/tools/msys64/msys2_shell.cmd ]] && rm -rf C:/tools/msys64 + choco uninstall -y mingw + choco upgrade --no-progress -y msys2 + export msys2='cmd //C RefreshEnv.cmd ' + export msys2+='& set MSYS=winsymlinks:nativestrict ' + export msys2+='& C:\\tools\\msys64\\msys2_shell.cmd -defterm -no-start' + export buildshell="$msys2 -mingw64 -full-path -here -c "\"\$@"\" --" + export msys2+=" -msys2 -c "\"\$@"\" --" + $msys2 pacman --sync --noconfirm --needed mingw-w64-x86_64-toolchain + $msys2 pacman -Syu --noconfirm autoconf libtool automake make autoconf-archive pkg-config mingw-w64-x86_64-libsystre + ## Install more MSYS2 packages from https://packages.msys2.org/base here + taskkill //IM gpg-agent.exe //F # https://travis-ci.community/t/4967 + export PATH=/C/tools/msys64/mingw64/bin:$PATH + export MAKE=mingw32-make # so that Autotools can find it + ;; + esac - curl https://s3.amazonaws.com/libhttpserver/libmicrohttpd_releases/libmicrohttpd-0.9.59.tar.gz -o libmicrohttpd-0.9.59.tar.gz - tar -xzf libmicrohttpd-0.9.59.tar.gz - cd libmicrohttpd-0.9.59 - if [[ "$ARM_ARCH_DIR" != "" ]]; then ./configure --build `./config.guess` --host $ARM_ARCH_DIR --disable-examples; elif [[ "$TRAVIS_OS_NAME" = "windows" ]]; then - ./configure --prefix=/usr --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --disable-examples --disable-https --enable-shared --enable-static ; + $buildshell ./configure --prefix=/usr --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --disable-examples --disable-https --enable-shared --enable-static ; else ./configure --disable-examples; fi - - if [ "$TRAVIS_OS_NAME" = "windows" ]; then find . -name Makefile -type f -exec sed -i "s/\${SHELL}/\/usr\/bin\/sh.exe/" "{}" + ; fi - - if [ "$TRAVIS_OS_NAME" = "windows" ]; then find . -name Makefile -type f -exec sed -i "s/\$(SHELL)/\/usr\/bin\/sh.exe/" "{}" + ; fi - - make - - if [ "$TRAVIS_OS_NAME" = "windows" ]; then make install; else sudo make install; fi + - $buildshell make + - $buildshell make install - cd .. - if [ "$BUILD_TYPE" = "asan" ]; then export CFLAGS='-fsanitize=address'; export CXXLAGS='-fsanitize=address'; export LDFLAGS='-fsanitize=address'; fi - if [ "$BUILD_TYPE" = "msan" ]; then export CFLAGS='-fsanitize=memory'; export CXXLAGS='-fsanitize=memory'; export LDFLAGS='-fsanitize=memory'; fi @@ -74,29 +87,25 @@ install: - mkdir build - cd build - if [ "$TRAVIS_OS_NAME" = "windows" ]; then - ../configure --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --disable-fastopen --disable-examples CPPFLAGS='-I/c/tools/msys64/mingw64/include/ -I/usr/include/' LDFLAGS='-L/c/tools/msys64/mingw64/lib -L/usr/lib/' ; - cd .. ; - find . -name Makefile -type f -exec sed -i "s/\$(SHELL)/\/usr\/bin\/sh.exe/" "{}" + ; - cd build ; + $buildshell ../configure --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --disable-fastopen --disable-examples CPPFLAGS='-I/c/tools/msys64/mingw64/include/ -I/usr/include/' LDFLAGS='-L/c/tools/msys64/mingw64/lib -L/usr/lib/' ; elif [ "$LINKING" = "static" ]; then - ../configure --enable-static --disable-fastopen; + $buildshell ../configure --enable-static --disable-fastopen; elif [ "$DEBUG" = "debug" ] && [ "$COVERAGE" = "coverage" ]; then - ../configure --enable-debug --enable-coverage --disable-shared --disable-fastopen; + $buildshell ../configure --enable-debug --enable-coverage --disable-shared --disable-fastopen; elif [ "$DEBUG" = "debug" ]; then - ../configure --enable-debug --disable-shared --disable-fastopen; + $buildshell ../configure --enable-debug --disable-shared --disable-fastopen; elif [ "$CROSS_COMPILE" = "1" ] && [ "$ARM_ARCH_DIR" = "aarch64-linux-gnu" ]; then - ../configure --disable-fastopen --build `../config.guess` --host aarch64-linux-gnu CC="gcc -B$HOME/linker_bin" CXX="g++ -B$HOME/linker_bin"; + $buildshell ../configure --disable-fastopen --build `../config.guess` --host aarch64-linux-gnu CC="gcc -B$HOME/linker_bin" CXX="g++ -B$HOME/linker_bin"; elif [ "$CROSS_COMPILE" = "1" ] && [ "$ARM_ARCH_DIR" = "arm-linux-gnueabi" ]; then - ../configure --disable-fastopen --build `../config.guess` --host arm-linux-gnueabi; + $buildshell ../configure --disable-fastopen --build `../config.guess` --host arm-linux-gnueabi; elif [ "$VALGRIND" = "valgrind" ]; then - ../configure --enable-debug --disable-fastopen --disable-valgrind-helgrind --disable-valgrind-drd --disable-valgrind-sgcheck; + $buildshell ../configure --enable-debug --disable-fastopen --disable-valgrind-helgrind --disable-valgrind-drd --disable-valgrind-sgcheck; else - ../configure --disable-fastopen; + $buildshell ../configure --disable-fastopen; fi - if [ "$CROSS_COMPILE" = "1" ] && [ "$ARM_ARCH_DIR" = "aarch64-linux-gnu" ]; then sed -i 's+/usr/bin/ld+$HOME/linker_bin/ld+g' libtool; fi - if [ "$CROSS_COMPILE" = "1" ] && [ "$ARM_ARCH_DIR" = "aarch64-linux-gnu" ]; then sed -i 's+/usr/bin/ld+$HOME/linker_bin/ld+g' Makefile; fi - - make - - if [ "$TRAVIS_OS_NAME" != "windows" ]; then make check TESTS= ; fi + - $buildshell make script: - ps -ef - if [[ "$CROSS_COMPILE" == 1 ]]; then @@ -119,8 +128,8 @@ script: qemu-arm -L /usr/arm-linux-gnueabi/ ./.libs/threaded ; fi fi - - if [ "$TRAVIS_OS_NAME" != "windows" ]; then make check ; fi - - if [ "$TRAVIS_OS_NAME" != "windows" ]; then cat test/test-suite.log; fi + - $buildshell make check + - $buildshell cat test/test-suite.log - if [ "$VALGRIND" = "valgrind" ]; then make check-valgrind; fi; - if [ "$VALGRIND" = "valgrind" ]; then cat test/test-suite-memcheck.log; fi; - if [ "$TRAVIS_OS_NAME" = "linux" ]; then cd ../src/; cppcheck --error-exitcode=1 .; cd ../build; fi @@ -142,13 +151,6 @@ script: ./benchmark_threads 8080 & sleep 5 && ab -n 10000000 -c 100 localhost:8080/plaintext fi -after_script: - - ps -ef - - if [ "$TRAVIS_OS_NAME" = "windows" ]; then ps -Wla | sort ; fi - - if [ "$TRAVIS_OS_NAME" = "windows" ]; then gpgconf --kill gpg-agent ; fi - - if [ "$TRAVIS_OS_NAME" = "windows" ]; then taskkill //F //PID $(ps -Wla | tr -s ' ' | grep gpg | cut -f2 -d' ') ; fi - - if [ "$TRAVIS_OS_NAME" = "windows" ]; then ps -Wla | sort ; fi - - echo $$ after_success: - if [ "$DEBUG" = "debug" ] && [ "$COVERAGE" = "coverage" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then bash <(curl -s https://codecov.io/bash); fi matrix: From bf7b5aafc3431d68234f9ec4ef36b1b7fd684409 Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Sun, 8 Mar 2020 08:24:06 -0700 Subject: [PATCH 07/30] Further simplify the windows build Eliminate additional differences between linux and windows builds. --- .travis.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index c62e28e6..c51fc1fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,8 +22,6 @@ cache: - $HOME/AppData/Local/Temp/chocolatey - /C/tools/msys64 before_install: - - ps -ef - - if [ "$TRAVIS_OS_NAME" = "windows" ]; then ps -Wla | sort ; fi - eval "${MATRIX_EVAL}" - if [ "$TRAVIS_OS_NAME" != "windows" ]; then export LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/lib"; fi - if [ "$TRAVIS_OS_NAME" != "windows" ]; then export PATH=$PATH:/usr/local/lib; fi @@ -59,10 +57,8 @@ before_install: - cd libmicrohttpd-0.9.59 - if [[ "$ARM_ARCH_DIR" != "" ]]; then ./configure --build `./config.guess` --host $ARM_ARCH_DIR --disable-examples; - elif [[ "$TRAVIS_OS_NAME" = "windows" ]]; then - $buildshell ./configure --prefix=/usr --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --disable-examples --disable-https --enable-shared --enable-static ; else - ./configure --disable-examples; + $buildshell ./configure --disable-examples; fi - $buildshell make - $buildshell make install @@ -83,7 +79,7 @@ install: ls -al $HOME/linker_bin/ld ; fi fi - - ./bootstrap + - $buildshell ./bootstrap - mkdir build - cd build - if [ "$TRAVIS_OS_NAME" = "windows" ]; then @@ -107,7 +103,6 @@ install: - if [ "$CROSS_COMPILE" = "1" ] && [ "$ARM_ARCH_DIR" = "aarch64-linux-gnu" ]; then sed -i 's+/usr/bin/ld+$HOME/linker_bin/ld+g' Makefile; fi - $buildshell make script: - - ps -ef - if [[ "$CROSS_COMPILE" == 1 ]]; then cd test ; if [[ "$ARM_ARCH_DIR" == "aarch64-linux-gnu" ]]; then From 479736bd07e30e414bcf5a1b78e8b18d759d421c Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Sun, 8 Mar 2020 08:26:15 -0700 Subject: [PATCH 08/30] Remove windows-specific configure Rely on the same configuration used on other systems. --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index c51fc1fe..3466e4eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -82,9 +82,7 @@ install: - $buildshell ./bootstrap - mkdir build - cd build - - if [ "$TRAVIS_OS_NAME" = "windows" ]; then - $buildshell ../configure --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --disable-fastopen --disable-examples CPPFLAGS='-I/c/tools/msys64/mingw64/include/ -I/usr/include/' LDFLAGS='-L/c/tools/msys64/mingw64/lib -L/usr/lib/' ; - elif [ "$LINKING" = "static" ]; then + - if [ "$LINKING" = "static" ]; then $buildshell ../configure --enable-static --disable-fastopen; elif [ "$DEBUG" = "debug" ] && [ "$COVERAGE" = "coverage" ]; then $buildshell ../configure --enable-debug --enable-coverage --disable-shared --disable-fastopen; From f6622f9900be6602947baba4e949c2965b4dc80d Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Sun, 8 Mar 2020 08:29:40 -0700 Subject: [PATCH 09/30] Add sudo to install on linux/mac --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3466e4eb..c8a00e2f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,7 +61,7 @@ before_install: $buildshell ./configure --disable-examples; fi - $buildshell make - - $buildshell make install + - if [ "$TRAVIS_OS_NAME" != "windows" ]; then sudo make install; else $buildshell make install; fi - cd .. - if [ "$BUILD_TYPE" = "asan" ]; then export CFLAGS='-fsanitize=address'; export CXXLAGS='-fsanitize=address'; export LDFLAGS='-fsanitize=address'; fi - if [ "$BUILD_TYPE" = "msan" ]; then export CFLAGS='-fsanitize=memory'; export CXXLAGS='-fsanitize=memory'; export LDFLAGS='-fsanitize=memory'; fi From 26207d1d7a91059bfbf81536fa17a351caead7ac Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Sun, 8 Mar 2020 09:22:14 -0700 Subject: [PATCH 10/30] Manually disable poll libmicrohttpd seems to be failing on mingw+msys2. It deduces poll is enabled but then misses definitions. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c8a00e2f..fee30a7f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -58,7 +58,7 @@ before_install: - if [[ "$ARM_ARCH_DIR" != "" ]]; then ./configure --build `./config.guess` --host $ARM_ARCH_DIR --disable-examples; else - $buildshell ./configure --disable-examples; + if [ "$TRAVIS_OS_NAME" != "windows" ]; then $buildshell ./configure --disable-examples; else $buildshell ./configure --disable-examples --enable-poll=no; fi; fi - $buildshell make - if [ "$TRAVIS_OS_NAME" != "windows" ]; then sudo make install; else $buildshell make install; fi From 4582476fe80b48fa545e48d786b0a974b72c44c0 Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Sun, 8 Mar 2020 14:40:08 -0700 Subject: [PATCH 11/30] Speed-up build by avoid timeouts --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index fee30a7f..a481d94f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,8 +44,8 @@ before_install: export msys2+='& C:\\tools\\msys64\\msys2_shell.cmd -defterm -no-start' export buildshell="$msys2 -mingw64 -full-path -here -c "\"\$@"\" --" export msys2+=" -msys2 -c "\"\$@"\" --" - $msys2 pacman --sync --noconfirm --needed mingw-w64-x86_64-toolchain - $msys2 pacman -Syu --noconfirm autoconf libtool automake make autoconf-archive pkg-config mingw-w64-x86_64-libsystre + $msys2 pacman --sync --noconfirm --disable-download-timeout --needed mingw-w64-x86_64-toolchain + $msys2 pacman -Syu --noconfirm --disable-download-timeout autoconf libtool automake make autoconf-archive pkg-config mingw-w64-x86_64-libsystre ## Install more MSYS2 packages from https://packages.msys2.org/base here taskkill //IM gpg-agent.exe //F # https://travis-ci.community/t/4967 export PATH=/C/tools/msys64/mingw64/bin:$PATH From e92de66ab6a4d9c67fa4cb224e5eb3356a09dde6 Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Sun, 8 Mar 2020 15:33:12 -0700 Subject: [PATCH 12/30] Kill GPG at the end of build --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a481d94f..4c661112 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,8 +46,6 @@ before_install: export msys2+=" -msys2 -c "\"\$@"\" --" $msys2 pacman --sync --noconfirm --disable-download-timeout --needed mingw-w64-x86_64-toolchain $msys2 pacman -Syu --noconfirm --disable-download-timeout autoconf libtool automake make autoconf-archive pkg-config mingw-w64-x86_64-libsystre - ## Install more MSYS2 packages from https://packages.msys2.org/base here - taskkill //IM gpg-agent.exe //F # https://travis-ci.community/t/4967 export PATH=/C/tools/msys64/mingw64/bin:$PATH export MAKE=mingw32-make # so that Autotools can find it ;; @@ -144,6 +142,8 @@ script: ./benchmark_threads 8080 & sleep 5 && ab -n 10000000 -c 100 localhost:8080/plaintext fi +after_script: + - if [ "$TRAVIS_OS_NAME" = "windows" ]; then taskkill //F //PID $(ps -Wla | tr -s ' ' | grep gpg | cut -f2 -d' ') ; fi after_success: - if [ "$DEBUG" = "debug" ] && [ "$COVERAGE" = "coverage" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then bash <(curl -s https://codecov.io/bash); fi matrix: From 80856572b775db927efbfa54a01c2b6da3316736 Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Sun, 8 Mar 2020 16:51:34 -0700 Subject: [PATCH 13/30] Printing out the configure file for debug --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 4c661112..15267b68 100644 --- a/.travis.yml +++ b/.travis.yml @@ -78,6 +78,7 @@ install: fi fi - $buildshell ./bootstrap + - if [ "$TRAVIS_OS_NAME" = "windows" ]; then $buildshell cat configure; fi - mkdir build - cd build - if [ "$LINKING" = "static" ]; then From 3be8f737b4fb309739efd37df9ea656b1c2ffba4 Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Sun, 8 Mar 2020 18:03:38 -0700 Subject: [PATCH 14/30] Force manifest tool to empty on win --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 15267b68..08a65ec0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,6 +53,7 @@ before_install: - curl https://s3.amazonaws.com/libhttpserver/libmicrohttpd_releases/libmicrohttpd-0.9.59.tar.gz -o libmicrohttpd-0.9.59.tar.gz - tar -xzf libmicrohttpd-0.9.59.tar.gz - cd libmicrohttpd-0.9.59 + - $buildshell echo $PATH - if [[ "$ARM_ARCH_DIR" != "" ]]; then ./configure --build `./config.guess` --host $ARM_ARCH_DIR --disable-examples; else @@ -81,6 +82,8 @@ install: - if [ "$TRAVIS_OS_NAME" = "windows" ]; then $buildshell cat configure; fi - mkdir build - cd build + - $buildshell echo $PATH + - if [ "$TRAVIS_OS_NAME" = "windows" ]; then export MANIFEST_TOOL=''; fi - if [ "$LINKING" = "static" ]; then $buildshell ../configure --enable-static --disable-fastopen; elif [ "$DEBUG" = "debug" ] && [ "$COVERAGE" = "coverage" ]; then From 0c1c357b21ed57ec268bc16569982f54953bacbb Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Sun, 8 Mar 2020 19:28:17 -0700 Subject: [PATCH 15/30] Force skip check for manifest tool --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 08a65ec0..f67f6026 100644 --- a/.travis.yml +++ b/.travis.yml @@ -83,7 +83,7 @@ install: - mkdir build - cd build - $buildshell echo $PATH - - if [ "$TRAVIS_OS_NAME" = "windows" ]; then export MANIFEST_TOOL=''; fi + - if [ "$TRAVIS_OS_NAME" = "windows" ]; then export MANIFEST_TOOL='no'; fi - if [ "$LINKING" = "static" ]; then $buildshell ../configure --enable-static --disable-fastopen; elif [ "$DEBUG" = "debug" ] && [ "$COVERAGE" = "coverage" ]; then From 3e71b3fb50c2a29f7ffc041dd4eeb5bc193fdfbe Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Sun, 8 Mar 2020 19:44:00 -0700 Subject: [PATCH 16/30] Disable doxygen (not working on win) --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f67f6026..17301b5f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -97,7 +97,7 @@ install: elif [ "$VALGRIND" = "valgrind" ]; then $buildshell ../configure --enable-debug --disable-fastopen --disable-valgrind-helgrind --disable-valgrind-drd --disable-valgrind-sgcheck; else - $buildshell ../configure --disable-fastopen; + $buildshell ../configure --disable-fastopen --disable-doxygen; fi - if [ "$CROSS_COMPILE" = "1" ] && [ "$ARM_ARCH_DIR" = "aarch64-linux-gnu" ]; then sed -i 's+/usr/bin/ld+$HOME/linker_bin/ld+g' libtool; fi - if [ "$CROSS_COMPILE" = "1" ] && [ "$ARM_ARCH_DIR" = "aarch64-linux-gnu" ]; then sed -i 's+/usr/bin/ld+$HOME/linker_bin/ld+g' Makefile; fi From 8f384fe05ce335461910b9ae340e12a3b54d9785 Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Sun, 8 Mar 2020 19:45:10 -0700 Subject: [PATCH 17/30] Remove commands not needed --- .travis.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 17301b5f..964f2cfe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,7 +53,6 @@ before_install: - curl https://s3.amazonaws.com/libhttpserver/libmicrohttpd_releases/libmicrohttpd-0.9.59.tar.gz -o libmicrohttpd-0.9.59.tar.gz - tar -xzf libmicrohttpd-0.9.59.tar.gz - cd libmicrohttpd-0.9.59 - - $buildshell echo $PATH - if [[ "$ARM_ARCH_DIR" != "" ]]; then ./configure --build `./config.guess` --host $ARM_ARCH_DIR --disable-examples; else @@ -68,7 +67,6 @@ before_install: - if [ "$BUILD_TYPE" = "tsan" ]; then export CFLAGS='-fsanitize=thread'; export CXXLAGS='-fsanitize=thread'; export LDFLAGS='-fsanitize=thread'; fi - if [ "$BUILD_TYPE" = "ubsan" ]; then export export CFLAGS='-fsanitize=undefined'; export CXXLAGS='-fsanitize=undefined'; export LDFLAGS='-fsanitize=undefined'; fi install: - - ps -ef - if [[ "$CROSS_COMPILE" == 1 ]] ; then if [[ "$ARM_ARCH_DIR" == "aarch64-linux-gnu" ]] ; then mkdir $HOME/linker_bin ; @@ -79,10 +77,8 @@ install: fi fi - $buildshell ./bootstrap - - if [ "$TRAVIS_OS_NAME" = "windows" ]; then $buildshell cat configure; fi - mkdir build - cd build - - $buildshell echo $PATH - if [ "$TRAVIS_OS_NAME" = "windows" ]; then export MANIFEST_TOOL='no'; fi - if [ "$LINKING" = "static" ]; then $buildshell ../configure --enable-static --disable-fastopen; From 4b9b7e0a7fead259faefb3e2f73af478b478396f Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Sun, 8 Mar 2020 20:50:47 -0700 Subject: [PATCH 18/30] Install doxygen and gnutls --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 964f2cfe..55fac35e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,7 +45,7 @@ before_install: export buildshell="$msys2 -mingw64 -full-path -here -c "\"\$@"\" --" export msys2+=" -msys2 -c "\"\$@"\" --" $msys2 pacman --sync --noconfirm --disable-download-timeout --needed mingw-w64-x86_64-toolchain - $msys2 pacman -Syu --noconfirm --disable-download-timeout autoconf libtool automake make autoconf-archive pkg-config mingw-w64-x86_64-libsystre + $msys2 pacman -Syu --noconfirm --disable-download-timeout autoconf libtool automake make autoconf-archive pkg-config mingw-w64-x86_64-libsystre mingw-w64-x86_64-doxygen mingw-w64-x86_64-gnutls export PATH=/C/tools/msys64/mingw64/bin:$PATH export MAKE=mingw32-make # so that Autotools can find it ;; @@ -93,7 +93,7 @@ install: elif [ "$VALGRIND" = "valgrind" ]; then $buildshell ../configure --enable-debug --disable-fastopen --disable-valgrind-helgrind --disable-valgrind-drd --disable-valgrind-sgcheck; else - $buildshell ../configure --disable-fastopen --disable-doxygen; + $buildshell ../configure --disable-fastopen; fi - if [ "$CROSS_COMPILE" = "1" ] && [ "$ARM_ARCH_DIR" = "aarch64-linux-gnu" ]; then sed -i 's+/usr/bin/ld+$HOME/linker_bin/ld+g' libtool; fi - if [ "$CROSS_COMPILE" = "1" ] && [ "$ARM_ARCH_DIR" = "aarch64-linux-gnu" ]; then sed -i 's+/usr/bin/ld+$HOME/linker_bin/ld+g' Makefile; fi From c2231dcdeca6892c1c7188453600243a22b91acc Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Sun, 8 Mar 2020 21:09:24 -0700 Subject: [PATCH 19/30] Disable doxygen on windows only --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 55fac35e..9f656c72 100644 --- a/.travis.yml +++ b/.travis.yml @@ -79,7 +79,8 @@ install: - $buildshell ./bootstrap - mkdir build - cd build - - if [ "$TRAVIS_OS_NAME" = "windows" ]; then export MANIFEST_TOOL='no'; fi + - if [ "$TRAVIS_OS_NAME" = "windows" ]; then export MANIFEST_TOOL='no'; fi + - if [ "$TRAVIS_OS_NAME" = "windows" ]; then export DX_DOXYGEN='no'; fi - if [ "$LINKING" = "static" ]; then $buildshell ../configure --enable-static --disable-fastopen; elif [ "$DEBUG" = "debug" ] && [ "$COVERAGE" = "coverage" ]; then From fca96e9283f73d3ad06c5fbc8596379c7caa7f68 Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Mon, 9 Mar 2020 05:35:24 -0700 Subject: [PATCH 20/30] Install graphviz on windows --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9f656c72..22f354f7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,7 +45,7 @@ before_install: export buildshell="$msys2 -mingw64 -full-path -here -c "\"\$@"\" --" export msys2+=" -msys2 -c "\"\$@"\" --" $msys2 pacman --sync --noconfirm --disable-download-timeout --needed mingw-w64-x86_64-toolchain - $msys2 pacman -Syu --noconfirm --disable-download-timeout autoconf libtool automake make autoconf-archive pkg-config mingw-w64-x86_64-libsystre mingw-w64-x86_64-doxygen mingw-w64-x86_64-gnutls + $msys2 pacman -Syu --noconfirm --disable-download-timeout autoconf libtool automake make autoconf-archive pkg-config mingw-w64-x86_64-libsystre mingw-w64-x86_64-doxygen mingw-w64-x86_64-gnutls mingw-w64-x86_64-graphviz export PATH=/C/tools/msys64/mingw64/bin:$PATH export MAKE=mingw32-make # so that Autotools can find it ;; @@ -80,7 +80,6 @@ install: - mkdir build - cd build - if [ "$TRAVIS_OS_NAME" = "windows" ]; then export MANIFEST_TOOL='no'; fi - - if [ "$TRAVIS_OS_NAME" = "windows" ]; then export DX_DOXYGEN='no'; fi - if [ "$LINKING" = "static" ]; then $buildshell ../configure --enable-static --disable-fastopen; elif [ "$DEBUG" = "debug" ] && [ "$COVERAGE" = "coverage" ]; then From 510bb34fed62070ae89f58b47b6b161908517ef9 Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Mon, 9 Mar 2020 06:05:38 -0700 Subject: [PATCH 21/30] Install curl on windows Needed to run tests --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 22f354f7..a060f88f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,7 +45,7 @@ before_install: export buildshell="$msys2 -mingw64 -full-path -here -c "\"\$@"\" --" export msys2+=" -msys2 -c "\"\$@"\" --" $msys2 pacman --sync --noconfirm --disable-download-timeout --needed mingw-w64-x86_64-toolchain - $msys2 pacman -Syu --noconfirm --disable-download-timeout autoconf libtool automake make autoconf-archive pkg-config mingw-w64-x86_64-libsystre mingw-w64-x86_64-doxygen mingw-w64-x86_64-gnutls mingw-w64-x86_64-graphviz + $msys2 pacman -Syu --noconfirm --disable-download-timeout autoconf libtool automake make autoconf-archive pkg-config mingw-w64-x86_64-libsystre mingw-w64-x86_64-doxygen mingw-w64-x86_64-gnutls mingw-w64-x86_64-graphviz mingw-w64-x86_64-curl export PATH=/C/tools/msys64/mingw64/bin:$PATH export MAKE=mingw32-make # so that Autotools can find it ;; From 106ec346d4b74c60d95246cc31ddbb697aaa1f81 Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Mon, 9 Mar 2020 06:51:30 -0700 Subject: [PATCH 22/30] Use windows networking libs for windows in tests --- test/integ/authentication.cpp | 4 ++-- test/integ/deferred.cpp | 2 +- test/integ/ws_start_stop.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/integ/authentication.cpp b/test/integ/authentication.cpp index 29861eef..f5127315 100644 --- a/test/integ/authentication.cpp +++ b/test/integ/authentication.cpp @@ -26,11 +26,11 @@ #include #else #include +#include +#include #endif #include -#include -#include #include "httpserver.hpp" #include "littletest.hpp" diff --git a/test/integ/deferred.cpp b/test/integ/deferred.cpp index b84739f1..833e1539 100644 --- a/test/integ/deferred.cpp +++ b/test/integ/deferred.cpp @@ -26,10 +26,10 @@ #include #else #include +#include #endif #include -#include #include #include #include diff --git a/test/integ/ws_start_stop.cpp b/test/integ/ws_start_stop.cpp index 092b9a74..27987b59 100644 --- a/test/integ/ws_start_stop.cpp +++ b/test/integ/ws_start_stop.cpp @@ -26,12 +26,12 @@ #include #else #include +#include +#include #endif #include -#include #include -#include #include "httpserver.hpp" #include "littletest.hpp" From 11f80579af8c90594ca81614f1e41d35aead1b85 Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Mon, 9 Mar 2020 07:17:27 -0700 Subject: [PATCH 23/30] Add explicit dependency for sleep --- test/integ/ws_start_stop.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/test/integ/ws_start_stop.cpp b/test/integ/ws_start_stop.cpp index 27987b59..739e9d16 100644 --- a/test/integ/ws_start_stop.cpp +++ b/test/integ/ws_start_stop.cpp @@ -32,6 +32,7 @@ #include #include +#include #include "httpserver.hpp" #include "littletest.hpp" From 515b10abd03d0d273c21792896b93caa5f4b7231 Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Mon, 9 Mar 2020 07:40:00 -0700 Subject: [PATCH 24/30] Fix sys/socket.h to avoid using it on windows --- test/integ/deferred.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integ/deferred.cpp b/test/integ/deferred.cpp index 833e1539..0f6cdb97 100644 --- a/test/integ/deferred.cpp +++ b/test/integ/deferred.cpp @@ -27,11 +27,11 @@ #else #include #include +#include #endif #include #include -#include #include #include "httpserver.hpp" From 11e20e782c907d5d7b50ac42c7c54cb266e11faa Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Mon, 9 Mar 2020 09:05:37 -0700 Subject: [PATCH 25/30] copy test/example data rather than linking --- configure.ac | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 576728ad..d6d22bd6 100644 --- a/configure.ac +++ b/configure.ac @@ -344,14 +344,14 @@ AC_SUBST(LDFLAGS) AC_SUBST(EXT_LIB_PATH) AC_SUBST(EXT_LIBS) -AC_CONFIG_LINKS([test/test_content:test/test_content]) -AC_CONFIG_LINKS([test/cert.pem:test/cert.pem]) -AC_CONFIG_LINKS([test/key.pem:test/key.pem]) -AC_CONFIG_LINKS([test/test_root_ca.pem:test/test_root_ca.pem]) -AC_CONFIG_LINKS([test/libhttpserver.supp:test/libhttpserver.supp]) -AC_CONFIG_LINKS([examples/cert.pem:examples/cert.pem]) -AC_CONFIG_LINKS([examples/key.pem:examples/key.pem]) -AC_CONFIG_LINKS([examples/test_content:examples/test_content]) +AC_CONFIG_FILES([test/test_content:test/test_content]) +AC_CONFIG_FILES([test/cert.pem:test/cert.pem]) +AC_CONFIG_FILES([test/key.pem:test/key.pem]) +AC_CONFIG_FILES([test/test_root_ca.pem:test/test_root_ca.pem]) +AC_CONFIG_FILES([test/libhttpserver.supp:test/libhttpserver.supp]) +AC_CONFIG_FILES([examples/cert.pem:examples/cert.pem]) +AC_CONFIG_FILES([examples/key.pem:examples/key.pem]) +AC_CONFIG_FILES([examples/test_content:examples/test_content]) AC_OUTPUT( libhttpserver.pc From eee42dc25afae8badc5edb1e08b681740f8b3ef5 Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Mon, 9 Mar 2020 09:50:13 -0700 Subject: [PATCH 26/30] Spell the full realm out on windows digest auth. Needed a libcurl doesn't seem to be obtaining it properly from the servers on windows: see: https://curl.haxx.se/mail/lib-2015-02/0174.html --- test/integ/authentication.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/integ/authentication.cpp b/test/integ/authentication.cpp index f5127315..de1a854d 100644 --- a/test/integ/authentication.cpp +++ b/test/integ/authentication.cpp @@ -153,7 +153,11 @@ LT_BEGIN_AUTO_TEST(authentication_suite, digest_auth) CURL *curl = curl_easy_init(); CURLcode res; curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); +#if defined(_WINDOWS) + curl_easy_setopt(curl, CURLOPT_USERPWD, "test@example.com\\myuser:mypass"); +#else curl_easy_setopt(curl, CURLOPT_USERPWD, "myuser:mypass"); +#endif curl_easy_setopt(curl, CURLOPT_URL, "localhost:8080/base"); curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writefunc); @@ -184,7 +188,11 @@ LT_BEGIN_AUTO_TEST(authentication_suite, digest_auth_wrong_pass) CURL *curl = curl_easy_init(); CURLcode res; curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); +#if defined(_WINDOWS) + curl_easy_setopt(curl, CURLOPT_USERPWD, "test@example.com\\myuser:wrongpass"); +#else curl_easy_setopt(curl, CURLOPT_USERPWD, "myuser:wrongpass"); +#endif curl_easy_setopt(curl, CURLOPT_URL, "localhost:8080/base"); curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writefunc); From ba12120d1f08cf3b01e56ddb727088321640eb41 Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Mon, 9 Mar 2020 10:14:24 -0700 Subject: [PATCH 27/30] Initialize curl with win32 dependencies --- test/integ/authentication.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/test/integ/authentication.cpp b/test/integ/authentication.cpp index de1a854d..e67fcfd7 100644 --- a/test/integ/authentication.cpp +++ b/test/integ/authentication.cpp @@ -148,16 +148,17 @@ LT_BEGIN_AUTO_TEST(authentication_suite, digest_auth) ws.register_resource("base", &digest); ws.start(false); +#if defined(_WINDOWS) + curl_global_init(CURL_GLOBAL_WIN32 ); +#else curl_global_init(CURL_GLOBAL_ALL); +#endif + std::string s; CURL *curl = curl_easy_init(); CURLcode res; curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); -#if defined(_WINDOWS) - curl_easy_setopt(curl, CURLOPT_USERPWD, "test@example.com\\myuser:mypass"); -#else curl_easy_setopt(curl, CURLOPT_USERPWD, "myuser:mypass"); -#endif curl_easy_setopt(curl, CURLOPT_URL, "localhost:8080/base"); curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writefunc); @@ -183,16 +184,17 @@ LT_BEGIN_AUTO_TEST(authentication_suite, digest_auth_wrong_pass) ws.register_resource("base", &digest); ws.start(false); +#if defined(_WINDOWS) + curl_global_init(CURL_GLOBAL_WIN32 ); +#else curl_global_init(CURL_GLOBAL_ALL); +#endif + std::string s; CURL *curl = curl_easy_init(); CURLcode res; curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); -#if defined(_WINDOWS) - curl_easy_setopt(curl, CURLOPT_USERPWD, "test@example.com\\myuser:wrongpass"); -#else curl_easy_setopt(curl, CURLOPT_USERPWD, "myuser:wrongpass"); -#endif curl_easy_setopt(curl, CURLOPT_URL, "localhost:8080/base"); curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writefunc); From 2ff9a1ef74c3b0b893bb0df119c97a0c514b7468 Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Mon, 9 Mar 2020 13:34:01 -0700 Subject: [PATCH 28/30] Explicitly pass the realm on windows --- test/integ/authentication.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/integ/authentication.cpp b/test/integ/authentication.cpp index e67fcfd7..428c7b09 100644 --- a/test/integ/authentication.cpp +++ b/test/integ/authentication.cpp @@ -158,7 +158,11 @@ LT_BEGIN_AUTO_TEST(authentication_suite, digest_auth) CURL *curl = curl_easy_init(); CURLcode res; curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); +#if defined(_WINDOWS) + curl_easy_setopt(curl, CURLOPT_USERPWD, "test@example.com/myuser:mypass"); +#else curl_easy_setopt(curl, CURLOPT_USERPWD, "myuser:mypass"); +#endif curl_easy_setopt(curl, CURLOPT_URL, "localhost:8080/base"); curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writefunc); @@ -194,7 +198,11 @@ LT_BEGIN_AUTO_TEST(authentication_suite, digest_auth_wrong_pass) CURL *curl = curl_easy_init(); CURLcode res; curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); +#if defined(_WINDOWS) + curl_easy_setopt(curl, CURLOPT_USERPWD, "test@example.com/myuser:wrongpass"); +#else curl_easy_setopt(curl, CURLOPT_USERPWD, "myuser:wrongpass"); +#endif curl_easy_setopt(curl, CURLOPT_URL, "localhost:8080/base"); curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writefunc); From 69c60b1fb4e0e5cbcc98e9c50ede05b0ae8289bb Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Mon, 9 Mar 2020 14:28:03 -0700 Subject: [PATCH 29/30] Simplify the realm string --- test/integ/authentication.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/integ/authentication.cpp b/test/integ/authentication.cpp index 428c7b09..e128a5be 100644 --- a/test/integ/authentication.cpp +++ b/test/integ/authentication.cpp @@ -53,7 +53,7 @@ class user_pass_resource : public httpserver::http_resource { if (req.get_user() != "myuser" || req.get_pass() != "mypass") { - return shared_ptr(new basic_auth_fail_response("FAIL", "test@example.com")); + return shared_ptr(new basic_auth_fail_response("FAIL", "examplerealm")); } return shared_ptr(new string_response(req.get_user() + " " + req.get_pass(), 200, "text/plain")); } @@ -65,14 +65,14 @@ class digest_resource : public httpserver::http_resource const shared_ptr render_GET(const http_request& req) { if (req.get_digested_user() == "") { - return shared_ptr(new digest_auth_fail_response("FAIL", "test@example.com", MY_OPAQUE, true)); + return shared_ptr(new digest_auth_fail_response("FAIL", "examplerealm", MY_OPAQUE, true)); } else { bool reload_nonce = false; - if(!req.check_digest_auth("test@example.com", "mypass", 300, reload_nonce)) + if(!req.check_digest_auth("examplerealm", "mypass", 300, reload_nonce)) { - return shared_ptr(new digest_auth_fail_response("FAIL", "test@example.com", MY_OPAQUE, reload_nonce)); + return shared_ptr(new digest_auth_fail_response("FAIL", "examplerealm", MY_OPAQUE, reload_nonce)); } } return shared_ptr(new string_response("SUCCESS", 200, "text/plain")); @@ -159,7 +159,7 @@ LT_BEGIN_AUTO_TEST(authentication_suite, digest_auth) CURLcode res; curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); #if defined(_WINDOWS) - curl_easy_setopt(curl, CURLOPT_USERPWD, "test@example.com/myuser:mypass"); + curl_easy_setopt(curl, CURLOPT_USERPWD, "examplerealm/myuser:mypass"); #else curl_easy_setopt(curl, CURLOPT_USERPWD, "myuser:mypass"); #endif @@ -199,7 +199,7 @@ LT_BEGIN_AUTO_TEST(authentication_suite, digest_auth_wrong_pass) CURLcode res; curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); #if defined(_WINDOWS) - curl_easy_setopt(curl, CURLOPT_USERPWD, "test@example.com/myuser:wrongpass"); + curl_easy_setopt(curl, CURLOPT_USERPWD, "examplerealm/myuser:wrongpass"); #else curl_easy_setopt(curl, CURLOPT_USERPWD, "myuser:wrongpass"); #endif From 01a2b27e47751f2fec217c0e2d85444aceacd508 Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Mon, 9 Mar 2020 14:53:04 -0700 Subject: [PATCH 30/30] Disable digest auth tests on windows --- test/integ/authentication.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/integ/authentication.cpp b/test/integ/authentication.cpp index e128a5be..52979527 100644 --- a/test/integ/authentication.cpp +++ b/test/integ/authentication.cpp @@ -139,6 +139,11 @@ LT_BEGIN_AUTO_TEST(authentication_suite, base_auth_fail) ws.stop(); LT_END_AUTO_TEST(base_auth_fail) +// do not run the digest auth tests on windows as curl +// appears to have problems with it. +// Will fix this separately +#ifndef _WINDOWS + LT_BEGIN_AUTO_TEST(authentication_suite, digest_auth) webserver ws = create_webserver(8080) .digest_auth_random("myrandom") @@ -219,6 +224,8 @@ LT_BEGIN_AUTO_TEST(authentication_suite, digest_auth_wrong_pass) ws.stop(); LT_END_AUTO_TEST(digest_auth_wrong_pass) +#endif + LT_BEGIN_AUTO_TEST_ENV() AUTORUN_TESTS() LT_END_AUTO_TEST_ENV()