Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QNetworkAccessManager preventing localhost connection
QtWS25 Last Chance

QNetworkAccessManager preventing localhost connection

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • jhiattJ Offline
    jhiattJ Offline
    jhiatt
    wrote on last edited by
    #1

    We have a QML application which fetches image assets from a local web server. However, the Qt bearer management plugins seem to be interfering with this process. If the network is determined to be "NotAccessible" (e.g. no wifi network is up) then any call through the QNetworkAccessManager will fail. I believe this is the condition we're hitting: https://github.com/qt/qtbase/blob/5.7.1/src/network/access/qnetworkaccessmanager.cpp#L1166

    As we're trying to make an HTTP call to localhost, we don't care about connectivity to the wider Internet, but our requests are getting blocked regardless.

    I've only been able to reproduce this issue on Linux, specifically with the connman bearer management integration. I don't know if the NetworkManager integration will do the same thing, but I was NOT able to reproduce it on Mac OS; no matter what I tried the network was never marked NotAccessible.

    The only workaround I have is to compile Qt with -no-feature-bearermanagement to turn it off completely.

    Is there any way to disable it programatically if it was enabled at compile time? I haven't found any way to override this behavior. Setting an invalid empty QNetworkConfiguration() doesn't fix the problem, despite some notes in the documentation that suggested otherwise. I also don't see anyway to inject a fake network configuration that would cause the request to proceed, as the fields I would have to set are marked private. It looks like overriding QNetworkAccessManager::createRequest() in a subclass might be an option, but it's unclear that in the subclass I could invoke all the standard superclass behavior except for the bearer management stuff.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Pretty interesting case. Did you already check the bug report system ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • jhiattJ Offline
        jhiattJ Offline
        jhiatt
        wrote on last edited by
        #3

        Hi @SGaist ,

        I did some searches in the bug tracker but so far haven't found anything matching my use case.

        I came across this StackOverflow post that looks like the same problem. It doesn't look like that poster was able to find any resolution.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Then you should open a new report about this providing all the information you have as well as link to relevant material.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved