From e691b65ce3c82cf3781e8d02e92a4a2af07c5b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 12 Jan 2019 13:19:59 +0100 Subject: New upstream version 2.0.3 --- .travis.yml | 7 +------ changelog | 6 ++++++ configure.ac | 2 +- lib/icap/Makefile.am | 2 +- lib/icap/header.cpp | 9 +++------ modules/echo/echo.cpp | 8 ++++++-- modules/modpy/modules/modpy.py | 9 +++++++-- 7 files changed, 25 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index b3dd807..c04a319 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,11 +2,6 @@ language: cpp sudo: false -addons: - apt: - packages: - - liblog4cpp5-dev - compiler: - gcc - clang @@ -14,7 +9,7 @@ compiler: before_install: - echo $LANG - echo $LC_ALL - - if [ $TRAVIS_OS_NAME == osx ]; then brew update && brew install libconfig log4cpp; fi + - if [ $TRAVIS_OS_NAME == osx ]; then brew update && brew install libconfig; fi install: - curl -L https://github.com/nukedzn/psocksxx/releases/download/v1.1.1/psocksxx-1.1.1.tar.gz | tar -zx -C /tmp diff --git a/changelog b/changelog index 62f726d..e773e5f 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,9 @@ +2.0.3 - 27th December 2018 + * Fix encapsulated header data in icap responses (issue #12) + +2.0.2 - 25th December 2018 + * Fix modules to return valid icap responses (issue #10) + 2.0.1 - 11th July 2018 * Fix spelling mistakes diff --git a/configure.ac b/configure.ac index c594e34..a374c48 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.68]) -AC_INIT([bitz-server], [2.0.1], [https://github.com/uditha-atukorala/bitz-server/issues]) +AC_INIT([bitz-server], [2.0.3], [https://github.com/uditha-atukorala/bitz-server/issues]) AC_CONFIG_AUX_DIR([aux-build]) AC_CONFIG_MACRO_DIR([aux-build/m4]) AC_CONFIG_HEADERS([include/config.h]) diff --git a/lib/icap/Makefile.am b/lib/icap/Makefile.am index f73a8f6..a5608db 100644 --- a/lib/icap/Makefile.am +++ b/lib/icap/Makefile.am @@ -1,5 +1,5 @@ ## [icap-library] lib/icap/ -AM_CPPFLAGS = -I$(top_srcdir)/lib ${psocksxx_CFLAGS} +AM_CPPFLAGS = -std=c++11 -I$(top_srcdir)/lib ${psocksxx_CFLAGS} libicapincludedir = $(includedir)/icap lib_LTLIBRARIES = libicap.la diff --git a/lib/icap/header.cpp b/lib/icap/header.cpp index 493e659..ca72bc8 100644 --- a/lib/icap/header.cpp +++ b/lib/icap/header.cpp @@ -140,20 +140,17 @@ namespace icap { * OPTIONS response encapsulated_list: optbody */ - Header::encapsulated_header_index_t idx; std::string encaps_header = ""; - // FIXME: chances are that we will always get the correct order - // but should consider sorting - for ( idx = _encapsulated.begin(); idx != _encapsulated.end(); idx++ ) { + for ( auto& idx : sort_encapsulated_header() ) { - if ( idx->second > 0 ) { + if ( idx.second >= 0 ) { if ( encaps_header != "" ) { encaps_header.append( ", " ); } - encaps_header.append( idx->first ).append( "=" ).append( util::itoa( idx->second ) ); + encaps_header.append( idx.first ).append( "=" ).append( util::itoa( idx.second ) ); } diff --git a/modules/echo/echo.cpp b/modules/echo/echo.cpp index a8496c5..4250802 100644 --- a/modules/echo/echo.cpp +++ b/modules/echo/echo.cpp @@ -32,8 +32,12 @@ namespace bitz { icap::payload_t payload; // copy payload from request - payload.req_header = request->payload().req_header; - payload.req_body = request->payload().req_body; + if ( request->header()->method() == "REQMOD" ) { + payload.req_header = request->payload().req_header; + payload.req_body = request->payload().req_body; + } + + // response body should only have content for RESPMOD requests payload.res_header = request->payload().res_header; payload.res_body = request->payload().res_body; diff --git a/modules/modpy/modules/modpy.py b/modules/modpy/modules/modpy.py index 874a615..1751cca 100644 --- a/modules/modpy/modules/modpy.py +++ b/modules/modpy/modules/modpy.py @@ -31,8 +31,13 @@ def modify( request ): # response resp_payload = {}; - resp_payload['req_header'] = req_payload['req_header']; - resp_payload['req_body'] = req_payload['req_body']; + if request['request'] == 'REQMOD': + resp_payload['req_header'] = req_payload['req_header']; + resp_payload['req_body'] = req_payload['req_body']; + else: + resp_payload['req_header'] = ''; + resp_payload['req_body'] = ''; + resp_payload['res_header'] = req_payload['res_header']; resp_payload['res_body'] = req_payload['res_body']; resp_payload['ieof'] = True; -- cgit v1.2.3