View Full Version : Qt 4.7 Https?

27th September 2010, 08:04
I was sending request to "https://www.google.com/accounts/OAuthGetRequestToken" using QNetworkAccessManager.

It used to work, but not until I update Qt to 4.7. Now I always get "QNetworkReply::SslHandshakeFailedError" when I try to send that request. And I have already had the openssl dlls inside my app's folder.

How can I solve this problem? Thanks~

27th September 2010, 12:42
It used to work, but not until I update Qt to 4.7.
You mean "until" and not "but not until" which means "!until" wich is the opposite of "until"

Try this:
Clean the build completely. What does that mean, completely? If you have a build dir, remove it. If you build in the source dir, only keep the source files, all generated files need to be removed. Make clean is not sufficient.
Then rerun qmake and make again.

Does this solve the problem?

27th September 2010, 14:06
My bad,that grammar kinda confuse me... What I mean is, it works under Qt4.6, but not under 4.7..
Thanks for the reply. Actually, I have dug a little deeper, I checked the QSslError in a slot connected to the QNetworkAccessManager's sslErrors() SIGNAL. The sslError saids that the cert has expired. So I checked the cert by calling QSslError::certificate(), which I found that the cert is Null... I think the manager didn't receive the cert at all...

I have already built the 4.7 with the same configuration when I built 4.6:
configure -fast -debug-and-release -opensource -openssl -I D:\Qt\OpenSSL-Win32\include -L D:\Qt\OpenSSL-Win32 -no-qt3support -no-webkit -no-scripttools -nomake examples -nomake demos -no-script -no-style-plastique -no-style-cleanlooks -no-style-motif -no-style-cde -nomake docs

I think the configuration somehow didn't enabled the SSL support... Maybe I need to build the network module again with SSL enabled.

27th September 2010, 14:53
Connect the sslErrors() signal to ignoreSslErrors() slot.

27th September 2010, 15:14
If I ignore the error, I can't open the google oauth authorize page...

27th September 2010, 19:06
I get back to 4.6.2 finally...Maybe we should consider this is a bug or something in 4.7

3rd November 2010, 09:54
This is caused by the change in qt 4.7 where root certificates are not included in the qtnetwork module, where as earlier versions of qt shipped with a bundle of common root certificates. If you ensure that proper root certificates, more specifically the one(s) that are used by the host you are attempting to connect to, are installed on the system that you are running from this shouldn't be a problem.

See, http://bugreports.qt.nokia.com/browse/QTBUG-12718 for more info

connecting to the sslError slot and ignoring the ssl error should enable you to connect, although you cannot be sure of the identity of the host you are connecting to.