Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-2641

RestClientBuilder nonProxyHost parameter not evaluated correctly with wildcards

XMLWordPrintable

    • Hide
      	@Test
      	public void testNonProxyHost() {
      		URI uri = URI.create("https://127.0.0.1:8080/test");
      		List<String> noProxyHosts = Arrays.asList("localhost|127.*|[::1]".split("\\|"));
      		assertEquals("127.0.0.1", uri.getHost());
      		assertTrue(noProxyHosts.contains(uri.getHost()));
      	}
      
      Show
      @Test public void testNonProxyHost() { URI uri = URI.create( "https: //127.0.0.1:8080/test" ); List< String > noProxyHosts = Arrays.asList( "localhost|127.*|[::1]" .split( "\\|" )); assertEquals( "127.0.0.1" , uri.getHost()); assertTrue(noProxyHosts.contains(uri.getHost())); }

      I am splitting the original RESTEASY-2543 into two issues.

       

      According to the current implementation at
      https://github.com/resteasy/Resteasy/blob/master/resteasy-client-microprofile/src/main/java/org/jboss/resteasy/microprofile/client/RestClientBuilderImpl.java (lines 208-) the parsing of the nonProxyHost parameter is not correct:

       List<String> noProxyHosts = Arrays.asList(
                      System.getProperty("http.nonProxyHosts", "localhost|127.*|[::1]").split("|"));
              String envProxyHost = System.getProperty("http.proxyHost");
      
              if (envProxyHost != null && !noProxyHosts.contains(baseURI.getHost())) {
      

      contains is not checking against wildcards. So in the simplest example when using the default Systemproperty a call to 127.0.0.1 will not be recognized as nonProxyHost-URL. The check has to be improved by parsing every nonProxyHost-Item and correctly check against the current host of the URL.

            rsearls r searls
            rhn-support-dboeren David Boeren
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: