On Wed, 29 Dec 2010, Christopher Gamio wrote:
I'm working on a small project where I need to know the directory a (s)ftp
user is initial sent to. I achieved this in the case of an ftp server by
sending the "pwd" command, and creating a specialized header function to
parse the response. But unfortunately in the case of an sftp connection, my
header function does not receive any data.
Ouch. You didn't mention which libcurl version you're using but I checked the
code for this logic and...
In the case of an SFTP connection, I see the following lines:
* Sending quote commands
PWD
< 257 "/" is current directory.
Recieved Header Line: drwxr-xr-x 3 root root 4096 Sep 9 12:18
home
It looks like for sftp connections the response is not being fed through the
header function like it is for ftp connection. Am I doing something wrong? I
searched through the mailing list archives and was able to find this thread
that describes the same issue, but it doesn't look like it was ever
resolved.
http://curl.haxx.se/mail/lib-2009-11/0108.html
No, I clearly dropped the ball and that one.
I read up on the current code for 'pwd' (lib/ssh.c:1046 to 1056) and it quite
clearly does not send the current path to the header callback. It is just sent
to the debug output function, which allows you to trap it if you use
CURLOPT_DEBUGFUNCTION but that really isn't what I thought or what I think is
correct.
This is a bug, we should fix it!
--
/ daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html