This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit e094e36e932be7dfe911591fbc2dceaf9c4c9519
Author: Antonin Stefanutti <[email protected]>
AuthorDate: Fri Jan 7 12:38:11 2022 +0100

    fix(proxy): HTTPS proxy can use HTTP scheme
---
 pkg/util/maven/maven_proxies.go | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/pkg/util/maven/maven_proxies.go b/pkg/util/maven/maven_proxies.go
index aa57d4d..91e0790 100644
--- a/pkg/util/maven/maven_proxies.go
+++ b/pkg/util/maven/maven_proxies.go
@@ -33,6 +33,7 @@ func (_ proxyFromEnvironment) apply(settings *Settings) error 
{
                if err != nil {
                        return err
                }
+               proxy.ID = "http-proxy"
                settings.Proxies = append(settings.Proxies, proxy)
        }
 
@@ -41,6 +42,7 @@ func (_ proxyFromEnvironment) apply(settings *Settings) error 
{
                if err != nil {
                        return err
                }
+               proxy.ID = "https-proxy"
                settings.Proxies = append(settings.Proxies, proxy)
        }
 
@@ -58,15 +60,11 @@ func parseProxyFromEnvVar(proxyEnvVar string) (Proxy, 
error) {
                Host:     u.Hostname(),
                Port:     u.Port(),
        }
-       switch proxy.Protocol {
-       case "http":
-               proxy.ID = "http-proxy"
-               if proxy.Port == "" {
+       if proxy.Port == "" {
+               switch proxy.Protocol {
+               case "http":
                        proxy.Port = "80"
-               }
-       case "https":
-               proxy.ID = "https-proxy"
-               if proxy.Port == "" {
+               case "https":
                        proxy.Port = "443"
                }
        }

Reply via email to