Author: jleroux
Date: Wed Mar 1 20:10:11 2017 New Revision: 1785027 URL: http://svn.apache.org/viewvc?rev=1785027&view=rev Log: Fixed: "Login and logout process in demos shows a certificate issue" (OFBIZ-9206) After my conclusions at OFBIZ-9240 I decided to reapply the changes Because WebSiteProperties reuse the port initially found in the 1st login URL I tried to replace locally port.https=8443 by port.https= in url.properties (w/o SystemProperty) and did not face any issue but with portOffset. This is due to the WebSiteProperties class works and there is also an easy fix: don't add twice the portOffset when it's build from the request, and only then. Keep it as is when it's build from a WebSite GenericValue. We then trust the user and don't rely on the request. I also removed the deprecated RequestHandler.getDefaultServerRootUrl() I think it was time... Modified: ofbiz/branches/release14.12/framework/webapp/config/url.properties ofbiz/branches/release14.12/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java ofbiz/branches/release15.12/framework/webapp/config/url.properties ofbiz/branches/release15.12/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java Modified: ofbiz/branches/release14.12/framework/webapp/config/url.properties URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/framework/webapp/config/url.properties?rev=1785027&r1=1785026&r2=1785027&view=diff ============================================================================== --- ofbiz/branches/release14.12/framework/webapp/config/url.properties (original) +++ ofbiz/branches/release14.12/framework/webapp/config/url.properties Wed Mar 1 20:10:11 2017 @@ -22,7 +22,8 @@ # HTTPS Port (Secure port) port.https.enabled=Y -port.https=8443 +# empty by default see OFBIZ-9206 +port.https= force.https.host= # HTTP Port (Not Secure port) Modified: ofbiz/branches/release14.12/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java?rev=1785027&r1=1785026&r2=1785027&view=diff ============================================================================== --- ofbiz/branches/release14.12/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java (original) +++ ofbiz/branches/release14.12/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java Wed Mar 1 20:10:11 2017 @@ -57,6 +57,7 @@ public final class WebSiteProperties { Assert.notNull("request", request); WebSiteProperties webSiteProps = (WebSiteProperties) request.getAttribute("_WEBSITE_PROPS_"); if (webSiteProps == null) { + Boolean dontAddPortoffset = false; Delegator delegator = (Delegator) request.getAttribute("delegator"); WebSiteProperties defaults = new WebSiteProperties(delegator); String httpPort = defaults.getHttpPort(); @@ -95,6 +96,7 @@ public final class WebSiteProperties { } if (httpsPort.isEmpty() && request.isSecure()) { httpsPort = String.valueOf(request.getServerPort()); + dontAddPortoffset = true; // We take the port from the request, don't add the portOffset } if (httpsHost.isEmpty()) { httpsHost = request.getServerName(); @@ -104,10 +106,14 @@ public final class WebSiteProperties { Integer httpPortValue = Integer.valueOf(httpPort); httpPortValue += Start.getInstance().getConfig().portOffset; httpPort = httpPortValue.toString(); - Integer httpsPortValue = Integer.valueOf(httpsPort); - httpsPortValue += Start.getInstance().getConfig().portOffset; - httpsPort = httpsPortValue.toString(); - } + if (!dontAddPortoffset) { + Integer httpsPortValue = Integer.valueOf(httpsPort); + if (!httpsPort.isEmpty()) { + httpsPortValue += Start.getInstance().getConfig().portOffset; + } + httpsPort = httpsPortValue.toString(); + } + } webSiteProps = new WebSiteProperties(httpPort, httpHost, httpsPort, httpsHost, enableHttps); request.setAttribute("_WEBSITE_PROPS_", webSiteProps); @@ -138,9 +144,9 @@ public final class WebSiteProperties { httpPortValue += Start.getInstance().getConfig().portOffset; httpPort = httpPortValue.toString(); Integer httpsPortValue = Integer.valueOf(httpsPort); - httpsPortValue += Start.getInstance().getConfig().portOffset; + httpsPortValue += Start.getInstance().getConfig().portOffset; // Here unlike above we trust the user and don't rely on the request, no dontAddPortoffset. httpsPort = httpsPortValue.toString(); - } + } return new WebSiteProperties(httpPort, httpHost, httpsPort, httpsHost, enableHttps); } Modified: ofbiz/branches/release15.12/framework/webapp/config/url.properties URL: http://svn.apache.org/viewvc/ofbiz/branches/release15.12/framework/webapp/config/url.properties?rev=1785027&r1=1785026&r2=1785027&view=diff ============================================================================== --- ofbiz/branches/release15.12/framework/webapp/config/url.properties (original) +++ ofbiz/branches/release15.12/framework/webapp/config/url.properties Wed Mar 1 20:10:11 2017 @@ -22,7 +22,8 @@ # HTTPS Port (Secure port) port.https.enabled=Y -port.https=8443 +# empty by default see OFBIZ-9206 +port.https= force.https.host= # HTTP Port (Not Secure port) Modified: ofbiz/branches/release15.12/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release15.12/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java?rev=1785027&r1=1785026&r2=1785027&view=diff ============================================================================== --- ofbiz/branches/release15.12/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java (original) +++ ofbiz/branches/release15.12/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java Wed Mar 1 20:10:11 2017 @@ -57,6 +57,7 @@ public final class WebSiteProperties { Assert.notNull("request", request); WebSiteProperties webSiteProps = (WebSiteProperties) request.getAttribute("_WEBSITE_PROPS_"); if (webSiteProps == null) { + Boolean dontAddPortoffset = false; Delegator delegator = (Delegator) request.getAttribute("delegator"); WebSiteProperties defaults = new WebSiteProperties(delegator); String httpPort = defaults.getHttpPort(); @@ -95,6 +96,7 @@ public final class WebSiteProperties { } if (httpsPort.isEmpty() && request.isSecure()) { httpsPort = String.valueOf(request.getServerPort()); + dontAddPortoffset = true; // We take the port from the request, don't add the portOffset } if (httpsHost.isEmpty()) { httpsHost = request.getServerName(); @@ -104,10 +106,14 @@ public final class WebSiteProperties { Integer httpPortValue = Integer.valueOf(httpPort); httpPortValue += Start.getInstance().getConfig().portOffset; httpPort = httpPortValue.toString(); - Integer httpsPortValue = Integer.valueOf(httpsPort); - httpsPortValue += Start.getInstance().getConfig().portOffset; - httpsPort = httpsPortValue.toString(); - } + if (!dontAddPortoffset) { + Integer httpsPortValue = Integer.valueOf(httpsPort); + if (!httpsPort.isEmpty()) { + httpsPortValue += Start.getInstance().getConfig().portOffset; + } + httpsPort = httpsPortValue.toString(); + } + } webSiteProps = new WebSiteProperties(httpPort, httpHost, httpsPort, httpsHost, enableHttps); request.setAttribute("_WEBSITE_PROPS_", webSiteProps); @@ -138,9 +144,9 @@ public final class WebSiteProperties { httpPortValue += Start.getInstance().getConfig().portOffset; httpPort = httpPortValue.toString(); Integer httpsPortValue = Integer.valueOf(httpsPort); - httpsPortValue += Start.getInstance().getConfig().portOffset; + httpsPortValue += Start.getInstance().getConfig().portOffset; // Here unlike above we trust the user and don't rely on the request, no dontAddPortoffset. httpsPort = httpsPortValue.toString(); - } + } return new WebSiteProperties(httpPort, httpHost, httpsPort, httpsHost, enableHttps); } |
Free forum by Nabble | Edit this page |