> -----Original Message-----
> From: curl-library-bounces_at_cool.haxx.se
> [mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of
> Daniel Stenberg
> Sent: Wednesday, November 11, 2009 3:10 AM
> To: libcurl development
> Subject: Re: response to quoted pwd command in libcurl
>
> On Tue, 10 Nov 2009, Xu, Qiang (FXSGSC) wrote:
>
> > The command seems to be successful, but I can only see the
> > destination directory's content listing. How can I retrieve the
> > result of the quoted command "pwd", both by curl command
> > and by libcurl?
>
> It is sent as a header, so use the header callback for that.
Hi, Daniel:
I still can't figure out what is wrong with my usage, both in testing code and in command-line.
From the manpage, it says:
=====================================
-D/--dump-header <file>
Write the protocol headers to the specified file.
This option is handy to use when you want to store the headers
that a HTTP site sends to you. Cookies from the headers could
then be read in a second curl invocation by using the
-b/--cookie option! The -c/--cookie-jar option is however a bet-
ter way to store cookies.
When used in FTP, the FTP server response lines are considered
being "headers" and thus are saved there.
If this option is used several times, the last one will be used.
=====================================
It looks like the option I should use to see the command feedback.
So, I tried the following:
=====================================
qxu_at_durian(pts/2):~/opensrc/curl-7.19.6/src[174]$ touch saveHeader.txt
qxu_at_durian(pts/2):~/opensrc/curl-7.19.6/src[175]$ ll saveHeader.txt
-rw-rw-r-- 1 qxu XOG_cc 0 Nov 12 17:59 saveHeader.txt
qxu@durian(pts/2):~/opensrc/curl-7.19.6/src[176]$ ./curl -u qxu:fair123 sftp://13.198.98.190/~/scan/ -Q "pwd" -D saveHeader.txt
drwxrwxr-x 3 qxu XOG_cc 9216 Nov 12 14:26 .
drwxrwxr-x 20 qxu XOG_cc 3072 Nov 12 17:56 ..
drwxrwxr-x 2 qxu XOG_cc 7168 Nov 5 16:14 sxc
-rwxr-xr-x 1 qxu XOG_cc 560 Nov 5 16:13 ren3.pl
-rwxr-xr-x 1 qxu XOG_cc 131 Nov 2 11:56 ren1.sh
-rw-r--r-- 1 qxu XOG_cc 2106 Nov 6 18:29 test.txt
-rwxr-xr-x 1 qxu XOG_cc 88 Nov 5 16:15 ren2.sh
-rw-r--r-- 1 qxu XOG_cc 2106 Nov 12 14:26 test1.txt
-rw-r--r-- 1 qxu XOG_cc 2106 Nov 12 14:26 test2.txt
qxu_at_durian(pts/2):~/opensrc/curl-7.19.6/src[177]$ ll saveHeader.txt
-rw-rw-r-- 1 qxu XOG_cc 0 Nov 12 17:59 saveHeader.txt
=====================================
You can see the file "saveHeader.txt" is still 0-byte, meaning nothing has been saved there.
I have gone over the whole manpage, and didn't find any other option to use. Would you shed some more light on this issue?
Thanks,
Xu Qiang
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-11-12