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

Java does not use all configured proxies when java.net.useSystemProxies=true

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Tested with Windows 10, but behavior should be the same in all Windows versions.

      A DESCRIPTION OF THE PROBLEM :
      When multiple Windows proxy configuration options are selected (automatic detection, setup script address, manual proxy setup), proxy selector only attempts one, and ignores all others.

      Proxy selector should try automatic script first, but fall back to configured script and eventually to manual configuration if earlier methods fail. See Microsoft's example: https://support.microsoft.com/en-us/topic/how-the-windows-update-client-determines-which-proxy-server-to-use-to-connect-to-the-windows-update-web-site-08612ae5-3722-886c-f1e1-d012516c22a1

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Pick a machine with no automatic proxy configuration (WPAD) available
      In proxy configuration select "Automatically detect settings" and "Use a proxy server"; set any proxy server address (I used 127.0.0.1:8192)
      [1] Run attached code with -Djava.net.useSystemProxies=true
      Deselect "Automatically detect settings"
      [2] Run attached code again

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Both runs return configured proxy
      ACTUAL -
      First run returns [DIRECT], second run returns configured proxy

      ---------- BEGIN SOURCE ----------
      import java.net.ProxySelector;
      import java.net.URI;
      import java.net.URISyntaxException;

      public class ProxySel {
          public static void main(String[] args) throws URISyntaxException {
              ProxySelector sel = ProxySelector.getDefault();
              System.out.println(sel.select(new URI("http://example.com")).toString());
          }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

          Activity

            People

            Assignee:
            michaelm Michael McMahon
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: