svn commit: r1784766 - in /ofbiz/branches: release14.12/framework/webapp/config/ release14.12/framework/webapp/src/org/ofbiz/webapp/website/ release15.12/framework/webapp/config/ release15.12/framework/webapp/src/org/ofbiz/webapp/website/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1784766 - in /ofbiz/branches: release14.12/framework/webapp/config/ release14.12/framework/webapp/src/org/ofbiz/webapp/website/ release15.12/framework/webapp/config/ release15.12/framework/webapp/src/org/ofbiz/webapp/website/

jleroux@apache.org
Author: jleroux
Date: Tue Feb 28 15:45:52 2017
New Revision: 1784766

URL: http://svn.apache.org/viewvc?rev=1784766&view=rev
Log:
Reverts revision(s) 1784560, 1784556 from R15.12 & 14.12

No functional change, cleaner code
........
"Partially backport fix from trunk framework for revision: 1784549  "
------------------------------------------------------------------------
r1784549 | jleroux | 2017-02-27 13:33:42 +0100 (lun. 27 fev. 2017) | 26 lignes

I kept getDefaultServerRootUrl() and simplified changes in url.properties


Fixed: "Login and logout process in demos shows a certificate issue"
(OFBIZ-9206)

Also fixes "16.11 ofbizUrl include host+port and break some reverse-proxy/docker
 setups"
(OFBIZ-9224)

It was an easy fix, I just imported
<SystemProperty systemPropertyId="port.https" systemResourceId="url"
systemPropertyValue=""/>
in trunk demo and all work perfectly.

I also 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.

Thanks: Pierre Smits and Leonard Lin for reports
------------------------------------------------------------------------
........

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=1784766&r1=1784765&r2=1784766&view=diff
==============================================================================
--- ofbiz/branches/release14.12/framework/webapp/config/url.properties (original)
+++ ofbiz/branches/release14.12/framework/webapp/config/url.properties Tue Feb 28 15:45:52 2017
@@ -22,8 +22,7 @@
 
 # HTTPS Port (Secure port)
 port.https.enabled=Y
-# empty by default see OFBIZ-9206
-port.https=
+port.https=8443
 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=1784766&r1=1784765&r2=1784766&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 Tue Feb 28 15:45:52 2017
@@ -57,7 +57,6 @@ public final class WebSiteProperties {
         Assert.notNull("request", request);
         WebSiteProperties webSiteProps = (WebSiteProperties) request.getAttribute("_WEBSITE_PROPS_");
         if (webSiteProps == null) {
-            Boolean dontAdd = false;
             Delegator delegator = (Delegator) request.getAttribute("delegator");
             WebSiteProperties defaults = new WebSiteProperties(delegator);
             String httpPort = defaults.getHttpPort();
@@ -96,7 +95,6 @@ public final class WebSiteProperties {
             }
             if (httpsPort.isEmpty() && request.isSecure()) {
                 httpsPort = String.valueOf(request.getServerPort());
-                dontAdd = true; // We take the port from the request, don't add the portOffset
             }
             if (httpsHost.isEmpty()) {
                 httpsHost = request.getServerName();
@@ -106,14 +104,10 @@ public final class WebSiteProperties {
                 Integer httpPortValue = Integer.valueOf(httpPort);
                 httpPortValue += Start.getInstance().getConfig().portOffset;
                 httpPort = httpPortValue.toString();
-                if (!dontAdd) {
-                    Integer httpsPortValue = Integer.valueOf(httpsPort);
-                    if (!httpsPort.isEmpty()) {
-                        httpsPortValue += Start.getInstance().getConfig().portOffset;
-                    }
-                    httpsPort = httpsPortValue.toString();
-                }
-            }
+                Integer httpsPortValue = Integer.valueOf(httpsPort);
+                httpsPortValue += Start.getInstance().getConfig().portOffset;
+                httpsPort = httpsPortValue.toString();
+            }                
             
             webSiteProps = new WebSiteProperties(httpPort, httpHost, httpsPort, httpsHost, enableHttps);
             request.setAttribute("_WEBSITE_PROPS_", webSiteProps);
@@ -144,9 +138,9 @@ public final class WebSiteProperties {
             httpPortValue += Start.getInstance().getConfig().portOffset;
             httpPort = httpPortValue.toString();
             Integer httpsPortValue = Integer.valueOf(httpsPort);
-            httpsPortValue += Start.getInstance().getConfig().portOffset; // Here unlike above we trust the user and don't rely on the request, no dontAdd.
+            httpsPortValue += Start.getInstance().getConfig().portOffset;
             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=1784766&r1=1784765&r2=1784766&view=diff
==============================================================================
--- ofbiz/branches/release15.12/framework/webapp/config/url.properties (original)
+++ ofbiz/branches/release15.12/framework/webapp/config/url.properties Tue Feb 28 15:45:52 2017
@@ -22,8 +22,7 @@
 
 # HTTPS Port (Secure port)
 port.https.enabled=Y
-# empty by default see OFBIZ-9206
-port.https=
+port.https=8443
 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=1784766&r1=1784765&r2=1784766&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 Tue Feb 28 15:45:52 2017
@@ -57,7 +57,6 @@ public final class WebSiteProperties {
         Assert.notNull("request", request);
         WebSiteProperties webSiteProps = (WebSiteProperties) request.getAttribute("_WEBSITE_PROPS_");
         if (webSiteProps == null) {
-            Boolean dontAdd = false;
             Delegator delegator = (Delegator) request.getAttribute("delegator");
             WebSiteProperties defaults = new WebSiteProperties(delegator);
             String httpPort = defaults.getHttpPort();
@@ -96,7 +95,6 @@ public final class WebSiteProperties {
             }
             if (httpsPort.isEmpty() && request.isSecure()) {
                 httpsPort = String.valueOf(request.getServerPort());
-                dontAdd = true; // We take the port from the request, don't add the portOffset
             }
             if (httpsHost.isEmpty()) {
                 httpsHost = request.getServerName();
@@ -106,14 +104,10 @@ public final class WebSiteProperties {
                 Integer httpPortValue = Integer.valueOf(httpPort);
                 httpPortValue += Start.getInstance().getConfig().portOffset;
                 httpPort = httpPortValue.toString();
-                if (!dontAdd) {
-                    Integer httpsPortValue = Integer.valueOf(httpsPort);
-                    if (!httpsPort.isEmpty()) {
-                        httpsPortValue += Start.getInstance().getConfig().portOffset;
-                    }
-                    httpsPort = httpsPortValue.toString();
-                }
-            }
+                Integer httpsPortValue = Integer.valueOf(httpsPort);
+                httpsPortValue += Start.getInstance().getConfig().portOffset;
+                httpsPort = httpsPortValue.toString();
+            }                
             
             webSiteProps = new WebSiteProperties(httpPort, httpHost, httpsPort, httpsHost, enableHttps);
             request.setAttribute("_WEBSITE_PROPS_", webSiteProps);
@@ -144,9 +138,9 @@ public final class WebSiteProperties {
             httpPortValue += Start.getInstance().getConfig().portOffset;
             httpPort = httpPortValue.toString();
             Integer httpsPortValue = Integer.valueOf(httpsPort);
-            httpsPortValue += Start.getInstance().getConfig().portOffset; // Here unlike above we trust the user and don't rely on the request, no dontAdd.
+            httpsPortValue += Start.getInstance().getConfig().portOffset;
             httpsPort = httpsPortValue.toString();
-        }
+        }                
         
         return new WebSiteProperties(httpPort, httpHost, httpsPort, httpsHost, enableHttps);
     }