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. HTTPS request error while using network proxy
Forum Updated to NodeBB v4.3 + New Features

HTTPS request error while using network proxy

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 533 Views 1 Watching
  • 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.
  • MozzieM Offline
    MozzieM Offline
    Mozzie
    wrote on last edited by
    #1

    hi,
    I want to analyze https stream data. I create a proxy server by QTcpServer and QSslSocket, but after I set up proxy to my server and request www.example.com, I got ssl error:

    	m_networkManager = new QNetworkAccessManager(this);
    	QNetworkProxy proxy(QNetworkProxy::HttpProxy);
    	proxy.setHostName(proxyHost);
    	proxy.setPort(9999);
    	m_networkManager->setProxy(proxy);
    
    	QNetworkConfiguration networkConfiguration = m_networkManager->configuration();
    	networkConfiguration.setConnectTimeout(3000);
    
    	m_networkManager->setConfiguration(networkConfiguration);
    
    	connect(m_networkManager, &QNetworkAccessManager::sslErrors,
    			this, [this](QNetworkReply *reply, const QList<QSslError> &errors){
    
    		qDebug() << reply << errors;
    	});
    
    QNetworkReplyHttpImpl(0x19b6e5ff990) ("The host name did not match any of the valid hosts for this certificate")
    

    my certificate is created by openssl:

    openssl genrsa -out privkey.pem 2048 
    openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1095 -config openssl.cnf
    

    what does 'The host name' and the 'the valid hosts' means? and where can I find it or change it?

    thank you so much!

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

      Hi,

      When you create a certificate you have to give informations like for which host it will be valid. From the looks of it, you did not do that.

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

      MozzieM 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        When you create a certificate you have to give informations like for which host it will be valid. From the looks of it, you did not do that.

        MozzieM Offline
        MozzieM Offline
        Mozzie
        wrote on last edited by
        #3

        @SGaist

        thank you.
        I am just confused about which host should match the host of the certificate i created when I use network proxy.
        there is two host, one is proxy server host, and the other is the host I actually need to connect.

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

          Usually the final target. Then it depends on your proxy.

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

          MozzieM 1 Reply Last reply
          0
          • SGaistS SGaist

            Usually the final target. Then it depends on your proxy.

            MozzieM Offline
            MozzieM Offline
            Mozzie
            wrote on last edited by
            #5

            @SGaist
            ok, thank you very much

            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