QUrl: Protocol "sftp" is unknown



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


  • Moderators

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



  • I am currently using Qt5.0.2 on Linux.


  • Moderators

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

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


  • Moderators

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



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


  • Moderators

    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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.