Secure websockets and QtWebKit - Qt SDK 4.8 (VS2008)
-
wrote on 22 Mar 2012, 12:44 last edited by
Have you compiled Qt with openssl? Have you connected slot
@void sslErrors(QNetworkReply * reply, const QList<QSslError> &)@ -
wrote on 22 Mar 2012, 18:21 last edited by
Yes, I do connect to this slot and I'm ignoring all ssl errors, otherwise I get blank pages.
I did not compile Qt - I'm using Qt SDK 1.2 (4.8.0 vs2008).
Thanks for that info, it looks like I need to download OpenSSL.
-
wrote on 24 Mar 2012, 04:00 last edited by
@AcerExtensa
I still can't connect using TLS even after installing OpenSSL - my guess it is due to an outdated protocol used by the version of webkit that is part of 4.8.0. -
wrote on 28 Mar 2012, 10:38 last edited by
Try to clone git repository of qt(it has qt 4.8.1 & Webkit 2.2.2) and build it by yourself...
-
wrote on 28 Mar 2012, 10:53 last edited by
It should work! I've tested it: !http://vip2006.net/wss_qt.png(Qt WSS Test)!
-
wrote on 29 Mar 2012, 06:30 last edited by
Thank you for confirming that it works - that looks very promising.
Finally after trying all day to clone git, I'm building right now with mingw.
What compiler did you use - can you show the options you used for configure? -
wrote on 29 Mar 2012, 07:08 last edited by
I'm using VS2010 tools. Here is my configure options:
@configure -opensource -shared -mp -arch windows -no-declarative-debug -script -webkit -openssl -qmake -vcproj -platform win32-msvc2010 -no-qt3support -nomake examples -nomake demos -qt-style-windows -qt-style-windowsxp -qt-style-windowsvista -mmx -sse -sse2 -process -plugin-manifests -no-fast
@also, I'm using openssl 1.0.1 libs from "this binary packet":http://www.slproweb.com/download/Win32OpenSSL-1_0_1.exe.
Just install it and copy libeay32.dll & ssleay32.dll from bin folder of openssl installation in the bin folder of Qt. libeay32.lib & ssleay32.lib from openssl lib folder in Qt folder. And openssl folder from openssl in include folder of Qt. :) -
wrote on 29 Mar 2012, 07:13 last edited by
And my QWebSettings looks like that:
@QWebSettings * sett = this->view->settings()->globalSettings();
sett->setAttribute(QWebSettings::JavaEnabled, true);
sett->setAttribute(QWebSettings::PluginsEnabled,true);
sett->setAttribute(QWebSettings::AutoLoadImages,true);
sett->setAttribute(QWebSettings::LinksIncludedInFocusChain,true);
sett->setAttribute(QWebSettings::ZoomTextOnly,true);
sett->setAttribute(QWebSettings::PrintElementBackgrounds,true);
sett->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled,true);
sett->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled,true);#if QT_VERSION >= 0x040800
sett->setAttribute(QWebSettings::LocalStorageEnabled,true);
sett->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls,true);
sett->setAttribute(QWebSettings::AcceleratedCompositingEnabled,true);
sett->setAttribute(QWebSettings::LocalContentCanAccessFileUrls,true);
sett->setAttribute(QWebSettings::DnsPrefetchEnabled, true);
#endif
sett->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
sett->setAttribute(QWebSettings::JavascriptEnabled,true);
#if QT_VERSION >= 0x040800
sett->setAttribute(QWebSettings::JavascriptCanCloseWindows, true);
#endif
sett->setAttribute(QWebSettings::JavascriptCanAccessClipboard,true);#if QT_VERSION >= 0x040800
sett->setAttribute(QWebSettings::SiteSpecificQuirksEnabled, true);
#endif
@ -
wrote on 30 Mar 2012, 03:54 last edited by
turns out there was some problem with my computer. I just installed Qt SDK 1.2 (Qt 4.8.0, mingw) on another computer and everything works just fine running the same code. I did have to install openSSL though. I wasted a week on this, but I'm glad it works now.
Thanks for your help. -
wrote on 15 Feb 2013, 11:29 last edited by
Hi,
I have tried to build qt with the steps from this site:
http://www.holoborodko.com/pavel/2011/02/01/how-to-compile-qt-4-7-with-visual-studio-2010/
with the following:
Qt 4.8.4, VisualStudio2010, OpenSSL v1.0.1,I needed to build Qt since I can not access https sites. so I have tried to build with openssl.
I followed the build steps and added the open ssl:configure.exe -platform win32-msvc2010 -opensource -shared -debug-and-release -openssl-linked -I C:\OpenSSL-Win32_full\include\openssl -L C:\OpenSSL-Win32_full\lib
I have installed open ssl under C:\OpenSSL-Win32_full
After build of Qt was done, I have tried to build and run the previewer example from the Qt installation dir.
There I have tried to load http url and it worked fine, when I tried to load https url nothing happened. the page was blank.I tried to see if ssl is supported by adding :
bool isSSL = QSslSocket::supportsSsl();
I get isSSL = true.
Does anyone have an idea why https does not work?
Thanks in advance.
-
wrote on 15 Feb 2013, 12:14 last edited by
And what does it have to do with current Topic? Create new forum topic and describe your problem there...
In any way, have you connected to SSlError SLOT? what what does returned error string from NetworkReply says when you try to connect to https?