雪铁龙全新c4l 提车:Qt Https sslError问题解决方法

来源:百度文库 编辑:九乡新闻网 时间:2024/04/30 06:39:36
Thread: Qt 4.7 Https?
Thread Tools
Search Thread

Display
27th September 2010 07:04#1
MorrisLiang
Intermediate user
Join Date
Apr 2010
Posts
98
Thanks
19
Thanked 5 Times in 4 Posts
Qt products

Platforms

 Qt 4.7 Https?
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~
It's not the goodbye that hurts,but the flashback that follow.
Reply With Quote
27th September 2010 11:42#2
tbscope
Expert     
Join Date
Jan 2006
Location
Belgium
Posts
1,912
Thanked 263 Times in 263 Posts
Qt products

Platforms
 
Wiki edits
20
 Re: Qt 4.7 Https?
 Originally Posted by MorrisLiang 
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?
Reply With Quote
27th September 2010 13:06#3
MorrisLiang
Intermediate user
Join Date
Apr 2010
Posts
98
Thanks
19
Thanked 5 Times in 4 Posts
Qt products

Platforms

 Re: Qt 4.7 Https?
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.
It's not the goodbye that hurts,but the flashback that follow.
Reply With Quote
27th September 2010 13:53#4
wysota
Master of Zen          

Join Date
Jan 2006
Location
Warsaw, Poland
Posts
23,878
Thanks
3
Thanked 3,411 Times in 3,295 Posts
Qt products
  
Platforms
  
Blog Entries
4
Wiki edits
9
 Re: Qt 4.7 Https?
Connect the sslErrors() signal to ignoreSslErrors() slot.
Your biological and technological distinctiveness will be added to our own. Resistance is futile.
Please ask Qt related questions on the forum and not using private messages or visitor messages.

Reply With Quote
27th September 2010 14:14#5
MorrisLiang
Intermediate user
Join Date
Apr 2010
Posts
98
Thanks
19
Thanked 5 Times in 4 Posts
Qt products

Platforms

 Re: Qt 4.7 Https?
If I ignore the error, I can't open the google oauth authorize page...
It's not the goodbye that hurts,but the flashback that follow.
Reply With Quote
27th September 2010 18:06#6
MorrisLiang
Intermediate user
Join Date
Apr 2010
Posts
98
Thanks
19
Thanked 5 Times in 4 Posts
Qt products

Platforms

 Re: Qt 4.7 Https?
I get back to 4.6.2 finally...Maybe we should consider this is a bug or something in 4.7
It's not the goodbye that hurts,but the flashback that follow.
Reply With Quote
3rd November 2010 08:54#7
Farris
Beginner
Join Date
Jan 2010
Posts
7
Thanked 1 Time in 1 Post
Qt products

Platforms
  
 Re: Qt 4.7 Https?
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.