if server uses ssl connection then you have to use QSsl* classes and for using them you have to build Qt with OpenSSL.
if server uses ssl connection then you have to use QSsl* classes and for using them you have to build Qt with OpenSSL.
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
Here is a part of httpwindow.cpp from Qt Examples:
Qt Code:
#ifndef QT_NO_OPENSSL void HttpWindow::sslErrors(const QList<QSslError> &errors) { QString errorString; foreach (const QSslError &error, errors) { if (!errorString.isEmpty()) errorString += ", "; errorString += error.errorString(); } tr("One or more SSL errors has occurred: %1").arg(errorString), http->ignoreSslErrors(); } } #endifTo copy to clipboard, switch view to plain text mode
as you see it's surrounded by
Qt Code:
#ifndef QT_NO_OPENSSL // . . . #endifTo copy to clipboard, switch view to plain text mode
so if you compile Qt without SSL support then this example still work but can't handle SSL connections (QT_NO_OPENSSL will be defined so that code would be, let's say, cut out). You said that you need to download files from server with SSL - and it's not working, but it's working for non-SSL connections, so the reason would be in QT_NO_OPENSSL is defined == Qt built without OpenSSL.
I would like to be a "Guru"
Useful hints (try them before asking):
- Use Qt Assistant
- Search the forum
If you haven't found solution yet then create new topic with smart question.
What's more, same thing you can see in qsslsocket.h:
Qt Code:
#ifndef QT_NO_OPENSSL class QDir; class QSslCipher; class QSslCertificate; class QSslConfiguration; class QSslSocketPrivate; { // . . . }; #endif // QT_NO_OPENSSLTo copy to clipboard, switch view to plain text mode
So there is no class QSslSocket if you didn't build your Qt with OpenSSL.
I would like to be a "Guru"
Useful hints (try them before asking):
- Use Qt Assistant
- Search the forum
If you haven't found solution yet then create new topic with smart question.
that mean if i build qt with openssl , can i download files from server with out change of http example program..(../qt/4.4.1/examples/network/http).
i am new to qt. could u plz tell me how to buid qt with openssl?
yes, there is no needed to change your example, just rebuild it.
there are to options how to build it:
-- download sources and then build them.
-- download www.openssl.org/related/binaries.html.
the second option is easier.
then all you need it's set environment variables for OpenSSL.
the next step -- you need to configure your Qt.SET LIB=D:\develop\OpenSSL\lib\VC;%LIB% -- if you use MS VS or
SET LIB=D:\develop\OpenSSL\lib\MinGW;%LIB% -- if you use MinGW
SET INCLUDE=D:\develop\OpenSSL\include;%INCLUDE%
there are to configure options:
I preferred then first option.-openssl ........... Compile in run-time OpenSSL support
-openssl-linked .... Compile in linked OpenSSL support
that's all.
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
thank you very much, thanks a lot for u r great infromation. i'll try as u told
Hi,
Im also facing the similar problem from a couple of days. I want to set openssl support for qt 4.5 on winxp sp2 machine
I configured as
configure -openssl -I C:\OpenSSL\include\openssl -L C:\OpenSSL\lib\MinGW -webkit
then did mingw32-make
still i get errors when make is done on ssl folder of qt
meanwhile after configure is done, if i open makefile in C:\Qt\2009.01\qt, it still doest show openssl includes and libs i supplied with configure.
Im a newbie and im facing this issue for quite some time now.
Kindly let me know where im getting wrong. I followed the above mentioned steps (previous posts)
Please provide me exact steps of building qt 4.5 with openssl.
Thanks,
Srikanth
try to set path to OpenSSL includes using
not usingSET INCLUDE=D:\develop\OpenSSL\include;%INCLUDE%.configure -openssl -I C:\OpenSSL\include\openssl -L C:\OpenSSL\lib\MinGW
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
Hi,
Im also facing the similar problem from a couple of days. I want to set openssl support for qt 4.5 on winxp sp2 machine
I configured as
configure -openssl -I C:\OpenSSL\include\openssl -L C:\OpenSSL\lib\MinGW -webkit
then did mingw32-make
still i get errors when make is done on ssl folder of qt
meanwhile after configure is done, if i open makefile in C:\Qt\2009.01\qt, it still doest show openssl includes and libs i supplied with configure.
Im a newbie and im facing this issue for quite some time now.
Kindly let me know where im getting wrong. I followed the above mentioned steps (previous posts)
Please provide me exact steps of building qt 4.5 with openssl.
Thanks,
Srikanth
UPDATE:
i paste here some errors when mingw32-make is executed after configure
ssl\qsslcertificate.cpp:441: error: `X509_PUBKEY' undeclared (first use this fun
ction)
ssl\qsslcertificate.cpp:441: error: `xkey' undeclared (first use this function)
ssl\qsslcertificate.cpp:441: error: invalid use of undefined type `struct x509_s
t'
../../include/QtNetwork/../../src/network/ssl/qsslcertificate.h:52: error: forwa
rd declaration of `struct x509_st'
ssl\qsslcertificate.cpp:442: error: `EVP_PKEY' undeclared (first use this functi
on)
ssl\qsslcertificate.cpp:442: error: `pkey' undeclared (first use this function)
ssl\qsslcertificate.cpp:442: error: `q_X509_PUBKEY_get' undeclared (first use th
is function)
ssl\qsslcertificate.cpp:445: error: `EVP_PKEY_RSA' undeclared (first use this fu
nction)
ssl\qsslcertificate.cpp:446: error: 'class QSslKeyPrivate' has no member named '
rsa'
ssl\qsslcertificate.cpp:446: error: `q_EVP_PKEY_get1_RSA' undeclared (first use
this function)
ssl\qsslcertificate.cpp:449: error: `EVP_PKEY_DSA' undeclared (first use this fu
nction)
ssl\qsslcertificate.cpp:450: error: 'class QSslKeyPrivate' has no member named '
dsa'
ssl\qsslcertificate.cpp:450: error: `q_EVP_PKEY_get1_DSA' undeclared (first use
this function)
ssl\qsslcertificate.cpp:453: error: `EVP_PKEY_DH' undeclared (first use this fun
ction)
ssl\qsslcertificate.cpp:459: error: `q_EVP_PKEY_free' cannot be used as a functi
on
ssl\qsslcertificate.cpp: In static member function `static QSslCertificate QSslC
ertificatePrivate::QSslCertificate_from_X509(X509* )':
ssl\qsslcertificate.cpp:666: error: `q_X509_get_issuer_name' undeclared (first u
se this function)
ssl\qsslcertificate.cpp:666: error: `q_X509_NAME_oneline' cannot be used as a fu
nction
ssl\qsslcertificate.cpp:668: error: `q_X509_get_subject_name' undeclared (first
use this function)
ssl\qsslcertificate.cpp:668: error: `q_X509_NAME_oneline' cannot be used as a fu
nction
ssl\qsslcertificate.cpp:670: error: `ASN1_TIME' undeclared (first use this funct
ion)
ssl\qsslcertificate.cpp:670: error: `nbef' undeclared (first use this function)
ssl\qsslcertificate.cpp:670: error: `X509_get_notBefore' undeclared (first use t
his function)
ssl\qsslcertificate.cpp:671: error: `naft' undeclared (first use this function)
ssl\qsslcertificate.cpp:671: error: `X509_get_notAfter' undeclared (first use th
is function)
mingw32-make[2]: *** [tmp/obj/debug_shared/qsslcertificate.o] Error 1
mingw32-make[2]: Leaving directory `C:/Qt/2009.02/qt/src/network'
mingw32-make[1]: *** [debug-all] Error 2
mingw32-make[1]: Leaving directory `C:/Qt/2009.02/qt/src/network'
mingw32-make: *** [sub-network-make_default-ordered] Error 2
Hi spirit,
Thanks for the reply, I did as you mentioned.
added include path to INCLUDE and executed configure as
configure -openssl -L C:\OpenSSL\lib\MinGW -webkit
when im done with configure, i executed mingw32-make ans i still get those compilation errors as i mentioned. I still dont see any openssl rules in makefile
Thanks,
Srikanth
Bookmarks