aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-01-01 15:35:53 +0100
committerDaniel Stenberg <daniel@haxx.se>2011-01-01 15:35:53 +0100
commit1ad5764febe5d7be57e18014e17a60fd2f2d553b (patch)
tree119dcd6c8b3a680a68ae1d5d819020c3aec9b7de /lib
parentae291421984a266176df34f24d3a5e76d76ec7c8 (diff)
SFTP: make pwd output result to header callback
Sending "pwd" as a QUOTE command only sent the reply to the DEBUGFUNCTION. Now it also sends an FTP-like header to the header callback to allow similar operations as with FTP, and apps can re-use the same parser.
Diffstat (limited to 'lib')
-rw-r--r--lib/ssh.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/ssh.c b/lib/ssh.c
index 895e34ee4..0ea814faa 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -1046,14 +1046,18 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
*/
if(curl_strequal("pwd", sshc->quote_item->data)) {
/* output debug output if that is requested */
- if(data->set.verbose) {
- char tmp[PATH_MAX+1];
+ char tmp[PATH_MAX+1];
+ snprintf(tmp, PATH_MAX, "257 \"%s\" is current directory.\n",
+ sftp_scp->path);
+ if(data->set.verbose) {
Curl_debug(data, CURLINFO_HEADER_OUT, (char *)"PWD\n", 4, conn);
- snprintf(tmp, PATH_MAX, "257 \"%s\" is current directory.\n",
- sftp_scp->path);
Curl_debug(data, CURLINFO_HEADER_IN, tmp, strlen(tmp), conn);
}
+ /* this sends an FTP-like "header" to the header callback so that the
+ current directory can be read very similar to how it is read when
+ using ordinary FTP. */
+ result = Curl_client_write(conn, CLIENTWRITE_HEADER, tmp, strlen(tmp));
state(conn, SSH_SFTP_NEXT_QUOTE);
break;
}