Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Error: Protocol "https" is unknown
QtWS25 Last Chance

Error: Protocol "https" is unknown

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
14 Posts 5 Posters 824 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jabille
    wrote on 6 Nov 2024, 05:20 last edited by
    #1

    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
    
    R 1 Reply Last reply 6 Nov 2024, 05:35
    0
    • J jabille
      6 Nov 2024, 05:20

      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
      
      R Offline
      R Offline
      Ronel_qtmaster
      wrote on 6 Nov 2024, 05:35 last edited by Ronel_qtmaster 11 Jun 2024, 05:36
      #2

      @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

      J 1 Reply Last reply 6 Nov 2024, 06:27
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 6 Nov 2024, 06:13 last edited by
        #3

        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.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        1
        • R Ronel_qtmaster
          6 Nov 2024, 05:35

          @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

          J Offline
          J Offline
          jabille
          wrote on 6 Nov 2024, 06:27 last edited by jabille 11 Jun 2024, 06:30
          #4

          @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

          J S 2 Replies Last reply 6 Nov 2024, 06:29
          0
          • J jabille
            6 Nov 2024, 06:27

            @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

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 6 Nov 2024, 06:29 last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            0
            • J jabille
              6 Nov 2024, 06:27

              @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

              S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 6 Nov 2024, 06:33 last edited by
              #6

              @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 ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              J 1 Reply Last reply 6 Nov 2024, 06:42
              1
              • S SGaist
                6 Nov 2024, 06:33

                @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 ?

                J Offline
                J Offline
                jabille
                wrote on 6 Nov 2024, 06:42 last edited by
                #7

                @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).

                J 1 Reply Last reply 6 Nov 2024, 06:44
                0
                • J jabille
                  6 Nov 2024, 06:42

                  @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).

                  J Offline
                  J Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 6 Nov 2024, 06:44 last edited by
                  #8

                  @jabille QSslSocket is available since Qt 4.3.
                  Do you have

                  QT += network
                  

                  in your pro file?
                  How did you install Qt 5.2.1? Maybe network module is missing in this Qt installation?

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 6 Nov 2024, 06:47 last edited by SGaist 11 Jun 2024, 06:48
                    #9

                    Beside the question from @jsulm, are you sure that version of Qt was built with OpenSSL support ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • J Offline
                      J Offline
                      jabille
                      wrote on 6 Nov 2024, 07:11 last edited by
                      #10

                      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.

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on 6 Nov 2024, 07:38 last edited by
                        #11

                        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.

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        J 1 Reply Last reply 6 Nov 2024, 07:46
                        0
                        • S SGaist
                          6 Nov 2024, 07:38

                          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.

                          J Offline
                          J Offline
                          jabille
                          wrote on 6 Nov 2024, 07:46 last edited by
                          #12

                          @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.

                          J 1 Reply Last reply 6 Nov 2024, 07:53
                          0
                          • H Offline
                            H Offline
                            hskoglund
                            wrote on 6 Nov 2024, 07:48 last edited by
                            #13

                            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

                            1 Reply Last reply
                            0
                            • J jabille
                              6 Nov 2024, 07:46

                              @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.

                              J Offline
                              J Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on 6 Nov 2024, 07:53 last edited by
                              #14

                              @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.

                              1 Reply Last reply
                              0

                              7/14

                              6 Nov 2024, 06:42

                              • Login

                              • Login or register to search.
                              7 out of 14
                              • First post
                                7/14
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • Users
                              • Groups
                              • Search
                              • Get Qt Extensions
                              • Unsolved