Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-80633

WebChannel tries to connect to localhost through proxy

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.12.6
    • WebChannel
    • None
    • Windows 10.0.18363 x64
      Squid HTTP proxy with basic authentication

    Description

      In our application we have the following setup:

      • a WebSocket Server which handles incoming connections
      • a JS WebChannel client injected into a WebEngine page and connects directly to the WebSocket Server using localhost as a host address.

      Without proxy, this setup works fine, however if the system has a proxy configured, it always tries to connect to this localhost address through proxy. If I explicitly exclude localhost in proxy settings of Windows, the connection works fine, but we can't depend on our users to set this option.

      In the source of WebEngine, there is a rule which bypasses the proxy for 127.0.0.1 but that's inactive if the application uses the default proxy.

      The corresponding line which adds that rule is this one:

      proxy_config_service_qt.cpp @140 (net::ProxyConfigService::ConfigAvailability ProxyConfigServiceQt::GetLatestProxyConfig(net::ProxyConfigWithAnnotation *config))

          qtRules.bypass_rules.AddRuleToBypassLocal(); // don't use proxy for connections to localhost
      

      But there is an early exit in the same function @106 in case of using the default proxy settings:

      return systemAvailability;
      

      My suggestion is that the bypass rule should be added in that case as well because there is no point in connecting to localhost throug a proxy.

      In addition, the rule should match to 'localhost' as well, not just '127.0.0.1' and '[::1]' since it's being used regularly.

      Attachments

        Activity

          People

            milianw Milian Wolff
            tomikaa87qt Tamas Karpati
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: