Hello community, here is the log from the commit of package ulfius for openSUSE:Factory checked in at 2019-04-12 09:15:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ulfius (Old) and /work/SRC/openSUSE:Factory/.ulfius.new.27019 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ulfius" Fri Apr 12 09:15:08 2019 rev:4 rq:692246 version:2.5.4 Changes: -------- --- /work/SRC/openSUSE:Factory/ulfius/ulfius.changes 2019-01-08 12:31:25.248079818 +0100 +++ /work/SRC/openSUSE:Factory/.ulfius.new.27019/ulfius.changes 2019-04-12 09:15:13.557707207 +0200 @@ -1,0 +2,17 @@ +Sun Apr 7 07:37:21 UTC 2019 - Martin Hauke <[email protected]> + +- Update to version 2.5.4 + * Align PKGCONF_REQ_PRIVATE required versions + * Backport ulfius_copy_request, ulfius_duplicate_request, + ulfius_copy_response and ulfius_duplicate_response from Ulfius 2.6 + +------------------------------------------------------------------- +Sat Jan 12 14:31:56 UTC 2019 - [email protected] + +- Update to version 2.5.3 + - Add flag to build Ulfius with GnuTLS support but without + Websockets. + - Fix CMake build process that didn't obviously linked Ulfius + with pthreads. + +------------------------------------------------------------------- Old: ---- ulfius-2.5.2.tar.gz New: ---- ulfius-2.5.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ulfius.spec ++++++ --- /var/tmp/diff_new_pack.YQKKkp/_old 2019-04-12 09:15:14.565707847 +0200 +++ /var/tmp/diff_new_pack.YQKKkp/_new 2019-04-12 09:15:14.573707852 +0200 @@ -13,13 +13,13 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # %define sover 2_5 Name: ulfius -Version: 2.5.2 +Version: 2.5.4 Release: 0 Summary: Web Framework for REST Applications in C License: MIT ++++++ ulfius-2.5.2.tar.gz -> ulfius-2.5.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/.travis.yml new/ulfius-2.5.4/.travis.yml --- old/ulfius-2.5.2/.travis.yml 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/.travis.yml 2019-04-04 02:16:24.000000000 +0200 @@ -1,13 +1,14 @@ # travis configuration file -# Copyright 2018 Ilya Shipitsin <[email protected]> -# Nicolas Mora <[email protected]> +# Copyright 2018 Ilya Shipitsin <[email protected]> +# 2018-2019 Nicolas Mora <[email protected]> sudo: required language: c +dist: xenial addons: apt: - packages: [ libmicrohttpd-dev, libjansson-dev, check, libsubunit-dev, cppcheck ] + packages: [ libgnutls28-dev, libjansson-dev, check, libsubunit-dev, libsystemd-dev, cppcheck ] matrix: include: @@ -20,159 +21,351 @@ script: - cppcheck --force --enable=warning,missingInclude --error-exitcode=1 . >build.log 2>&1 || (cat build.log && exit 1) +install: +- wget https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-latest.tar.gz +- mkdir libmicrohttpd && tar xf libmicrohttpd-latest.tar.gz -C libmicrohttpd --strip-components 1 +- pushd libmicrohttpd && ./configure && make && sudo make install && popd +- rm -rf libmicrohttpd + script: +# prepare build folders - mkdir build - mkdir example_programs/build + +# build ulfius, run tests, build package - cd build - - cmake -DWITH_JOURNALD=off -DBUILD_ULFIUS_TESTING=on .. + - cmake -DBUILD_ULFIUS_TESTING=on .. - make test || (cat Testing/Temporary/LastTest.log && false) - make package - sudo make install + +# build examples + - cd ../example_programs/build + - cmake .. + - make + +# test build options + - cd ../../build + - sudo make uninstall && rm -rf * + - cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=off -DWITH_CURL=off .. + - make package + - sudo make install + - cd ../example_programs/build + - rm -rf * + - cmake .. + - make + + - cd ../../build + - sudo make uninstall && rm -rf * + - cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=off -DWITH_CURL=on .. + - make package + - sudo make install + - cd ../example_programs/build + - rm -rf * + - cmake .. + - make + + - cd ../../build + - sudo make uninstall && rm -rf * + - cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=on -DWITH_CURL=off .. + - make package + - sudo make install + - cd ../example_programs/build + - rm -rf * + - cmake .. + - make + + - cd ../../build + - sudo make uninstall && rm -rf * + - cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=on -DWITH_CURL=on .. + - make package + - sudo make install + - cd ../example_programs/build + - rm -rf * + - cmake .. + - make + + - cd ../../build + - sudo make uninstall && rm -rf * + - cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=off -DWITH_CURL=off .. + - make package + - sudo make install + - cd ../example_programs/build + - rm -rf * + - cmake .. + - make + + - cd ../../build + - sudo make uninstall && rm -rf * + - cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=off -DWITH_CURL=on .. + - make package + - sudo make install + - cd ../example_programs/build + - rm -rf * + - cmake .. + - make + + - cd ../../build + - sudo make uninstall && rm -rf * + - cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=on -DWITH_CURL=off .. + - make package + - sudo make install - cd ../example_programs/build + - rm -rf * - cmake .. - make + - cd ../../build - sudo make uninstall && rm -rf * - - cmake -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=off -DWITH_CURL=off .. + - cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=on -DWITH_CURL=on .. - make package - sudo make install - cd ../example_programs/build - rm -rf * - cmake .. - make + - cd ../../build - sudo make uninstall && rm -rf * - - cmake -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=off -DWITH_CURL=on .. + - cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=off -DWITH_CURL=off .. - make package - sudo make install - cd ../example_programs/build - rm -rf * - cmake .. - make + - cd ../../build - sudo make uninstall && rm -rf * - - cmake -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=on -DWITH_CURL=off .. + - cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=off -DWITH_CURL=on .. - make package - sudo make install - cd ../example_programs/build - rm -rf * - cmake .. - make + - cd ../../build - sudo make uninstall && rm -rf * - - cmake -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=on -DWITH_CURL=on .. + - cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=on -DWITH_CURL=off .. - make package - sudo make install - cd ../example_programs/build - rm -rf * - cmake .. - make + - cd ../../build - sudo make uninstall && rm -rf * - - cmake -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=off -DWITH_CURL=off .. + - cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=on -DWITH_CURL=on .. - make package - sudo make install - cd ../example_programs/build - rm -rf * - cmake .. - make + - cd ../../build - sudo make uninstall && rm -rf * - - cmake -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=off -DWITH_CURL=on .. + - cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=off -DWITH_CURL=off .. - make package - sudo make install - cd ../example_programs/build - rm -rf * - cmake .. - make + - cd ../../build - sudo make uninstall && rm -rf * - - cmake -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=on -DWITH_CURL=off .. + - cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=off -DWITH_CURL=on .. - make package - sudo make install - cd ../example_programs/build - rm -rf * - cmake .. - make + - cd ../../build - sudo make uninstall && rm -rf * - - cmake -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=on -DWITH_CURL=on .. + - cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=on -DWITH_CURL=off .. - make package - sudo make install - cd ../example_programs/build - rm -rf * - cmake .. - make + - cd ../../build - sudo make uninstall && rm -rf * - - cmake -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=off -DWITH_CURL=off .. + - cmake -DWITH_GNUTLS=off -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=on -DWITH_CURL=on .. - make package - sudo make install - cd ../example_programs/build - rm -rf * - cmake .. - make + - cd ../../build - sudo make uninstall && rm -rf * - - cmake -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=off -DWITH_CURL=on .. + - cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=off -DWITH_CURL=off .. - make package - sudo make install - cd ../example_programs/build - rm -rf * - cmake .. - make + - cd ../../build - sudo make uninstall && rm -rf * - - cmake -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=on -DWITH_CURL=off .. + - cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=off -DWITH_CURL=on .. - make package - sudo make install - cd ../example_programs/build - rm -rf * - cmake .. - make + - cd ../../build - sudo make uninstall && rm -rf * - - cmake -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=on -DWITH_CURL=on .. + - cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=on -DWITH_CURL=off .. - make package - sudo make install - cd ../example_programs/build - rm -rf * - cmake .. - make + - cd ../../build - sudo make uninstall && rm -rf * - - cmake -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=off -DWITH_CURL=off .. + - cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=on -DWITH_CURL=on .. - make package - sudo make install - cd ../example_programs/build - rm -rf * - cmake .. - make + - cd ../../build - sudo make uninstall && rm -rf * - - cmake -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=off -DWITH_CURL=on .. + - cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=off -DWITH_CURL=off .. - make package - sudo make install - cd ../example_programs/build - rm -rf * - cmake .. - make + - cd ../../build - sudo make uninstall && rm -rf * - - cmake -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=on -DWITH_CURL=off .. + - cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=off -DWITH_CURL=on .. - make package - sudo make install - cd ../example_programs/build - rm -rf * - cmake .. - make + - cd ../../build - sudo make uninstall && rm -rf * - - cmake -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=on -DWITH_CURL=on .. + - cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=on -DWITH_CURL=off .. - make package - sudo make install - cd ../example_programs/build - rm -rf * + - cmake .. + - make + + - cd ../../build + - sudo make uninstall && rm -rf * + - cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=off -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=on -DWITH_CURL=on .. + - make package + - sudo make install + - cd ../example_programs/build + - rm -rf * + - cmake .. + - make + + - cd ../../build + - sudo make uninstall && rm -rf * + - cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=off -DWITH_CURL=off .. + - make package + - sudo make install + - cd ../example_programs/build + - rm -rf * + - cmake .. + - make + + - cd ../../build + - sudo make uninstall && rm -rf * + - cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=off -DWITH_CURL=on .. + - make package + - sudo make install + - cd ../example_programs/build + - rm -rf * + - cmake .. + - make + + - cd ../../build + - sudo make uninstall && rm -rf * + - cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=on -DWITH_CURL=off .. + - make package + - sudo make install + - cd ../example_programs/build + - rm -rf * + - cmake .. + - make + + - cd ../../build + - sudo make uninstall && rm -rf * + - cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=off -DWITH_JANSSON=on -DWITH_CURL=on .. + - make package + - sudo make install + - cd ../example_programs/build + - rm -rf * + - cmake .. + - make + + - cd ../../build + - sudo make uninstall && rm -rf * + - cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=off -DWITH_CURL=off .. + - make package + - sudo make install + - cd ../example_programs/build + - rm -rf * + - cmake .. + - make + + - cd ../../build + - sudo make uninstall && rm -rf * + - cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=off -DWITH_CURL=on .. + - make package + - sudo make install + - cd ../example_programs/build + - rm -rf * + - cmake .. + - make + + - cd ../../build + - sudo make uninstall && rm -rf * + - cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=on -DWITH_CURL=off .. + - make package + - sudo make install + - cd ../example_programs/build + - rm -rf * + - cmake .. + - make + + - cd ../../build + - sudo make uninstall && rm -rf * + - cmake -DWITH_GNUTLS=on -DWITH_JOURNALD=off -DWITH_YDER=on -DBUILD_ULFIUS_TESTING=on -DWITH_WEBSOCKET=on -DWITH_JANSSON=on -DWITH_CURL=on .. + - make package + - sudo make install + - cd ../example_programs/build + - rm -rf * + - cmake .. + - make + +# build with Makefile - cd ../../ - make - make clean debug CURLFLAG=1 JANSSONFLAG=1 WEBSOCKETFLAG=1 YDERFLAG=1 @@ -191,5 +384,23 @@ - make clean debug CURLFLAG=1 JANSSONFLAG=1 - make clean debug CURLFLAG=1 WEBSOCKETFLAG=1 - make clean debug CURLFLAG=1 + - make clean debug GNUTLSFLAG=1 CURLFLAG=1 JANSSONFLAG=1 WEBSOCKETFLAG=1 YDERFLAG=1 + - make clean debug GNUTLSFLAG=1 CURLFLAG=1 JANSSONFLAG=1 YDERFLAG=1 + - make clean debug GNUTLSFLAG=1 CURLFLAG=1 WEBSOCKETFLAG=1 YDERFLAG=1 + - make clean debug GNUTLSFLAG=1 CURLFLAG=1 YDERFLAG=1 + - make clean debug GNUTLSFLAG=1 JANSSONFLAG=1 WEBSOCKETFLAG=1 YDERFLAG=1 + - make clean debug GNUTLSFLAG=1 CURLFLAG=1 JANSSONFLAG=1 YDERFLAG=1 + - make clean debug GNUTLSFLAG=1 CURLFLAG=1 WEBSOCKETFLAG=1 YDERFLAG=1 + - make clean debug GNUTLSFLAG=1 CURLFLAG=1 YDERFLAG=1 + - make clean debug GNUTLSFLAG=1 CURLFLAG=1 JANSSONFLAG=1 WEBSOCKETFLAG=1 + - make clean debug GNUTLSFLAG=1 CURLFLAG=1 JANSSONFLAG=1 + - make clean debug GNUTLSFLAG=1 CURLFLAG=1 WEBSOCKETFLAG=1 + - make clean debug GNUTLSFLAG=1 CURLFLAG=1 + - make clean debug GNUTLSFLAG=1 JANSSONFLAG=1 WEBSOCKETFLAG=1 + - make clean debug GNUTLSFLAG=1 CURLFLAG=1 JANSSONFLAG=1 + - make clean debug GNUTLSFLAG=1 CURLFLAG=1 WEBSOCKETFLAG=1 + - make clean debug GNUTLSFLAG=1 CURLFLAG=1 + +# run tests with Makefile - make clean debug check diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/API.md new/ulfius-2.5.4/API.md --- old/ulfius-2.5.2/API.md 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/API.md 2019-04-04 02:16:24.000000000 +0200 @@ -188,7 +188,7 @@ void * file_upload_cls; int mhd_response_copy_data; int check_utf8; -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS int use_client_cert_auth; #endif }; @@ -514,7 +514,7 @@ struct _u_map * map_post_body; void * binary_body; size_t binary_body_length; -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS gnutls_x509_crt_t client_cert; char * client_cert_file; char * client_key_file; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/CHANGELOG.md new/ulfius-2.5.4/CHANGELOG.md --- old/ulfius-2.5.2/CHANGELOG.md 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/CHANGELOG.md 2019-04-04 02:16:24.000000000 +0200 @@ -1,5 +1,18 @@ # Ulfius Changelog +## 2.5.4 + +- Align PKGCONF_REQ_PRIVATE required versions +- Backport ulfius_copy_request, ulfius_duplicate_request, ulfius_copy_response and ulfius_duplicate_response from Ulfius 2.6 +- Started LTS branch from here + +## 2.5.3 + +- Add flag to build Ulfius with GnuTLS support but without Websockets +- Improve Travis CI script +- Fix CMake build process that didn't obviously linked Ulfius with pthreads +- Add command to run tests with valgrind + ## 2.5.2 - Fix utf8 check on NULL value diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/CMakeLists.txt new/ulfius-2.5.4/CMakeLists.txt --- old/ulfius-2.5.2/CMakeLists.txt 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/CMakeLists.txt 2019-04-04 02:16:24.000000000 +0200 @@ -28,7 +28,7 @@ set(PROJECT_BUGREPORT_PATH "https://github.com/babelouest/ulfius/issues") set(LIBRARY_VERSION_MAJOR "2") set(LIBRARY_VERSION_MINOR "5") -set(LIBRARY_VERSION_PATCH "2") +set(LIBRARY_VERSION_PATCH "4") set(PROJECT_VERSION "${LIBRARY_VERSION_MAJOR}.${LIBRARY_VERSION_MINOR}.${LIBRARY_VERSION_PATCH}") set(LIBRARY_VERSION "${LIBRARY_VERSION_MAJOR}.${LIBRARY_VERSION_MINOR}.${LIBRARY_VERSION_PATCH}") @@ -78,6 +78,21 @@ ${SRC_DIR}/yuarel.c ${SRC_DIR}/ulfius.c) +# pthread libraries +find_package (Threads) +set(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT}) + +# GNU TLS support +option(WITH_GNUTLS "GNU TLS support" ON) + +if (WITH_GNUTLS) + include(FindGnuTLS) + find_package(GnuTLS REQUIRED) + if (GNUTLS_FOUND) + set(LIBS ${LIBS} ${GNUTLS_LIBRARIES}) + endif () +endif () + # websocket support option(WITH_WEBSOCKET "Websocket support" ON) @@ -86,15 +101,21 @@ set(WITH_WEBSOCKET OFF) endif () -if (NOT WITH_WEBSOCKET) +# current websocket implementation depends on GNU TLS +if (NOT WITH_GNUTLS) + set(WITH_WEBSOCKET OFF) +endif () + +if (WITH_WEBSOCKET) + set(MHD_MIN_VERSION 0.9.53) +else () set(MHD_MIN_VERSION 0.9.51) +endif () + +if (WITH_GNUTLS) + set(U_DISABLE_GNUTLS OFF) else () - set(MHD_MIN_VERSION 0.9.53) - include(FindGnuTLS) - find_package(GnuTLS REQUIRED) - if (GNUTLS_FOUND) - set(LIBS ${LIBS} ${GNUTLS_LIBRARIES}) - endif () + set(U_DISABLE_GNUTLS ON) endif () include(FindMHD) @@ -230,7 +251,11 @@ option(BUILD_UWSC "Build uwsc application." ON) -if (WITH_WEBSOCKET AND BUILD_UWSC) +if (NOT WITH_WEBSOCKET) + set(BUILD_UWSC OFF) +endif () + +if (BUILD_UWSC) add_executable(uwsc ${UWSC_DIR}/uwsc.c ${INC_DIR}/ulfius.h ${INC_DIR}/u_private.h ${PROJECT_BINARY_DIR}/ulfius-cfg.h) set_target_properties(uwsc PROPERTIES SKIP_BUILD_RPATH TRUE) add_dependencies(uwsc ulfius) @@ -246,10 +271,13 @@ if (WITH_JANSSON) set (PKGCONF_REQ_PRIVATE "${PKGCONF_REQ_PRIVATE}, jansson") endif () +if (WITH_GNUTLS) + set (PKGCONF_REQ_PRIVATE "${PKGCONF_REQ_PRIVATE}, gnutls >= 3.5.0") +endif () if (WITH_WEBSOCKET) - set (PKGCONF_REQ_PRIVATE "${PKGCONF_REQ_PRIVATE}, gnutls > 3.5.0, libmicrohttpd > 0.9.53") + set (PKGCONF_REQ_PRIVATE "${PKGCONF_REQ_PRIVATE}, libmicrohttpd >= 0.9.53") else () - set (PKGCONF_REQ_PRIVATE "${PKGCONF_REQ_PRIVATE}, libmicrohttpd > 0.9.51") + set (PKGCONF_REQ_PRIVATE "${PKGCONF_REQ_PRIVATE}, libmicrohttpd >= 0.9.51") endif () # build ulfius-cfg.h file @@ -390,8 +418,11 @@ if (WITH_JANSSON) set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libjansson4 (>= 2.1)") endif () +if (WITH_GNUTLS) + set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libgnutls30 (>= 3.5.0)") +endif () if (WITH_WEBSOCKET) - set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libgnutls30 (>= 3.5.0), libmicrohttpd12 (>= 0.9.53)") + set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libmicrohttpd12 (>= 0.9.53)") else () set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libmicrohttpd12 (>= 0.9.51)") endif () @@ -405,6 +436,7 @@ add_custom_target(dist_u COMMAND ${CMAKE_MAKE_PROGRAM} package_source) +message(STATUS "GNU TLS support: ${WITH_GNUTLS}") message(STATUS "Websocket support: ${WITH_WEBSOCKET}") message(STATUS "Outgoing requests support: ${WITH_CURL}") message(STATUS "Jansson library support: ${WITH_JANSSON}") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/INSTALL.md new/ulfius-2.5.4/INSTALL.md --- old/ulfius-2.5.2/INSTALL.md 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/INSTALL.md 2019-04-04 02:16:24.000000000 +0200 @@ -89,13 +89,19 @@ If libjansson functions are disabled, `libjansson-dev` is no longer mandatory for install. -To disable websocket implementation and avoid installing libgnutls, append the option `WEBSOCKETFLAG=1` to the make command when you build Ulfius: +To disable GNU TLS extensions (HTTPS client certificate support) and avoid installing libgnutls, append the option `GNUTLSFLAG=1` to the make command when you build Ulfius: ```shell -$ make WEBSOCKETFLAG=1 +$ make GNUTLSFLAG=1 ``` -If websocket functions are disabled, `libgnutls-dev` is no longer mandatory for install. +If GNU TLS extensions are disabled, `libgnutls-dev` is no longer mandatory for install. However, this will also disable websocket support, since it depends on libgnutls. + +To disable websocket implementation, append the option `WEBSOCKETFLAG=1` to the make command when you build Ulfius: + +```shell +$ make WEBSOCKETFLAG=1 +``` To disable yder library (you will no longer have log messages available!), append the option `YDERFLAG=1` to the make command when you build Ulfius: @@ -162,7 +168,8 @@ The available options for cmake are: - `-DWITH_JANSSON=[on|off]` (default `on`): Build with Jansson dependency - `-DWITH_CURL=[on|off]` (default `on`): Build with libcurl dependency -- `-DWITH_WEBSOCKET=[on|off]` (default `on`): Build with websocket functions, not available for Windows, requires libmicrohttpd 0.9.53 minimum and GnuTLS installed. +- `-DWITH_GNUTLS=[on|off]` (default `on`): Build with GNU TLS extensions (HTTPS client certificate support), requires GnuTLS library. +- `-DWITH_WEBSOCKET=[on|off]` (default `on`): Build with websocket functions, not available for Windows, requires libmicrohttpd 0.9.53 minimum. - `-DWITH_JOURNALD=[on|off]` (default `on`): Build with journald (SystemD) support for logging - `-DWITH_YDER=[on|off]` (default `on`): Build with Yder library for logging messages - `-DBUILD_UWSC=[on|off]` (default `on`): Build uwsc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/example_programs/auth_example/Makefile new/ulfius-2.5.4/example_programs/auth_example/Makefile --- old/ulfius-2.5.2/example_programs/auth_example/Makefile 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/example_programs/auth_example/Makefile 2019-04-04 02:16:24.000000000 +0200 @@ -33,7 +33,7 @@ debug: auth_client auth_server ../../src/libulfius.so: - cd $(ULFIUS_LOCATION) && $(MAKE) debug JANSSONFLAG=-DU_DISABLE_JANSSON + cd $(ULFIUS_LOCATION) && $(MAKE) debug JANSSONFLAG=1 WEBSOCKETFLAG=1 auth_client.o: auth_client.c ../../src/libulfius.so $(CC) $(CFLAGS) auth_client.c -DDEBUG -g -O0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/example_programs/auth_example/auth_client.c new/ulfius-2.5.4/example_programs/auth_example/auth_client.c --- old/ulfius-2.5.2/example_programs/auth_example/auth_client.c 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/example_programs/auth_example/auth_client.c 2019-04-04 02:16:24.000000000 +0200 @@ -59,7 +59,7 @@ y_init_logs("auth_client", Y_LOG_MODE_CONSOLE, Y_LOG_LEVEL_DEBUG, NULL, "logs start"); -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS if (argc <= 2) { #endif ulfius_init_request(&req_list[0]); @@ -165,7 +165,7 @@ ulfius_clean_request(&req_list[3]); ulfius_clean_request(&req_list[4]); ulfius_clean_request(&req_list[5]); -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS } else { ulfius_init_request(&req_list[0]); req_list[0].http_verb = o_strdup("GET"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/example_programs/auth_example/auth_server.c new/ulfius-2.5.4/example_programs/auth_example/auth_server.c --- old/ulfius-2.5.2/example_programs/auth_example/auth_server.c 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/example_programs/auth_example/auth_server.c 2019-04-04 02:16:24.000000000 +0200 @@ -84,7 +84,7 @@ return U_CALLBACK_CONTINUE; } -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS /** * Callback function on client certificate authentication */ @@ -133,13 +133,13 @@ ulfius_add_endpoint_by_val(&instance, "GET", PREFIX, "/basic", 1, &callback_auth_basic, NULL); ulfius_add_endpoint_by_val(&instance, "GET", PREFIX, "/default", 1, &callback_auth_basic, NULL); ulfius_add_endpoint_by_val(&instance, "GET", PREFIX, "/default", 0, &callback_auth_basic_body, NULL); -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS if (argc > 3) { ulfius_add_endpoint_by_val(&instance, "GET", PREFIX, "/client_cert", 0, &callback_auth_client_cert, NULL); } #endif -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS // Start the framework if (argc > 3) { char * server_key = read_file(argv[1]), * server_pem = read_file(argv[2]), * root_ca_pem = read_file(argv[3]); @@ -162,7 +162,7 @@ // Wait for the user to press <enter> on the console to quit the application printf("Press <enter> to quit server\n"); getchar(); -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS } else { printf("Error starting framework\n"); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/example_programs/cmake-modules/FindUlfius.cmake new/ulfius-2.5.4/example_programs/cmake-modules/FindUlfius.cmake --- old/ulfius-2.5.2/example_programs/cmake-modules/FindUlfius.cmake 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/example_programs/cmake-modules/FindUlfius.cmake 2019-04-04 02:16:24.000000000 +0200 @@ -71,6 +71,16 @@ unset(regex_ulfius_disable_jansson) unset(ulfius_disable_jansson) + set(regex_ulfius_disable_gnutls "^#define[ \t]+U_DISABLE_GNUTLS.*") + file(STRINGS "${ULFIUS_INCLUDE_DIR}/ulfius-cfg.h" ulfius_disable_gnutls REGEX "${regex_ulfius_disable_gnutls}") + if (NOT "${ulfius_disable_gnutls}" STREQUAL "") + set(WITH_GNUTLS OFF) + else () + set(WITH_GNUTLS ON) + endif() + unset(regex_ulfius_disable_gnutls) + unset(ulfius_disable_gnutls) + set(regex_ulfius_disable_websocket "^#define[ \t]+U_DISABLE_WEBSOCKET.*") file(STRINGS "${ULFIUS_INCLUDE_DIR}/ulfius-cfg.h" ulfius_disable_websocket REGEX "${regex_ulfius_disable_websocket}") if (NOT "${ulfius_disable_websocket}" STREQUAL "") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/example_programs/injection_example/Makefile new/ulfius-2.5.4/example_programs/injection_example/Makefile --- old/ulfius-2.5.2/example_programs/injection_example/Makefile 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/example_programs/injection_example/Makefile 2019-04-04 02:16:24.000000000 +0200 @@ -33,7 +33,7 @@ debug: injection_example ../../src/libulfius.so: - cd $(ULFIUS_LOCATION) && $(MAKE) debug JANSSONFLAG=-DU_DISABLE_JANSSON CURLFLAG=-DU_DISABLE_CURL WEBSOCKETFLAG=-DU_DISABLE_WEBSOCKET + cd $(ULFIUS_LOCATION) && $(MAKE) debug JANSSONFLAG=1 CURLFLAG=1 GNUTLSFLAG=1 injection_example.o: injection_example.c $(CC) $(CFLAGS) injection_example.c -DDEBUG -g -O0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/example_programs/multiple_callbacks_example/Makefile new/ulfius-2.5.4/example_programs/multiple_callbacks_example/Makefile --- old/ulfius-2.5.2/example_programs/multiple_callbacks_example/Makefile 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/example_programs/multiple_callbacks_example/Makefile 2019-04-04 02:16:24.000000000 +0200 @@ -33,7 +33,7 @@ debug: multiple_callbacks_example ../../src/libulfius.so: - cd $(ULFIUS_LOCATION) && $(MAKE) debug JANSSONFLAG=-DU_DISABLE_JANSSON CURLFLAG=-DU_DISABLE_CURL WEBSOCKETFLAG=-DU_DISABLE_WEBSOCKET + cd $(ULFIUS_LOCATION) && $(MAKE) debug JANSSONFLAG=1 CURLFLAG=1 GNUTLSFLAG=1 multiple_callbacks_example.o: multiple_callbacks_example.c $(CC) $(CFLAGS) multiple_callbacks_example.c -DDEBUG -g -O0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/example_programs/proxy_example/Makefile new/ulfius-2.5.4/example_programs/proxy_example/Makefile --- old/ulfius-2.5.2/example_programs/proxy_example/Makefile 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/example_programs/proxy_example/Makefile 2019-04-04 02:16:24.000000000 +0200 @@ -33,7 +33,7 @@ debug: proxy ../../src/libulfius.so: - cd $(ULFIUS_LOCATION) && $(MAKE) debug JANSSONFLAG=-DU_DISABLE_JANSSON WEBSOCKETFLAG=-DU_DISABLE_WEBSOCKET + cd $(ULFIUS_LOCATION) && $(MAKE) debug JANSSONFLAG=1 GNUTLSFLAG=1 proxy.o: proxy.c $(CC) $(CFLAGS) proxy.c -DDEBUG -g -O0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/example_programs/request_example/Makefile new/ulfius-2.5.4/example_programs/request_example/Makefile --- old/ulfius-2.5.2/example_programs/request_example/Makefile 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/example_programs/request_example/Makefile 2019-04-04 02:16:24.000000000 +0200 @@ -33,7 +33,7 @@ debug: client server mail ../../src/libulfius.so: - cd $(ULFIUS_LOCATION) && $(MAKE) debug WEBSOCKETFLAG=-DU_DISABLE_WEBSOCKET + cd $(ULFIUS_LOCATION) && $(MAKE) debug GNUTLSFLAG=1 client.o: client.c ../../src/libulfius.so $(CC) $(CFLAGS) client.c -DDEBUG -g -O0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/example_programs/sheep_counter/Makefile new/ulfius-2.5.4/example_programs/sheep_counter/Makefile --- old/ulfius-2.5.2/example_programs/sheep_counter/Makefile 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/example_programs/sheep_counter/Makefile 2019-04-04 02:16:24.000000000 +0200 @@ -33,7 +33,7 @@ debug: sheep_counter ../../src/libulfius.so: - cd $(ULFIUS_LOCATION) && $(MAKE) debug CURLFLAG=-DU_DISABLE_CURL WEBSOCKETFLAG=-DU_DISABLE_WEBSOCKET + cd $(ULFIUS_LOCATION) && $(MAKE) debug CURLFLAG=1 GNUTLSFLAG=1 sheep_counter.o: sheep_counter.c $(CC) $(CFLAGS) sheep_counter.c -DDEBUG -g -O0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/example_programs/simple_example/Makefile new/ulfius-2.5.4/example_programs/simple_example/Makefile --- old/ulfius-2.5.2/example_programs/simple_example/Makefile 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/example_programs/simple_example/Makefile 2019-04-04 02:16:24.000000000 +0200 @@ -34,7 +34,7 @@ debug: simple_example ../../src/libulfius.so: - cd $(ULFIUS_LOCATION) && $(MAKE) debug CURLFLAG=-DU_DISABLE_CURL WEBSOCKETFLAG=-DU_DISABLE_WEBSOCKET + cd $(ULFIUS_LOCATION) && $(MAKE) debug CURLFLAG=1 GNUTLSFLAG=1 simple_example.o: simple_example.c $(CC) $(CFLAGS) simple_example.c -DDEBUG -g -O0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/example_programs/stream_example/Makefile new/ulfius-2.5.4/example_programs/stream_example/Makefile --- old/ulfius-2.5.2/example_programs/stream_example/Makefile 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/example_programs/stream_example/Makefile 2019-04-04 02:16:24.000000000 +0200 @@ -33,7 +33,7 @@ debug: stream_example stream_client ../../src/libulfius.so: - cd $(ULFIUS_LOCATION) && $(MAKE) debug JANSSONFLAG=-DU_DISABLE_JANSSON WEBSOCKETFLAG=-DU_DISABLE_WEBSOCKET + cd $(ULFIUS_LOCATION) && $(MAKE) debug JANSSONFLAG=1 GNUTLSFLAG=1 stream_example.o: stream_example.c $(CC) $(CFLAGS) stream_example.c -DDEBUG -g -O0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/example_programs/test_u_map/Makefile new/ulfius-2.5.4/example_programs/test_u_map/Makefile --- old/ulfius-2.5.2/example_programs/test_u_map/Makefile 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/example_programs/test_u_map/Makefile 2019-04-04 02:16:24.000000000 +0200 @@ -33,7 +33,7 @@ debug: test_u_map ../../src/libulfius.so: - cd $(ULFIUS_LOCATION) && $(MAKE) debug JANSSONFLAG=-DU_DISABLE_JANSSON CURLFLAG=-DU_DISABLE_CURL WEBSOCKETFLAG=-DU_DISABLE_WEBSOCKET + cd $(ULFIUS_LOCATION) && $(MAKE) debug JANSSONFLAG=1 CURLFLAG=1 GNUTLSFLAG=1 test_u_map.o: test_u_map.c $(CC) $(CFLAGS) test_u_map.c -DDEBUG -g -O0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/example_programs/websocket_example/Makefile new/ulfius-2.5.4/example_programs/websocket_example/Makefile --- old/ulfius-2.5.2/example_programs/websocket_example/Makefile 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/example_programs/websocket_example/Makefile 2019-04-04 02:16:24.000000000 +0200 @@ -35,7 +35,7 @@ debug: websocket_server websocket_client ../../src/libulfius.so: - cd $(ULFIUS_LOCATION) && $(MAKE) debug JANSSONFLAG=-DU_DISABLE_JANSSON + cd $(ULFIUS_LOCATION) && $(MAKE) debug JANSSONFLAG=1 static_file_callback.o: $(STATIC_FILE_LOCATION)/static_file_callback.c $(CC) $(CFLAGS) $(STATIC_FILE_LOCATION)/static_file_callback.c diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/include/ulfius-cfg.h.in new/ulfius-2.5.4/include/ulfius-cfg.h.in --- old/ulfius-2.5.2/include/ulfius-cfg.h.in 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/include/ulfius-cfg.h.in 2019-04-04 02:16:24.000000000 +0200 @@ -28,6 +28,7 @@ #define ULFIUS_VERSION ${PROJECT_VERSION} #cmakedefine U_DISABLE_JANSSON #cmakedefine U_DISABLE_CURL +#cmakedefine U_DISABLE_GNUTLS #cmakedefine U_DISABLE_WEBSOCKET #cmakedefine U_DISABLE_YDER #cmakedefine U_WITH_FREERTOS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/include/ulfius.h new/ulfius-2.5.4/include/ulfius.h --- old/ulfius-2.5.2/include/ulfius.h 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/include/ulfius.h 2019-04-04 02:16:24.000000000 +0200 @@ -30,12 +30,15 @@ /** External dependencies **/ -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include <gnutls/gnutls.h> #include <gnutls/x509.h> +#endif + +#ifndef U_DISABLE_WEBSOCKET #include <poll.h> #ifndef POLLRDHUP #define POLLRDHUP 0x2000 @@ -184,7 +187,7 @@ struct _u_map * map_post_body; void * binary_body; size_t binary_body_length; -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS gnutls_x509_crt_t client_cert; char * client_cert_file; char * client_key_file; @@ -318,7 +321,7 @@ void * file_upload_cls; int mhd_response_copy_data; int check_utf8; -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS int use_client_cert_auth; #endif }; @@ -380,7 +383,7 @@ */ int ulfius_start_secure_framework(struct _u_instance * u_instance, const char * key_pem, const char * cert_pem); -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS /** * ulfius_start_secure_ca_trust_framework * Initializes the framework and run the webservice based on the parameters given using an HTTPS connection @@ -1322,6 +1325,9 @@ int pthread_init; }; +#endif // U_DISABLE_WEBSOCKET + +#ifndef U_DISABLE_GNUTLS /* * ulfius_export_client_certificate_pem * Exports the client certificate using PEM format @@ -1339,6 +1345,6 @@ */ int ulfius_import_client_certificate_pem(struct _u_request * request, const char * str_cert); -#endif // U_DISABLE_WEBSOCKET +#endif // U_DISABLE_GNUTLS #endif // __ULFIUS_H__ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/src/Makefile new/ulfius-2.5.4/src/Makefile --- old/ulfius-2.5.2/src/Makefile 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/src/Makefile 2019-04-04 02:16:24.000000000 +0200 @@ -28,7 +28,7 @@ LIBS=-L$(DESTDIR)/lib -lc -lmicrohttpd -lorcania -lpthread $(LDFLAGS) OBJECTS=ulfius.o u_map.o u_request.o u_response.o u_send_request.o u_websocket.o yuarel.o OUTPUT=libulfius.so -VERSION=2.5.2 +VERSION=2.5.4 ifndef JANSSONFLAG DISABLE_JANSSON=0 @@ -44,9 +44,16 @@ DISABLE_CURL=1 endif +ifndef GNUTLSFLAG +DISABLE_GNUTLS=0 +LGNUTLS=-lgnutls +else +DISABLE_GNUTLS=1 +WEBSOCKETFLAG=1 +endif + ifndef WEBSOCKETFLAG DISABLE_WEBSOCKET=0 -LWEBSOCKET=-lgnutls else DISABLE_WEBSOCKET=1 endif @@ -98,6 +105,13 @@ sed -i -e 's/\#cmakedefine U_DISABLE_CURL/\/* #undef U_DISABLE_CURL *\//g' $(CONFIG_FILE); \ echo "CURL SUPPORT ENABLED"; \ fi + @if [ "$(DISABLE_GNUTLS)" = "1" ]; then \ + sed -i -e 's/\#cmakedefine U_DISABLE_GNUTLS/\#define U_DISABLE_GNUTLS/g' $(CONFIG_FILE); \ + echo "GNUTLS SUPPORT DISABLED"; \ + else \ + sed -i -e 's/\#cmakedefine U_DISABLE_GNUTLS/\/* #undef U_DISABLE_GNUTLS *\//g' $(CONFIG_FILE); \ + echo "GNUTLS SUPPORT ENABLED"; \ + fi @pkg-config --atleast-version=0.9.53 libmicrohttpd; \ if [ $$? -ne 0 ] || [ "$(DISABLE_WEBSOCKET)" = "1" ]; then \ sed -i -e 's/\#cmakedefine U_DISABLE_WEBSOCKET/\#define U_DISABLE_WEBSOCKET/g' $(CONFIG_FILE); \ @@ -134,7 +148,7 @@ $(CC) $(CFLAGS) $< libulfius.so: $(OBJECTS) - $(CC) -shared -fPIC -Wl,-soname,$(OUTPUT) -o $(OUTPUT).$(VERSION) $(OBJECTS) $(LIBS) $(LYDER) $(LJANSSON) $(LCURL) $(LWEBSOCKET) + $(CC) -shared -fPIC -Wl,-soname,$(OUTPUT) -o $(OUTPUT).$(VERSION) $(OBJECTS) $(LIBS) $(LYDER) $(LJANSSON) $(LCURL) $(LGNUTLS) ln -sf $(OUTPUT).$(VERSION) $(OUTPUT) libulfius.a: $(OBJECTS) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/src/u_request.c new/ulfius-2.5.4/src/u_request.c --- old/ulfius-2.5.2/src/u_request.c 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/src/u_request.c 2019-04-04 02:16:24.000000000 +0200 @@ -274,7 +274,7 @@ request->client_address = NULL; request->binary_body = NULL; request->binary_body_length = 0; -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS request->client_cert = NULL; request->client_cert_file = NULL; request->client_key_file = NULL; @@ -317,7 +317,7 @@ request->map_cookie = NULL; request->map_post_body = NULL; request->binary_body = NULL; -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS gnutls_x509_crt_deinit(request->client_cert); o_free(request->client_cert_file); o_free(request->client_key_file); @@ -342,7 +342,6 @@ return U_ERROR_PARAMS; } } - /** * ulfius_copy_request * Copy the source request elements into the dest request @@ -359,13 +358,15 @@ dest->timeout = source->timeout; dest->auth_basic_user = o_strdup(source->auth_basic_user); dest->auth_basic_password = o_strdup(source->auth_basic_password); - dest->client_address = o_malloc(sizeof(struct sockaddr)); - if (dest->client_address != NULL) { - memcpy(dest->client_address, source->client_address, sizeof(struct sockaddr)); - } else { - y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error allocating resources for dest->client_address"); - ret = U_ERROR_MEMORY; + if (source->client_address != NULL) { + dest->client_address = o_malloc(sizeof(struct sockaddr)); + if (dest->client_address != NULL) { + memcpy(dest->client_address, source->client_address, sizeof(struct sockaddr)); + } else { + y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error allocating resources for dest->client_address"); + ret = U_ERROR_MEMORY; + } } if (ret == U_OK && u_map_clean(dest->map_url) == U_OK && u_map_init(dest->map_url) == U_OK) { @@ -409,17 +410,22 @@ } if (ret == U_OK) { - dest->binary_body_length = source->binary_body_length; - dest->binary_body = o_malloc(source->binary_body_length); - if (dest->binary_body != NULL) { - memcpy(dest->binary_body, source->binary_body, source->binary_body_length); - } else { - y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error allocating resources for dest->binary_body"); - ret = U_ERROR_MEMORY; + if (source->binary_body_length) { + dest->binary_body_length = source->binary_body_length; + dest->binary_body = o_malloc(source->binary_body_length); + if (dest->binary_body != NULL) { + memcpy(dest->binary_body, source->binary_body, source->binary_body_length); + } else { + y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error allocating resources for dest->binary_body"); + ret = U_ERROR_MEMORY; + } } } -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS + dest->client_cert_file = o_strdup(source->client_cert_file); + dest->client_key_file = o_strdup(source->client_key_file); + dest->client_key_password = o_strdup(source->client_key_password); if (ret == U_OK && source->client_cert != NULL) { if (gnutls_x509_crt_init(&dest->client_cert) == 0) { char * str_cert = ulfius_export_client_certificate_pem(source); @@ -434,7 +440,6 @@ } } #endif - return ret; } else { return U_ERROR_PARAMS; @@ -454,80 +459,18 @@ return NULL; } if (ulfius_init_request(new_request) == U_OK) { - new_request->http_protocol = o_strdup(request->http_protocol); - new_request->http_verb = o_strdup(request->http_verb); - new_request->http_url = o_strdup(request->http_url); - new_request->proxy = o_strdup(request->proxy); - if ((new_request->http_verb == NULL && request->http_verb != NULL) || - (new_request->http_url == NULL && request->http_url != NULL) || - (new_request->proxy == NULL && request->proxy != NULL) || - (new_request->http_protocol == NULL && request->http_protocol != NULL)) { - y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error allocating memory for ulfius_duplicate_request"); + if (ulfius_copy_request(new_request, request) != U_OK) { + y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error ulfius_copy_request"); ulfius_clean_request_full(new_request); - return NULL; + new_request = NULL; } - if (request->client_address != NULL) { - new_request->client_address = o_malloc(sizeof(struct sockaddr)); - if (new_request->client_address == NULL) { - y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error allocating memory for new_request->client_address"); - ulfius_clean_request_full(new_request); - return NULL; - } - memcpy(new_request->client_address, request->client_address, sizeof(struct sockaddr)); - } - new_request->check_server_certificate = request->check_server_certificate; - new_request->timeout = request->timeout; - new_request->auth_basic_user = o_strdup(request->auth_basic_user); - new_request->auth_basic_password = o_strdup(request->auth_basic_password); - u_map_clean_full(new_request->map_url); - u_map_clean_full(new_request->map_header); - u_map_clean_full(new_request->map_cookie); - u_map_clean_full(new_request->map_post_body); - new_request->map_url = u_map_copy(request->map_url); - new_request->map_header = u_map_copy(request->map_header); - new_request->map_cookie = u_map_copy(request->map_cookie); - new_request->map_post_body = u_map_copy(request->map_post_body); - if ((new_request->map_url == NULL && request->map_url != NULL) || - (new_request->map_header == NULL && request->map_header != NULL) || - (new_request->map_cookie == NULL && request->map_cookie != NULL) || - (new_request->map_post_body == NULL && request->map_post_body != NULL)) { - ulfius_clean_request_full(new_request); - return NULL; - } - if (request->binary_body != NULL && request->binary_body_length > 0) { - new_request->binary_body = o_malloc(request->binary_body_length); - if (new_request->binary_body == NULL) { - y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error allocating memory for new_request->binary_body"); - ulfius_clean_request_full(new_request); - return NULL; - } - memcpy(new_request->binary_body, request->binary_body, request->binary_body_length); - } else { - new_request->binary_body_length = 0; - new_request->binary_body = NULL; - } - new_request->binary_body_length = request->binary_body_length; -#ifndef U_DISABLE_WEBSOCKET - if (request->client_cert != NULL) { - if (gnutls_x509_crt_init(&new_request->client_cert) == 0) { - char * str_cert = ulfius_export_client_certificate_pem(request); - if (ulfius_import_client_certificate_pem(new_request, str_cert) != U_OK) { - y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error ulfius_import_client_certificate_pem"); - ulfius_clean_request_full(new_request); - return NULL; - } - o_free(str_cert); - } else { - y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error gnutls_x509_crt_init"); - ulfius_clean_request_full(new_request); - return NULL; - } - } -#endif } else { + y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error ulfius_init_request"); o_free(new_request); new_request = NULL; } + } else { + y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error source request is NULL"); } return new_request; } @@ -586,7 +529,7 @@ } #endif -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS /* * ulfius_export_client_certificate_pem * Exports the client certificate using PEM format diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/src/u_response.c new/ulfius-2.5.4/src/u_response.c --- old/ulfius-2.5.2/src/u_response.c 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/src/u_response.c 2019-04-04 02:16:24.000000000 +0200 @@ -461,76 +461,6 @@ } /** - * create a new response based on the source elements - * return value must be free'd after use - */ -struct _u_response * ulfius_duplicate_response(const struct _u_response * response) { - struct _u_response * new_response = NULL; - unsigned int i; - if (response != NULL) { - new_response = o_malloc(sizeof(struct _u_response)); - if (new_response == NULL) { - y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error allocating memory for new_response"); - return NULL; - } - ulfius_init_response(new_response); - new_response->status = response->status; - new_response->protocol = o_strdup(response->protocol); - if (new_response->protocol == NULL) { - y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error allocating memory for new_response->protocol"); - ulfius_clean_response_full(new_response); - return NULL; - } - u_map_clean_full(new_response->map_header); - new_response->map_header = u_map_copy(response->map_header); - new_response->auth_realm = o_strdup(response->auth_realm); - new_response->nb_cookies = response->nb_cookies; - if (response->nb_cookies > 0) { - new_response->map_cookie = o_malloc(response->nb_cookies*sizeof(struct _u_cookie)); - if (new_response->map_cookie == NULL) { - y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error allocating memory for new_response->map_cookie"); - o_free(new_response); - return NULL; - } - for (i=0; i<response->nb_cookies; i++) { - ulfius_copy_cookie(&new_response->map_cookie[i], &response->map_cookie[i]); - } - } else { - new_response->map_cookie = NULL; - } - if (response->binary_body != NULL && response->binary_body_length > 0) { - new_response->binary_body = o_malloc(response->binary_body_length); - if (new_response->binary_body == NULL) { - y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error allocating memory for new_response->binary_body"); - o_free(new_response->map_cookie); - o_free(new_response); - return NULL; - } - new_response->binary_body_length = response->binary_body_length; - memcpy(new_response->binary_body, response->binary_body, response->binary_body_length); - } -#ifndef U_DISABLE_WEBSOCKET - if ((new_response->websocket_handle = o_malloc(sizeof(struct _websocket_handle))) != NULL) { - if (response->websocket_handle != NULL) { - ((struct _websocket_handle *)new_response->websocket_handle)->websocket_protocol = o_strdup(((struct _websocket_handle *)response->websocket_handle)->websocket_protocol); - ((struct _websocket_handle *)new_response->websocket_handle)->websocket_extensions = o_strdup(((struct _websocket_handle *)response->websocket_handle)->websocket_extensions); - ((struct _websocket_handle *)new_response->websocket_handle)->websocket_manager_callback = ((struct _websocket_handle *)response->websocket_handle)->websocket_manager_callback; - ((struct _websocket_handle *)new_response->websocket_handle)->websocket_manager_user_data = ((struct _websocket_handle *)response->websocket_handle)->websocket_manager_user_data; - ((struct _websocket_handle *)new_response->websocket_handle)->websocket_incoming_message_callback = ((struct _websocket_handle *)response->websocket_handle)->websocket_incoming_message_callback; - ((struct _websocket_handle *)new_response->websocket_handle)->websocket_incoming_user_data = ((struct _websocket_handle *)response->websocket_handle)->websocket_incoming_user_data; - ((struct _websocket_handle *)new_response->websocket_handle)->websocket_onclose_callback = ((struct _websocket_handle *)response->websocket_handle)->websocket_onclose_callback; - ((struct _websocket_handle *)new_response->websocket_handle)->websocket_onclose_user_data = ((struct _websocket_handle *)response->websocket_handle)->websocket_onclose_user_data; - } - } else { - ulfius_clean_response_full(new_response); - return NULL; - } -#endif - } - return new_response; -} - -/** * ulfius_copy_response * Copy the source response elements into the des response * return U_OK on success @@ -540,6 +470,7 @@ if (dest != NULL && source != NULL) { dest->status = source->status; dest->protocol = o_strdup(source->protocol); + dest->auth_realm = o_strdup(source->auth_realm); if (dest->protocol == NULL) { y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error allocating memory for dest->protocol"); return U_ERROR_MEMORY; @@ -572,6 +503,17 @@ dest->binary_body_length = source->binary_body_length; memcpy(dest->binary_body, source->binary_body, source->binary_body_length); } + + if (source->stream_callback != NULL) { + dest->stream_callback = source->stream_callback; + dest->stream_callback_free = source->stream_callback_free; + dest->stream_size = source->stream_size; + dest->stream_block_size = source->stream_block_size; + dest->stream_user_data = source->stream_user_data; + } + + dest->shared_data = source->shared_data; + dest->timeout = source->timeout; #ifndef U_DISABLE_WEBSOCKET if (source->websocket_handle != NULL) { ((struct _websocket_handle *)dest->websocket_handle)->websocket_protocol = o_strdup(((struct _websocket_handle *)source->websocket_handle)->websocket_protocol); @@ -591,6 +533,33 @@ } /** + * create a new response based on the source elements + * return value must be free'd after use + */ +struct _u_response * ulfius_duplicate_response(const struct _u_response * response) { + struct _u_response * new_response = NULL; + if (response != NULL) { + new_response = o_malloc(sizeof(struct _u_response)); + if (new_response == NULL) { + y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error allocating memory for new_response"); + return NULL; + } + if (ulfius_init_response(new_response) == U_OK) { + if (ulfius_copy_response(new_response, response) != U_OK) { + y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error ulfius_copy_response"); + ulfius_clean_response_full(new_response); + new_response = NULL; + } + } else { + y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error ulfius_init_response"); + o_free(new_response); + new_response = NULL; + } + } + return new_response; +} + +/** * ulfius_set_string_body_response * Set a string binary_body to a response * binary_body must end with a '\0' character diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/src/u_send_request.c new/ulfius-2.5.4/src/u_send_request.c --- old/ulfius-2.5.2/src/u_send_request.c 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/src/u_send_request.c 2019-04-04 02:16:24.000000000 +0200 @@ -203,7 +203,7 @@ } } -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS // Set client certificate authentication if defined if (request->client_cert_file != NULL && request->client_key_file != NULL) { if (curl_easy_setopt(curl_handle, CURLOPT_SSLCERT, request->client_cert_file) != CURLE_OK) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/src/u_websocket.c new/ulfius-2.5.4/src/u_websocket.c --- old/ulfius-2.5.2/src/u_websocket.c 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/src/u_websocket.c 2019-04-04 02:16:24.000000000 +0200 @@ -1621,8 +1621,8 @@ websocket_client_handler->websocket = websocket; } } else { - y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error allocating resources for websocket"); - ret = U_ERROR_MEMORY; + y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error allocating resources for websocket"); + ret = U_ERROR_MEMORY; } } else { y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Unknown scheme, please use one of the following: 'http', 'https', 'ws', 'wss'"); @@ -1695,8 +1695,14 @@ * wether the websocket is open or closed, or U_WEBSOCKET_STATUS_ERROR on error */ int ulfius_websocket_client_connection_wait_close(struct _websocket_client_handler * websocket_client_handler, unsigned int timeout) { + int ret; + if (websocket_client_handler != NULL) { - return ulfius_websocket_wait_close(websocket_client_handler->websocket->websocket_manager, timeout); + ret = ulfius_websocket_wait_close(websocket_client_handler->websocket->websocket_manager, timeout); + if (ret == U_WEBSOCKET_STATUS_CLOSE && websocket_client_handler->websocket != NULL) { + ulfius_clear_websocket(websocket_client_handler->websocket); + } + return ret; } else { return U_WEBSOCKET_STATUS_ERROR; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/src/ulfius.c new/ulfius-2.5.4/src/ulfius.c --- old/ulfius-2.5.2/src/ulfius.c 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/src/ulfius.c 2019-04-04 02:16:24.000000000 +0200 @@ -352,7 +352,9 @@ // Websocket variables int upgrade_protocol = 0; char * protocol = NULL, * extension = NULL; +#endif +#ifndef U_DISABLE_GNUTLS // Client certificate authentication variables const union MHD_ConnectionInfo * ci; unsigned int listsize; @@ -383,7 +385,7 @@ if (con_info->callback_first_iteration) { -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS ci = MHD_get_connection_info (connection, MHD_CONNECTION_INFO_GNUTLS_SESSION); if (((struct _u_instance *)cls)->use_client_cert_auth && ci != NULL && ci->tls_session != NULL) { if ((ret_cert = gnutls_certificate_verify_peers2(ci->tls_session, &client_cert_status)) != 0 && ret_cert != GNUTLS_E_NO_CERTIFICATE_FOUND) { @@ -855,7 +857,7 @@ * return U_OK on success */ int ulfius_start_framework(struct _u_instance * u_instance) { -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS return ulfius_start_secure_ca_trust_framework(u_instance, NULL, NULL, NULL); #else return ulfius_start_secure_framework(u_instance, NULL, NULL); @@ -872,7 +874,7 @@ * return U_OK on success */ int ulfius_start_secure_framework(struct _u_instance * u_instance, const char * key_pem, const char * cert_pem) { -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS return ulfius_start_secure_ca_trust_framework(u_instance, key_pem, cert_pem, NULL); #else // Check parameters and validate u_instance and endpoint_list that there is no mistake @@ -901,7 +903,7 @@ #endif } -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS /** * ulfius_start_secure_ca_trust_framework * Initializes the framework and run the webservice based on the parameters given using an HTTPS connection @@ -1409,8 +1411,10 @@ u_instance->max_post_body_size = 0; u_instance->file_upload_callback = NULL; u_instance->file_upload_cls = NULL; -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS u_instance->use_client_cert_auth = 0; +#endif +#ifndef U_DISABLE_WEBSOCKET u_instance->websocket_handler = o_malloc(sizeof(struct _websocket_handler)); if (u_instance->websocket_handler == NULL) { y_log_message(Y_LOG_LEVEL_ERROR, "Ulfius - Error allocating memory for u_instance->websocket_handler"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/test/Makefile new/ulfius-2.5.4/test/Makefile --- old/ulfius-2.5.2/test/Makefile 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/test/Makefile 2019-04-04 02:16:24.000000000 +0200 @@ -21,6 +21,7 @@ ULFIUS_INCLUDE=../include ULFIUS_LOCATION=../src +ULFIUS_LIBRARY=$(ULFIUS_LOCATION)/libulfius.so CC=gcc CFLAGS+=-Wall -D_REENTRANT -I$(ULFIUS_INCLUDE) -DDEBUG -g -O0 $(CPPFLAGS) LIBS=-lc -lorcania -lulfius -lgnutls -lcheck -lpthread -lm -lrt -lsubunit -L$(ULFIUS_LOCATION) @@ -28,39 +29,47 @@ #LIBS=-lc -lorcania -lyder -lulfius -lcheck -lpthread -lm -lrt -lsubunit -L$(ULFIUS_LOCATION) # Use this LIBS below if you use yder logs #LIBS=-lc -lorcania -lyder -lulfius -lgnutls -lcheck -lpthread -lm -lrt -lsubunit -L$(ULFIUS_LOCATION) +VALGRIND_COMMAND=valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all all: test clean: - rm -f *.o u_map core framework websocket valgrind.txt + rm -f *.o u_map core framework websocket valgrind-*.txt -libulfius.so: +$(ULFIUS_LIBRARY): cd $(ULFIUS_LOCATION) && $(MAKE) debug u_map: u_map.c $(CC) $(CFLAGS) u_map.c -o u_map $(LIBS) -test_u_map: libulfius.so u_map +test_u_map: $(ULFIUS_LIBRARY) u_map -LD_LIBRARY_PATH=$(ULFIUS_LOCATION):${LD_LIBRARY_PATH} ./u_map core: core.c $(CC) $(CFLAGS) core.c -o core $(LIBS) -test_core: libulfius.so core +test_core: $(ULFIUS_LIBRARY) core -LD_LIBRARY_PATH=$(ULFIUS_LOCATION):${LD_LIBRARY_PATH} ./core framework: framework.c $(CC) $(CFLAGS) framework.c -o framework $(LIBS) -test_framework: libulfius.so framework +test_framework: $(ULFIUS_LIBRARY) framework -LD_LIBRARY_PATH=$(ULFIUS_LOCATION):${LD_LIBRARY_PATH} ./framework websocket: websocket.c $(CC) $(CFLAGS) websocket.c -o websocket $(LIBS) -test_websocket: libulfius.so websocket +test_websocket: $(ULFIUS_LIBRARY) websocket -LD_LIBRARY_PATH=$(ULFIUS_LOCATION):${LD_LIBRARY_PATH} ./websocket test: test_u_map test_core test_framework test_websocket check: test + +memcheck: $(ULFIUS_LIBRARY) u_map core framework websocket + -CK_FORK=no LD_LIBRARY_PATH=$(ULFIUS_LOCATION):${LD_LIBRARY_PATH} $(VALGRIND_COMMAND) ./u_map 2>valgrind-u_map.txt + -CK_FORK=no LD_LIBRARY_PATH=$(ULFIUS_LOCATION):${LD_LIBRARY_PATH} $(VALGRIND_COMMAND) ./core 2>valgrind-core.txt + # test framework seems not to work properly when CK_FORK=no is used, so using it old school with forks then + -LD_LIBRARY_PATH=$(ULFIUS_LOCATION):${LD_LIBRARY_PATH} $(VALGRIND_COMMAND) ./framework 2>valgrind-framework.txt + -CK_FORK=no LD_LIBRARY_PATH=$(ULFIUS_LOCATION):${LD_LIBRARY_PATH} $(VALGRIND_COMMAND) ./websocket 2>valgrind-websocket.txt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/test/core.c new/ulfius-2.5.4/test/core.c --- old/ulfius-2.5.2/test/core.c 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/test/core.c 2019-04-04 02:16:24.000000000 +0200 @@ -118,12 +118,12 @@ { struct _u_instance u_instance; - ck_assert_int_eq(ulfius_start_framework(NULL), U_ERROR_PARAMS); - ck_assert_int_eq(ulfius_start_secure_framework(NULL, NULL, NULL), U_ERROR_PARAMS); - ck_assert_int_eq(ulfius_init_instance(&u_instance, 8080, NULL, NULL), U_OK); + ck_assert_int_eq(ulfius_init_instance(&u_instance, 8081, NULL, NULL), U_OK); ck_assert_int_eq(ulfius_add_endpoint_by_val(&u_instance, "GET", NULL, "test", 0, &callback_function_empty, NULL), U_OK); ck_assert_int_eq(ulfius_start_framework(&u_instance), U_OK); ck_assert_int_eq(ulfius_stop_framework(&u_instance), U_OK); + ck_assert_int_eq(ulfius_start_framework(NULL), U_ERROR_PARAMS); + ck_assert_int_eq(ulfius_start_secure_framework(NULL, NULL, NULL), U_ERROR_PARAMS); ck_assert_int_eq(ulfius_start_secure_framework(&u_instance, "error", "error"), U_ERROR_LIBMHD); ck_assert_int_eq(ulfius_start_secure_framework(&u_instance, "-----BEGIN PRIVATE KEY-----\ MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDr90HrswgEmln/\ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ulfius-2.5.2/test/framework.c new/ulfius-2.5.4/test/framework.c --- old/ulfius-2.5.2/test/framework.c 2018-12-24 15:43:31.000000000 +0100 +++ new/ulfius-2.5.4/test/framework.c 2019-04-04 02:16:24.000000000 +0200 @@ -276,7 +276,7 @@ return U_OK; } -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS int callback_auth_client_cert (const struct _u_request * request, struct _u_response * response, void * user_data) { char * dn; size_t lbuf = 0; @@ -730,7 +730,7 @@ } END_TEST -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS START_TEST(test_ulfius_server_ca_trust) { struct _u_instance u_instance; @@ -808,7 +808,7 @@ tcase_add_test(tc_core, test_ulfius_endpoint_stream); tcase_add_test(tc_core, test_ulfius_utf8_not_ignored); tcase_add_test(tc_core, test_ulfius_utf8_ignored); -#ifndef U_DISABLE_WEBSOCKET +#ifndef U_DISABLE_GNUTLS tcase_add_test(tc_core, test_ulfius_server_ca_trust); tcase_add_test(tc_core, test_ulfius_client_certificate); #endif
