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

Can't setup proxy credentials

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Not Evaluated
    • None
    • 6.5.3, 6.6.0 RC
    • WebEngine
    • None
    • macOS Ventura 13.6 | XCode 15.0 | Apple clang version 15.0.0 (clang-1500.0.40.1) | Target: x86_64-apple-darwin22.6.0
      Thread model: posix | InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
    • All

    Description

      Hi guys

      I'm struggling to figure out why my QT6.5.3 application (macOS)  can't set the proxy username and password.

      The HTTP request arrives to my proxy as expected, but the username/password are not set. 

       

      #include <QUrl>
      #include <QDebug>
      #include <QSettings>
      #include <QApplication>
      #include <QNetworkProxy>
      #include <QNetworkAccessManager>
      #include <QWebEnginePage>
      #include <QWebEngineView>
      #include <QCoreApplication>
      #include <QWebEngineSettings>
      
      int main(int argc, char *argv[])
      { 
        QApplication app(argc, argv);
      
        QNetworkProxy proxy;
        proxy.setType(QNetworkProxy::HttpProxy);
        proxy.setHostName(QString("127.0.0.1"));
        proxy.setPort(8084);
        proxy.setUser(QString("user"));
        proxy.setPassword(QString("password123"));
        QNetworkProxy::setApplicationProxy(proxy);
      
        QUrl url = QUrl(QStringLiteral("https://www.google.com/"));
      
        QWebEngineView view;
        QWebEnginePage page;
        view.setPage(&page);
        view.setUrl(url);
        view.show();
      
        return app.exec();
      }
      

       
      This is what my proxy gets:

      CONNECT www.google.com:443 HTTP/1.1\r\n
      Host: www.google.com:443\r\n
      Proxy-Connection: keep-alive\r\n
      User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/6.5.3 Chrome/108.0.5359.220 Safari/537.36\r\n\r\n
      

       
      Unfortunately, no Proxy-Authorization HTTP header was sent.

      If I try the same test using cURL, everything works as expected:

      $ curl --proxy "http://127.0.0.1:8084" --proxy-user "user:password123" "https://www.google.com"
      

      My proxy gets the following:

      CONNECT www.google.com:443 HTTP/1.1\r\n
      Host: www.google.com:443\r\n
      Proxy-Authorization: Basic YXJjaGlkOmZvbw==\r\n
      User-Agent: curl/8.3.0\r\n
      Proxy-Connection: Keep-Alive\r\n\r\n
      

      The Proxy-Authorization HTTP header was sent as expected.

      What am i missing here?
      Help appreciated.

      Attachments

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

        Activity

          People

            qt_webengine_team Qt WebEngine Team
            zabrane Zabrane Mickael
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes