From 8a370cead2f493ee961c814af96192a8db3e18e3 Mon Sep 17 00:00:00 2001
From: Liang Qi <liang.qi@theqtcompany.com>
Date: Mon, 9 Mar 2015 12:49:00 +0100
Subject: [PATCH] Examples: fix certificate files for shadow build in
 sslechoserver
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Change-Id: I2e5c35586c3cdc153abf9a70ee1ed6bba7894ecb
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
---
 examples/websockets/sslechoserver/securesocketclient.qrc | 6 ++++++
 examples/websockets/sslechoserver/sslechoserver.cpp      | 4 ++--
 examples/websockets/sslechoserver/sslechoserver.pro      | 2 ++
 3 files changed, 10 insertions(+), 2 deletions(-)
 create mode 100644 examples/websockets/sslechoserver/securesocketclient.qrc

diff --git a/examples/websockets/sslechoserver/securesocketclient.qrc b/examples/websockets/sslechoserver/securesocketclient.qrc
new file mode 100644
index 00000000..448fa925
--- /dev/null
+++ b/examples/websockets/sslechoserver/securesocketclient.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+    <file>localhost.cert</file>
+    <file>localhost.key</file>
+</qresource>
+</RCC>
diff --git a/examples/websockets/sslechoserver/sslechoserver.cpp b/examples/websockets/sslechoserver/sslechoserver.cpp
index e87180e2..2849621a 100644
--- a/examples/websockets/sslechoserver/sslechoserver.cpp
+++ b/examples/websockets/sslechoserver/sslechoserver.cpp
@@ -50,8 +50,8 @@ SslEchoServer::SslEchoServer(quint16 port, QObject *parent) :
                                               QWebSocketServer::SecureMode,
                                               this);
     QSslConfiguration sslConfiguration;
-    QFile certFile(QStringLiteral("./localhost.cert"));
-    QFile keyFile(QStringLiteral("./localhost.key"));
+    QFile certFile(QStringLiteral(":/localhost.cert"));
+    QFile keyFile(QStringLiteral(":/localhost.key"));
     certFile.open(QIODevice::ReadOnly);
     keyFile.open(QIODevice::ReadOnly);
     QSslCertificate certificate(&certFile, QSsl::Pem);
diff --git a/examples/websockets/sslechoserver/sslechoserver.pro b/examples/websockets/sslechoserver/sslechoserver.pro
index 26638729..a1a5275a 100644
--- a/examples/websockets/sslechoserver/sslechoserver.pro
+++ b/examples/websockets/sslechoserver/sslechoserver.pro
@@ -15,3 +15,5 @@ HEADERS += \
     sslechoserver.h
 
 OTHER_FILES += sslechoclient.html
+
+RESOURCES += securesocketclient.qrc
-- 
GitLab