changeset 1479:64ed9b72cfa0

Added possibility to turn off https preference via deployment properties * netx/net/sourceforge/jnlp/cache/ResourceUrlCreator.java: if deployment.https.noenforce is true, then https variants are not smuggled into urlslist * netx/net/sourceforge/jnlp/config/Defaults.java: deployment.https.noenforce declared as false by default * netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java: added field of KEY_HTTPS_DONT_ENFORCE = "deployment.https.noenforce"
author Jiri Vanek <jvanek@redhat.com>
date Tue, 12 Dec 2017 14:58:51 +0100
parents 8fc0a95eb645
children 48c20674b2e4
files ChangeLog netx/net/sourceforge/jnlp/cache/ResourceUrlCreator.java netx/net/sourceforge/jnlp/config/Defaults.java netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java
diffstat 4 files changed, 32 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Nov 23 18:53:25 2017 +0100
+++ b/ChangeLog	Tue Dec 12 14:58:51 2017 +0100
@@ -1,3 +1,13 @@
+2017-12-08  Jiri Vanek <jvanek at redhat.com>
+
+	Added possibility to turn off https preference via deployment properties
+	* netx/net/sourceforge/jnlp/cache/ResourceUrlCreator.java:
+	if deployment.https.noenforce is true, then https variants are not smuggled into urlslist
+	* netx/net/sourceforge/jnlp/config/Defaults.java:
+	deployment.https.noenforce declared as false by default
+	* netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java:
+	added field of KEY_HTTPS_DONT_ENFORCE = "deployment.https.noenforce"
+
 2017-11-02  Jiri Vanek <jvanek@redhat.com>
 
 	Added linux binary dist target
--- a/netx/net/sourceforge/jnlp/cache/ResourceUrlCreator.java	Thu Nov 23 18:53:25 2017 +0100
+++ b/netx/net/sourceforge/jnlp/cache/ResourceUrlCreator.java	Tue Dec 12 14:58:51 2017 +0100
@@ -42,6 +42,8 @@
 import java.util.List;
 
 import net.sourceforge.jnlp.DownloadOptions;
+import net.sourceforge.jnlp.config.DeploymentConfiguration;
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
 import net.sourceforge.jnlp.util.logging.OutputController;
 
 public class ResourceUrlCreator {
@@ -95,14 +97,17 @@
 
         urls.add(resource.getLocation());
 
-        //preffering https and  owerriding case, when applciation was moved to https, but the jnlp stayed intacted
-        List<URL> urlsCopy = new LinkedList<>(urls);
-        for (URL u : urlsCopy) {
-            if (u.getProtocol().equals("http")) {
-                try {
-                    urls.add(0, copyUrltoHttps(u));
-                } catch (Exception ex) {
-                    OutputController.getLogger().log(ex);
+        boolean noHttpsPreffered = Boolean.valueOf(JNLPRuntime.getConfiguration().getProperty(DeploymentConfiguration.KEY_HTTPS_DONT_ENFORCE));
+        if (!noHttpsPreffered) {
+            //preffering https and  owerriding case, when applciation was moved to https, but the jnlp stayed intacted
+            List<URL> urlsCopy = new LinkedList<>(urls);
+            for (URL u : urlsCopy) {
+                if (u.getProtocol().equals("http")) {
+                    try {
+                        urls.add(0, copyUrltoHttps(u));
+                    } catch (Exception ex) {
+                        OutputController.getLogger().log(ex);
+                    }
                 }
             }
         }
--- a/netx/net/sourceforge/jnlp/config/Defaults.java	Thu Nov 23 18:53:25 2017 +0100
+++ b/netx/net/sourceforge/jnlp/config/Defaults.java	Tue Dec 12 14:58:51 2017 +0100
@@ -220,7 +220,12 @@
                         BasicValueValidators.getBooleanValidator(),
                         String.valueOf(true)
                 },
-                                {
+                {
+                        DeploymentConfiguration.KEY_HTTPS_DONT_ENFORCE,
+                        BasicValueValidators.getBooleanValidator(),
+                        String.valueOf(false)
+                },
+                {
                         DeploymentConfiguration.KEY_SECURITY_PROMPT_USER_FOR_JNLP,
                         BasicValueValidators.getBooleanValidator(),
                         String.valueOf(true)
--- a/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java	Thu Nov 23 18:53:25 2017 +0100
+++ b/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java	Tue Dec 12 14:58:51 2017 +0100
@@ -151,6 +151,9 @@
     public static final String KEY_SECURITY_INSTALL_AUTHENTICATOR = "deployment.security.authenticator";
 
     public static final String KEY_STRICT_JNLP_CLASSLOADER = "deployment.jnlpclassloader.strict";
+    
+    /** Boolean. Do not prefere https over http */
+    public static final String KEY_HTTPS_DONT_ENFORCE = "deployment.https.noenforce";
     /*
      * Networking
      */