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

QUrl: Protocol "sftp" is unknown

Scheduled Pinned Locked Moved General and Desktop
7 Posts 4 Posters 5.9k 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.
  • L Offline
    L Offline
    lagarkane
    wrote on last edited by
    #1

    Hi there,

    I am trying to LIST my sftp server, but I've got a problem when sending my request:
    if I print my QNetworkReply::errorString(), this is what I get:
    Protocol "sftp" is unknown

    This is what my QUrl looks like:
    sftp://username:password@host:22

    username/password is ok, the host and port are the one required for my server, so I don't know what's going on...
    I tried with different schemes (http, https, ftp, sftp...) and it looks like only http and https is recognised...

    Any Ideas?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Qt4 or 5? There were changes to QUrl made for Qt5 that fixed a lot of issues.

      (Z(:^

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lagarkane
        wrote on last edited by
        #3

        I am currently using Qt5.0.2 on Linux.

        1 Reply Last reply
        0
        • JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote on last edited by
          #4

          I'm not sure about SFTP, but QNetworkAccessManager should handle FTP.

          Can you show us your code for creating and sending the request?

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tobias.hunger
            wrote on last edited by
            #5

            SFTP is not FTP-over-SSL but something implemented by SSH. I would be very surprised if that was supported by QNetworkAccessManager.

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lagarkane
              wrote on last edited by
              #6

              This is the code to send the request:

              @ m_sData.clear();

              QUrl url;
              url.setScheme("sftp");
              url.setUserName(m_sUsername);
              url.setPassword(m_sPasswd);
              url.setHost(m_sHost);
              url.setPort(m_iPort);
              url.setPath(path);
              
              
              QString verb = "LIST";
              QNetworkRequest* req = new QNetworkRequest(url);
              req->setAttribute(QNetworkRequest::CustomVerbAttribute, verb.toUtf8());
              m_pReply = m_pNet->sendCustomRequest(*req, "LIST");
              
              connect(m_pReply, SIGNAL(readyRead()),
                  this, SLOT(httpReadyRead()));
              connect(m_pReply, SIGNAL(finished()),
                 this, SLOT(httpFinished()));@
              

              Hope it can help. As I said, I tried with ftp, and it doesn't work either.
              Actually, I need an sftp connection in this project case, so if, as you say, SFTP is not implemented, I should look for another library as a replacement.
              My project already includes OpenSSH libraries for some other issues, so I should be able to develop an sftp connection with it, maybe.

              1 Reply Last reply
              0
              • JKSHJ Offline
                JKSHJ Offline
                JKSH
                Moderators
                wrote on last edited by
                #7

                The "documentation for sendCustomRequest()":http://qt-project.org/doc/qt-5.0/qtnetwork/qnetworkaccessmanager.html#sendCustomRequest says, "This feature is currently available for HTTP/HTTPS only."

                Anyway, it looks like SFTP is not supported. Here's a feature request for it, which hasn't been implemented: https://bugreports.qt-project.org/browse/QTBUG-8491

                Your best bet is to use OpenSSH then, I guess

                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                1 Reply Last reply
                0

                • Login

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