Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8025065

"Bypass proxy server for local addresses" not taken into account

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 7
    • Fix Version/s: tbd
    • Component/s: core-libs
    • Labels:

      Description

      FULL PRODUCT VERSION :
      Java 1.7.0_25

      ADDITIONAL OS VERSION INFORMATION :
      Windows 7 64-bit

      A DESCRIPTION OF THE PROBLEM :
      When you set up a proxy server (Internet Options->LAN Settings) in Windows 7 there is a checkbox called:

      "Bypass proxy server for local addresses"

      This means that HTTP connections to "localhost" or "127.0.0.1" should avoid going through the server.
      This no longer happens, it used to work with Java 1.6 but in Java 1.7 the proxy is used also for localhost connections, probably this issue introduced the problem:

      http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6737819

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Call this code:

          System.setProperty("java.net.useSystemProxies", "true");
          System.err.println(ProxySelector.getDefault().select(new URI("http://localhost/index.html")));
          System.err.println(ProxySelector.getDefault().select(new URI("http://127.0.0.1/index.html")));
          System.err.println(ProxySelector.getDefault().select(new URI("http://www.oxygenxml.com/index.html")));

      The code should return a direct PROXY connection for the first two URIs and the proxy configured in the system for the third one (because the "Bypass proxy server for local addresses" checkbox is checked).

      But it returns the same configured proxy for all connections.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The code should return a direct PROXY connection for the first two URIs and the proxy configured in the system for the third one (because the "Bypass proxy server for local addresses" checkbox is checked).
      ACTUAL -
      But it returns the same configured proxy for all connections.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
          System.setProperty("java.net.useSystemProxies", "true");
          System.err.println(ProxySelector.getDefault().select(new URI("http://localhost/index.html")));
          System.err.println(ProxySelector.getDefault().select(new URI("http://127.0.0.1/index.html")));
          System.err.println(ProxySelector.getDefault().select(new URI("http://www.oxygenxml.com/index.html")));
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      I can set my own proxy configuration in the system which wraps the current one and returns a direct proxy for localhost connections.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              coffeys Sean Coffey
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: