Hi,  

      I'm trying to make an http request throught a proxy which need authentification.

      This code is OK : 

      withEnv(['http_proxy=http://<usr>:<pwd>@myproxy.com:8080']) {
        sh "curl -sS -w '\n%{http_code}' http://httpbin.org/get"
      

       

      But this one is KO :

      => Connection time out

      withEnv(['http_proxy=http://<usr>:<pwd>@myproxy.com:8080']) {
        httpRequest(
          url: 'http://httpbin.org/get',
          timeout: 10,
          httpProxy: env.http_proxy,
        )
      }
      

       

      Neither this one :

      => Treating UnknownHostException(***:***@myproxy.com: Name or service not known) as 404 Not Found

      httpRequest(
        url: 'http://httpbin.org/get',
        httpProxy: 'http://<usr>:<pwd>@myproxy.com:8080'
        timeout: 10,
        httpProxy: env.http_proxy,
      )
      

          [JENKINS-64397] Plugin don't work with authentificated proxy

          Simon Watts added a comment - - edited

          withEnv doesn't modify env - it only adds the values to subshells' environments.

          httpRequest() has a separate field for proxyAuthentication and doesn't expect it to be encoded into the httpProxy.  I don't know what format is expected for proxyAuthentication though - that help page is missing.

          Tertiary Question:  Jenkins has proxy settings configured in it (Jenkins.get ().getProxy()) - so why doesn't httpRequest() use those settings as a default?

          Simon Watts added a comment - - edited withEnv doesn't modify env - it only adds the values to subshells' environments. httpRequest() has a separate field for proxyAuthentication and doesn't expect it to be encoded into the httpProxy .  I don't know what format is expected for proxyAuthentication though - that help page is missing. Tertiary Question:  Jenkins has proxy settings configured in it ( Jenkins.get ().getProxy() ) - so why doesn't httpRequest() use those settings as a default?

            janario Janario Oliveira
            cpottiers Cyril Pottiers
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: