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. QNetworkProxy: No use of proxy for specified Adresses?

QNetworkProxy: No use of proxy for specified Adresses?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.8k 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.
  • O Offline
    O Offline
    outdoor_guy
    wrote on last edited by
    #1

    Hi

    I have to set a QNetworkProxy to get connection to the Internet from my system. However, I also have a UPnP-server on my local system, which gives me Pictures via http-Protocol. Unfortunatly, it does not use 127.0.0.1 as adress, but the real IP-adress of my local PC(let's say the adress of that PC is 192.168.0.8)

    There is no way to change this server, because I do not have the source code.

    Is there a way to tell QNetworkProxy to ignore the proxy for a specific adress? (Like the setting in Firefox, where you can define "No proxy for")

    My current code is

    @ QString urlEnv = QProcessEnvironment::systemEnvironment().value("http_proxy");
    if (!urlEnv.isEmpty())
    {
    QUrl url = QUrl(urlEnv, QUrl::TolerantMode);
    QNetworkProxy proxy;
    proxy.setType(QNetworkProxy::HttpProxy);
    proxy.setHostName(url.host());
    proxy.setPort(url.port(8080));
    QNetworkProxy::setApplicationProxy(proxy);
    }
    @

    I'm searching for something like

    proxy.ignoreProxyFor("192.168.0.8")

    I have to say I'm not at all an expert in network communication, I touched this only because othwise I had no change that my program is connected to the outside world

    1 Reply Last reply
    0
    • R Offline
      R Offline
      rcari
      wrote on last edited by
      #2

      The API does not seem to have such an option. If you are using QTcpSocket directly, you can use @socket->setProxy(QNetworkProxy::NoProxy);@ before connecting. If you use QNetworkAccessManager, I can't think of a proper solution.

      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