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

RestClientBuilder nonProxyHost parameter not evaluated correctly

    Details

    • Steps to Reproduce:
      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())); }

      Description

      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("\\|")
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  rsearls r searls
                  Reporter:
                  auskennfuchs Michael Schilling
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: