Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    QUrl: Protocol "sftp" is unknown

    General and Desktop
    4
    7
    5467
    Loading More Posts
    • 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
      lagarkane last edited by

      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 Reply Quote 0
      • sierdzio
        sierdzio Moderators last edited by

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

        (Z(:^

        1 Reply Last reply Reply Quote 0
        • L
          lagarkane last edited by

          I am currently using Qt5.0.2 on Linux.

          1 Reply Last reply Reply Quote 0
          • JKSH
            JKSH Moderators last edited by

            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 Reply Quote 0
            • T
              tobias.hunger last edited by

              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 Reply Quote 0
              • L
                lagarkane last edited by

                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 Reply Quote 0
                • JKSH
                  JKSH Moderators last edited by

                  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 Reply Quote 0
                  • First post
                    Last post