Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-49709

Proxy Config broken in Bitbucket Branch Source Plugin

      When getting the proxy config (for an Bitbucket server) the protocoll and port should be ignored.

      As a workaround i have to put the full host URL of the Server in the Proxy Exclusion list

          [JENKINS-49709] Proxy Config broken in Bitbucket Branch Source Plugin

          Thomas Kalmár added a comment - https://github.com/jenkinsci/bitbucket-branch-source-plugin/pull/112 should fix this

          Jaco Greyling added a comment -

          Hi Thomas,

          I see you've closed my issue, before I could comment, so let me do it here. Whilst your solution certainly looks elegant on face value I do have a problem with it. You're trying to cast to a new class (URL) and if it fails it throws a MalformedURLException. The problem I have with this is the fact that when you through the Exception you don't know where it comes from (unless you investigate the stack trace). With my solution I merely strip the scheme:// and leave the validation to HttpGet. This means that if there is indeed a problem with the original URL it will be thrown by the HTTP client (in this case Apache HTTP Client) which in my opinion is a better place for it. It makes errors handling easier to interpret in a runtime situation. 

           

          Perhaps that is just my view, but happy to see what the maintainers decide to do with it

           

          Thanks for your input, though!

          Jaco

          Jaco Greyling added a comment - Hi Thomas, I see you've closed my issue, before I could comment, so let me do it here. Whilst your solution certainly looks elegant on face value I do have a problem with it. You're trying to cast to a new class (URL) and if it fails it throws a MalformedURLException. The problem I have with this is the fact that when you through the Exception you don't know where it comes from (unless you investigate the stack trace). With my solution I merely strip the scheme:// and leave the validation to HttpGet. This means that if there is indeed a problem with the original URL it will be thrown by the HTTP client (in this case Apache HTTP Client) which in my opinion is a better place for it. It makes errors handling easier to interpret in a runtime situation.    Perhaps that is just my view, but happy to see what the maintainers decide to do with it   Thanks for your input, though! Jaco

          Hi Jaco,

          URI.create(...)

          does not throw an MalformedURLException. The JavaDoc of the getHttpClient Mehtod states:

          @param host must be of format: scheme://host:port. e.g. http://localhost:7990

          which should be validated on the Configuration page. If you have an invalid host your whole setup is broken. BTW. poor mans solution is entering the scheme://host:port in the proxy exception list :/. If your solution should work you also have to strip the port from the URL. (Pattern ^.?://([^:]) )

          Thomas Kalmár added a comment - Hi Jaco, URI.create(...) does not throw an MalformedURLException. The JavaDoc of the getHttpClient Mehtod states: @param host must be of format: scheme: //host:port. e.g. http://localhost:7990 which should be validated on the Configuration page. If you have an invalid host your whole setup is broken. BTW. poor mans solution is entering the scheme://host:port in the proxy exception list :/. If your solution should work you also have to strip the port from the URL. (Pattern ^. ?://( [^:] ) )

          Antonio Muñiz added a comment - Fixed in https://github.com/jenkinsci/bitbucket-branch-source-plugin/pull/112

            Unassigned Unassigned
            thomas_kalmar Thomas Kalmár
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: