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

Setting a new proxy is only effective after the first request (tested with WebEngine)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.2
    • Network: Proxies, WebEngine
    • None
    • Linux 5.10.0-13-amd64 #1 SMP Debian 5.10.106-1 (2022-03-17) x86_64 GNU/Linux
    • Linux/X11

    Description

      Setting a new proxy after the event loop is running is only effective after the first request is made:

      1. start_app
      2. set_proxy(proxy_1)
      3. request() -> OK, uses proxy_1
      4. set_proxy(proxy_2)
      5. request() -> FAIL, uses proxy_1
      6. request() -> OK, uses proxy_2

      The same error happens with both

      • QNetworkProxyFactory and
      • QNetworkProxy::setApplicationProxy().

      This error happens with:

      • Debian Linux 5.10.0-13-amd64 #1 SMP Debian 5.10.106-1 x86_64 GNU/Linux
        QMake version 3.1
        Using Qt version 5.15.2 in /usr/lib/x86_64-linux-gnu

      Works correctly with:

      • Ubuntu Linux 5.13.0-39-generic #44~20.04.1-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux
        QMake version 3.1
        Using Qt version 5.12.8 in /usr/lib/x86_64-linux-gnu

      There is an attached test file. Usage instructions are in the test file.

      From tests I have made with QNetworkProxyFactory, it seems that new proxy settings are evaluatedĀ after a request is made. But that is just an intuition.

      I have tried the following (unsuccessfully) to work around the issue:

      • set the same new proxy multiple time
      • send a dummy request (non-existent URL) after setting a new proxy
      • make sure to run the event loop / process pending events between setting a new proxy and sending a request

      Attachments

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

        Activity

          People

            michal Michal Klocek
            zk Zoltan K
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes