From 3eff400d88eb70e1538bb6274834df4aaefae06f Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Mon, 1 Jan 2018 00:14:02 +0000 Subject: [PATCH] added: "assume_connection_is_through_ssl" config parameter winix is testing an environment variable "HTTPS" for the value "on" to think that the connection is made via SSL you can set assume_connection_is_through_ssl to true for the winix to not testing any environment variables but just think the connection was made by https (useful when using proxy) default: false git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1069 e52654a7-88a9-db11-a3e9-0013d4bc506e --- winixd/Makefile | 6 +++--- winixd/core/app.cpp | 3 +++ winixd/core/config.cpp | 5 +++-- winixd/core/config.h | 12 ++++++++++-- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/winixd/Makefile b/winixd/Makefile index d0e96a8..f68fb4b 100644 --- a/winixd/Makefile +++ b/winixd/Makefile @@ -13,21 +13,21 @@ global_relative_working_dir := $(shell relative_path $(current_path) $(GLOBAL_WO ifeq ($(CXX), g++) - CXX = g++-4.8 + CXX = g++6 endif ifndef CXX ifeq ($(OSTYPE), FreeBSD) CXX = clang++ else - CXX = g++-4.8 + CXX = g++6 endif endif # CXX = g++-4.8 ifndef CXXFLAGS -CXXFLAGS = -Wall -O0 -g -fPIC -pthread -std=c++11 -I/usr/local/include -I/usr/include/postgresql -DEZC_USE_WINIX_LOGGER -DEZC_HAS_SPECIAL_STREAM +CXXFLAGS = -Wall -O0 -g -fPIC -pthread -std=c++17 -I/usr/local/include -I/usr/include/postgresql -DEZC_USE_WINIX_LOGGER -DEZC_HAS_SPECIAL_STREAM endif ifndef AR diff --git a/winixd/core/app.cpp b/winixd/core/app.cpp index 6459e0b..1312302 100644 --- a/winixd/core/app.cpp +++ b/winixd/core/app.cpp @@ -808,6 +808,9 @@ void App::CheckSSL() // value "on" exists in lighttpd server // make sure that for other servers is "on" too + if( config.assume_connection_is_through_ssl ) + cur.request->using_ssl = true; + else if( EqualNoCase(cur.request->env_https.c_str(), L"on") ) cur.request->using_ssl = true; } diff --git a/winixd/core/config.cpp b/winixd/core/config.cpp index 2ce1e2d..a4ec5d7 100644 --- a/winixd/core/config.cpp +++ b/winixd/core/config.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2008-2016, Tomasz Sowa + * Copyright (c) 2008-2017, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -197,8 +197,9 @@ void Config::AssignValues(bool stdout_is_closed) use_ssl = Bool(L"use_ssl", false); use_ssl_static = Bool(L"use_ssl_static", false); use_ssl_common = Bool(L"use_ssl_common", false); - use_ssl_only_for_logged_users = Bool(L"use_ssl_only_for_logged_users", true); + use_ssl_only_for_logged_users = Bool(L"use_ssl_only_for_logged_users", false); use_ssl_redirect_code = Int(L"use_ssl_redirect_code", 303); + assume_connection_is_through_ssl = Bool(L"assume_connection_is_through_ssl", false); base_url = Text(L"base_url"); base_url_static = Text(L"base_url_static"); diff --git a/winixd/core/config.h b/winixd/core/config.h index 405dd5e..d324f9c 100644 --- a/winixd/core/config.h +++ b/winixd/core/config.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2008-2016, Tomasz Sowa + * Copyright (c) 2008-2017, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -484,7 +484,7 @@ public: // if SSL is enabled then if this is true the SSL will be used // only for logged users - // default: true + // default: false bool use_ssl_only_for_logged_users; // if current connection is without SSL and should be made through SSL @@ -493,6 +493,14 @@ public: // default: 303 int use_ssl_redirect_code; + // winix is testing an environment variable "HTTPS" for the value "on" + // to think that the connection is made via SSL + // you can set assume_connection_is_through_ssl to true for the winix + // to not testing any environment variables but just think the connection + // was made by https (useful when using proxy) + // default: false + bool assume_connection_is_through_ssl; + // when the HOST_HTTP environment variable is not equal to 'base_url' // (the part 'http://' and the last slash is removed) // the server will redirect into base_url + 'REQUEST_URI'