I tried to access the home directory via SFTP and received an error, even though this type of request was working before:
$ curl -u builder 'sftp://192.168.236.1/~'
Enter host password for user 'builder':
curl: (78) Could not open remote file for reading: SFTP server: No such file
After investigating the issue, I found out the following:
The new algorithm only resolves the path /~/, but /~ remains unchanged.
I added support for /~, but after successful resolving to /home/builder, the resulting request still didn't work
$ ./src/curl -u builder 'sftp://192.168.236.1/~'
Enter host password for user 'builder':
curl: (56) Failure when receiving data from the peer
It turned out that for SFTP requests, it's necessary to finalize the path with a /. In the old algorithm, when resolving ~, symbol / was automatically added after the home directory in the resulting path, which allowed the request to work. But, for example, the next request didn't work:
$ curl -u builder 'sftp://192.168.236.1/home/builder'
Enter host password for user 'builder':
curl: (56) Failure when receiving data from the peer
So I'm not sure yet whether the function Curl_getworkingpath() should resolve the path /~ to /home/user or to /home/user/ , as it was before.
The text was updated successfully, but these errors were encountered:
It did strike me that we generally document that you need to end the path with a trailing slash to get a directory listing, which this does not. So, I'm not sure if we need to fix the code or make the documentation clearer...
So, if I understand you correctly, in the previous version (before commit 4e2b52b5f7a3bf50a), it was mistakenly possible to successfully process the request sftp://url/~, but now this has been fixed and it is necessary to write sftp://url/~/?
libcurl used to do a directory listing for this case (even though the
documentation says a URL needs to end in a slash for this), but
4e2b52b modified the behavior.
This change brings back a directory listing for SFTP paths that are
specified exactly as /~ in the URL.
Reported-by: Pavel Mayorov
Fixes#11001
I tried to access the home directory via SFTP and received an error, even though this type of request was working before:
About my Ubuntu 22.04:
This behavior appeared after adding commit 4e2b52b5f7a3bf50a.
After investigating the issue, I found out the following:
/~/
, but/~
remains unchanged./~
, but after successful resolving to/home/builder
, the resulting request still didn't workIt turned out that for SFTP requests, it's necessary to finalize the path with a
/
. In the old algorithm, when resolving~
, symbol/
was automatically added after the home directory in the resulting path, which allowed the request to work. But, for example, the next request didn't work:So I'm not sure yet whether the function Curl_getworkingpath() should resolve the path
/~
to/home/user
or to/home/user/
, as it was before.The text was updated successfully, but these errors were encountered: