Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QUrl: Protocol "sftp" is unknown
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:
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...
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.
I'm not sure about SFTP, but QNetworkAccessManager should handle FTP.
Can you show us your code for creating and sending the request?
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:
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.
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