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

RestClientBuilder nonProxyHost parameter not evaluated correctly

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())); }

      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())) {
      

      1. String.split is using a regex. The current implementation split on every character. This can be fixed by using

      .split("\\|")
      

            rsearls r searls
            Schilling.Michael@afb.de Michael Schilling (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: