Error: Protocol "https" is unknown
-
wrote on 6 Nov 2024, 05:20 last edited by
Hello.
I am developing an app for a Linux unattended terminal (U1000) using Qt 5.2.1 C++.
Currently I am restricted to this version as the vendor has yet to support newer versions.I have a QNetworkRequest that runs well when I run the app on Windows. Both http and https works.
But when I deploy to the device, I am getting: Error: Protocol "https" is unknown.I checked the device via adb with openssl version and it has OpenSSL 1.0.2t 10 Sep 2019.
I have also downloaded OpenSSL in the Qt maintenance tool.Here is my request:
void NetworkManager::fetchData() { // Setup network manager QUrl url("https://jsonplaceholder.typicode.com/posts/1"); QNetworkRequest request(url); // Make the GET request reply = manager.get(request); // Connect reply's finished signal to the slot connect(reply, SIGNAL(finished()), this, SLOT(handleNetworkReply())); }
and a snippet of my .pro file:
LIBS += -LC:/NPT_SDK/Linux/Compiler/4.9.4/arm-linux-gnueabi/libc/usr/lib/ -lssl -lcrypto
-
Hello.
I am developing an app for a Linux unattended terminal (U1000) using Qt 5.2.1 C++.
Currently I am restricted to this version as the vendor has yet to support newer versions.I have a QNetworkRequest that runs well when I run the app on Windows. Both http and https works.
But when I deploy to the device, I am getting: Error: Protocol "https" is unknown.I checked the device via adb with openssl version and it has OpenSSL 1.0.2t 10 Sep 2019.
I have also downloaded OpenSSL in the Qt maintenance tool.Here is my request:
void NetworkManager::fetchData() { // Setup network manager QUrl url("https://jsonplaceholder.typicode.com/posts/1"); QNetworkRequest request(url); // Make the GET request reply = manager.get(request); // Connect reply's finished signal to the slot connect(reply, SIGNAL(finished()), this, SLOT(handleNetworkReply())); }
and a snippet of my .pro file:
LIBS += -LC:/NPT_SDK/Linux/Compiler/4.9.4/arm-linux-gnueabi/libc/usr/lib/ -lssl -lcrypto
wrote on 6 Nov 2024, 05:35 last edited by Ronel_qtmaster 11 Jun 2024, 05:36@jabille have you checked if it supports SLL using QSslSocket::supportsSsl() ?
If yes , you have to link your app with the exact openssl libs and corresponding to the openssl installed version.
For linux, you can try android openssl libraries. check this https://github.com/KDAB/android_openssl -
Hi,
As @Ronel_qtmaster wrote, you need matching OpenSSL but only the series should be the same e.g. 0.9, 1.0, 1.1 (it's not compatible with 1.0).
Also, you have to ensure that Qt is built with OpenSSL support. -
@jabille have you checked if it supports SLL using QSslSocket::supportsSsl() ?
If yes , you have to link your app with the exact openssl libs and corresponding to the openssl installed version.
For linux, you can try android openssl libraries. check this https://github.com/KDAB/android_opensslwrote on 6 Nov 2024, 06:27 last edited by jabille 11 Jun 2024, 06:30@Ronel_qtmaster @SGaist I don't think QSslSocket::supportsSsl() is supported in Qt 5.2.1. I am getting an error on this line.
Error is: Use of undeclared identifier QSslSocket
-
@Ronel_qtmaster @SGaist I don't think QSslSocket::supportsSsl() is supported in Qt 5.2.1. I am getting an error on this line.
Error is: Use of undeclared identifier QSslSocket
This post is deleted! -
@Ronel_qtmaster @SGaist I don't think QSslSocket::supportsSsl() is supported in Qt 5.2.1. I am getting an error on this line.
Error is: Use of undeclared identifier QSslSocket
@jabille said in Error: Protocol "https" is unknown:
@Ronel_qtmaster @SGaist I don't think QSslSocket::supportsSsl() is supported in Qt 5.2.1. I am getting an error on this line.
Error is: Use of undeclared identifier QSslSocket
As silly as it may sound: did you include the proper header ?
-
@jabille said in Error: Protocol "https" is unknown:
@Ronel_qtmaster @SGaist I don't think QSslSocket::supportsSsl() is supported in Qt 5.2.1. I am getting an error on this line.
Error is: Use of undeclared identifier QSslSocket
As silly as it may sound: did you include the proper header ?
-
@SGaist Yes. I #include <QSslSocket> and it the code is building properly on my Qt 6.7.3 Kit (Windows) but not on my Qt 5.2.1 Kit (Generates package installed to Linux device).
@jabille QSslSocket is available since Qt 4.3.
Do you haveQT += network
in your pro file?
How did you install Qt 5.2.1? Maybe network module is missing in this Qt installation? -
Lifetime Qt Championwrote on 6 Nov 2024, 06:47 last edited by SGaist 11 Jun 2024, 06:48
Beside the question from @jsulm, are you sure that version of Qt was built with OpenSSL support ?
-
wrote on 6 Nov 2024, 07:11 last edited by
Yes, I also have QT += network. I can confirm that network module is there.
I am able to get a proper response for a QNetworkRequest in 5.2.1 but only in http. If I set the url to https, I get the error: Protocol https is unknown. QNetworkAccessManager supportedSchemes() also does not list https.How do I check if it has OpenSSL support other than QSslSocket::supportsSsl()? The thing is that the qt5.2.1-arm-linux came from the device vendor. It is included in their SDK. So, they might be some things that are missing.
Also, sorry if I am replying to both of you at once. I can only post every 600 seconds as a newbie here.
-
You have the answer: the class is not available so it was not built with OpenSSL support.
You have to check with your vendor.
On that note, seeing the version of Qt, the versions of OpenSSL supported at that time are also now obsolete so I would highly recommend considering porting to a more recent version of Qt.
-
You have the answer: the class is not available so it was not built with OpenSSL support.
You have to check with your vendor.
On that note, seeing the version of Qt, the versions of OpenSSL supported at that time are also now obsolete so I would highly recommend considering porting to a more recent version of Qt.
wrote on 6 Nov 2024, 07:46 last edited by@SGaist I see. I'll talk to the vendor regarding this.
When I tried to copy the path of the #include <QSslSocket>, I can see that it is in the C:\NPT_SDK\Linux\Core\third-party\qt5.2.1-arm-linux\include\QtNetwork and inside qsslsocket.h there is a flag QT_NO_SSL. Maybe that is why it is disabled? I have no clue how that is set or where it's from. -
wrote on 6 Nov 2024, 07:48 last edited by
Also, to verify that your SSL works, you can try to compile and run the Secure Socket Client example app in Qt 5.2.1
-
@SGaist I see. I'll talk to the vendor regarding this.
When I tried to copy the path of the #include <QSslSocket>, I can see that it is in the C:\NPT_SDK\Linux\Core\third-party\qt5.2.1-arm-linux\include\QtNetwork and inside qsslsocket.h there is a flag QT_NO_SSL. Maybe that is why it is disabled? I have no clue how that is set or where it's from.@jabille said in Error: Protocol "https" is unknown:
Maybe that is why it is disabled?
No, it is there because Qt was built without SSL support. You need a Qt build with SSL support.
3/14