From 62f178c2ee2ad10984b4d7f17c5920653d91181d Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Fri, 29 May 2015 09:24:43 +0000 Subject: [PATCH] fixed: in App::CheckIfNeedSSLredirect() winix made an incorrect redirect from/to SSL git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1009 e52654a7-88a9-db11-a3e9-0013d4bc506e --- core/app.cpp | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/core/app.cpp b/core/app.cpp index 10b739c..5db4ca1 100644 --- a/core/app.cpp +++ b/core/app.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2010-2014, Tomasz Sowa + * Copyright (c) 2010-2015, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -308,11 +308,31 @@ void App::CheckIfNeedSSLredirect() if( config.use_ssl ) { - if( !cur.request->using_ssl ) + if( config.use_ssl_only_for_logged_users ) { - if( !config.use_ssl_only_for_logged_users || - cur.session->puser || - (cur.request->function && cur.request->function->need_ssl) ) + if( cur.request->using_ssl ) + { + if( !cur.session->puser ) + { + log << log3 << "App: this operation should NOT be used through SSL" << logend; + BaseUrlRedirect(config.use_ssl_redirect_code, true); + } + } + else + { + if( cur.session->puser ) + { + log << log3 << "App: this operation should be used through SSL" << logend; + BaseUrlRedirect(config.use_ssl_redirect_code, true); + } + } + } + else + { + /* + * use ssl for everyone + */ + if( !cur.request->using_ssl ) { log << log3 << "App: this operation should be used through SSL" << logend; BaseUrlRedirect(config.use_ssl_redirect_code, true);