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

get updated system proxy at runtime

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 4.8.4, 5.0.0
    • Network: Proxies
    • None
    • Windows 7 64bit, MS Visual Studio 2010, Customer Portal Case 00305467
      Windows Vista, VS 2008

    Description

      I am developing a Qt 5 based system tray application which uses QNetworkAccessManager for HTTPS requests to a backend server.
      I also have added support of using the Windows system proxy settings which may be used by our customers.

      It seems that the system proxy settings could only be read once at first time usage only. But if the proxy settings change while my systray application is still running (eg. a user just suspends his/her notebook and changes network configuration after flight in another office, or VPN).

      I have drilled down where the system proxy is read:

      void QWindowsSystemProxy::init()
      {
      if (initialized)
      return;
      initialized = true;

      #ifdef Q_OS_WINCE
      // Windows CE does not have any of the following API
      return;
      #else
      // load the winhttp.dll library
      QSystemLibrary lib(L"winhttp");
      if (!lib.load())
      return; // failed to load
      ...

      It seems to me that the initialized variable could not be turned back to false, so the cached values still will be used.

      In my system tray application I have tried different things to force Qt to update to the current system proxy settings of Windows, but still failed.

      Even before every QNetworkRequest get() call the following calls

      QNetworkProxyFactory::setUseSystemConfiguration(false); // use current system proxy settings, so we have to call it again and again
      QNetworkProxyFactory::setUseSystemConfiguration(true); // use current system proxy settings, so we have to call it again and again

      did not make any difference.

      My test scenario was:

      1. start my Qt application which does a network request every three seconds
      2. start Fiddler -> the request of the Qt app does not appear in Fiddler.
      3. stop Qt application
      4. start Qt application again
      5. now the Requests appear in Fiddler.
      6. stop Fiddler
      7. my Qt application now gets errors that the proxy does not respond.

      In a Browser (eg. Firefox) the proxy settings seem to be read more often so that someone could change the proxy settings without a trouble in his/her HTTP application.

      How could it be done with Qt5?

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              peter-har Peter Hartmann
              stefans2 StefanScherer
              Votes:
              5 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes