[Qt] Use Qt resources for bundling the certificates
This commit is contained in:
1
configure
vendored
1
configure
vendored
@@ -64,6 +64,7 @@ function print_qt_flags {
|
||||
CONFIG+=" 'qt_cflags%': [], "$LN
|
||||
CONFIG+=" 'qt_ldflags%': [], "$LN
|
||||
CONFIG+=" 'qt_moc%': [], "$LN
|
||||
CONFIG+=" 'qt_rcc%': [], "$LN
|
||||
}
|
||||
|
||||
# Load dependencies
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
'../default/string_stdlib.cpp',
|
||||
'../default/thread.cpp',
|
||||
'include/qmapboxgl.hpp',
|
||||
'qmapbox.qrc',
|
||||
'src/async_task.cpp',
|
||||
'src/async_task_impl.hpp',
|
||||
'src/http_file_source.cpp',
|
||||
|
||||
5
platform/qt/qmapbox.qrc
Normal file
5
platform/qt/qmapbox.qrc
Normal file
@@ -0,0 +1,5 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file alias="ca-bundle.crt">../../common/ca-bundle.crt</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -8,5 +8,13 @@
|
||||
'action': [ '<(qt_moc)', '<(RULE_INPUT_PATH)', '-o', '<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_DIRNAME)/moc_<(RULE_INPUT_ROOT).cpp' ],
|
||||
'message': 'Generating MOC <(RULE_INPUT_ROOT).cpp',
|
||||
},
|
||||
{
|
||||
'rule_name': 'QRC files',
|
||||
'extension': 'qrc',
|
||||
'process_outputs_as_sources': 1,
|
||||
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_DIRNAME)/qrc_<(RULE_INPUT_ROOT).cpp' ],
|
||||
'action': [ '<(qt_rcc)', '<(RULE_INPUT_PATH)', '-name', '<(RULE_INPUT_ROOT)', '-o', '<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_DIRNAME)/qrc_<(RULE_INPUT_ROOT).cpp' ],
|
||||
'message': 'Generating QRC <(RULE_INPUT_ROOT).cpp',
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
@@ -31,7 +31,9 @@ function print_qt_flags {
|
||||
QT_VERSION_MAJOR=$(qmake -query QT_VERSION | cut -d. -f1)
|
||||
if [ ${QT_VERSION_MAJOR} -gt 4 ] ; then
|
||||
CONFIG+=" 'qt_moc%': '$(pkg-config Qt${QT_VERSION_MAJOR}Core --variable=host_bins)/moc',"$LN
|
||||
CONFIG+=" 'qt_rcc%': '$(pkg-config Qt${QT_VERSION_MAJOR}Core --variable=host_bins)/rcc',"$LN
|
||||
else
|
||||
CONFIG+=" 'qt_moc%': '$(pkg-config QtCore --variable=moc_location)',"$LN
|
||||
CONFIG+=" 'qt_rcc%': '$(pkg-config QtCore --variable=rcc_location)',"$LN
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -9,10 +9,18 @@
|
||||
#include <QNetworkReply>
|
||||
#include <QSslConfiguration>
|
||||
|
||||
// Needs to be on the global namespace
|
||||
// for linking purposes.
|
||||
void initResources() {
|
||||
Q_INIT_RESOURCE(qmapbox);
|
||||
}
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
HTTPFileSource::Impl::Impl() : m_manager(new QNetworkAccessManager(this))
|
||||
{
|
||||
initResources();
|
||||
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
@@ -22,7 +30,7 @@ HTTPFileSource::Impl::Impl() : m_manager(new QNetworkAccessManager(this))
|
||||
m_ssl.setProtocol(QSsl::TlsV1);
|
||||
#endif
|
||||
|
||||
m_ssl.setCaCertificates(QSslCertificate::fromPath("ca-bundle.crt"));
|
||||
m_ssl.setCaCertificates(QSslCertificate::fromPath(":ca-bundle.crt"));
|
||||
if (m_ssl.caCertificates().isEmpty()) {
|
||||
mbgl::Log::Warning(mbgl::Event::HttpRequest, "Could not load list of certificate authorities");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user