QWebView / Qt WebKit won't open some SSL pages; redirects not allowed?

后端 未结 2 632
Happy的楠姐
Happy的楠姐 2021-02-19 17:59

Clean install of Qt SDK 1.1.4 on Windows 7 with Visual C++ 2008 SP1; I\'m using Qt Creator. Why does this code not load some web pages?

#include 

        
2条回答
  •  遇见更好的自我
    2021-02-19 18:38

    I usually use the "Arnold Spence"s solution but sometimes that wont work.

    in that case just change the default Ssl configuration like this

    QSslConfiguration sslconf = QSslConfiguration::defaultConfiguration();
    QList cert_list = sslconf.caCertificates();
    QList cert_new = QSslCertificate::fromData("CaCertificates");
    cert_list += cert_new;
    
    sslconf.setCaCertificates(cert_list);
    sslconf.setProtocol(QSsl::AnyProtocol);
    QSslConfiguration::setDefaultConfiguration(sslconf);
    

    Here we altered the configuration for the entire application .

    I recommend you handle the sslErrors signal too ..

提交回复
热议问题