cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: libcurl FTP Quote Option

From: Steve Smith <ssmi_at_lle.rochester.edu>
Date: Mon, 02 Apr 2007 15:55:24 -0400
Thanks for the quick reply. What I want to do is issue a 'get' command for file transfer (I simplified the example by using 'bin' instead). My 'get' failed with results identical to the 'bin' failure (i.e., 502 Command not implemented), so I figured I was doing something wrong with the quoting - although that doesn't appear to be the case. Once I can retrieve files via the command line, I need to graduate and obtain them programmatically using libcurl.

Here is the debug output from command
curl -v --trace log.txt ftp://name:password@123.456.7.89 -Q'cd mem', which also failed in the same manner as 'bin' and 'get' (xx entries added by me!). BTW, I have tried all of these commands via the shell command line and all worked successfully. Thanks again for your help!


== Info: About to connect() to 123.456.7.89 port 21 (#0)              
== Info:   Trying 123.456.7.89... == Info: connected                  
== Info: Connected to 123.456.7.89 (123.456.7.89) port 21 (#0)        
== Info: FTP 0xadf00 state change from STOP to WAIT220                
<= Recv header, 32 bytes (0x20)                                       
0000: 32 32 30 20 50 69 63 53 69 67 68 74 20 46 54 50 220 PicSight FTP 0010: 20 53 65 72 76 65 72 20 72 65 61 64 79 2e 0d 0a  Server ready...
=> Send header, 11 bytes (0xb)                                         0000: 55 53 45 52 20 xx xx xx xx 0d 0a                USER name..     
== Info: FTP 0xadf00 state change from WAIT220 to USER                
<= Recv header, 36 bytes (0x24)                                       
0000: 33 33 31 20 55 73 65 72 20 6e 61 6d 65 20 6f 6b 331 User name ok
0010: 61 79 2c 20 6e 65 65 64 20 70 61 73 73 77 6f 72 ay, need passwor
0020: 64 2e 0d 0a                                     d...             => Send header, 11 bytes (0xb)                                        
0000: 50 41 53 53 20 xx xx xx xx 0d 0a                PASS password..  == Info: FTP 0xadf00 state change from USER to PASS                   
<= Recv header, 30 bytes (0x1e)                                       
0000: 32 33 30 20 55 73 65 72 20 6c 6f 67 67 65 64 20 230 User logged 
0010: 69 6e 2c 20 70 72 6f 63 65 65 64 2e 0d 0a       in, proceed...  
=> Send header, 5 bytes (0x5)                                         
0000: 50 57 44 0d 0a                                  PWD..           
== Info: FTP 0xadf00 state change from PASS to PWD                     <= Recv header, 31 bytes (0x1f)                                       
0000: 32 35 37 20 22 2f 22 20 69 73 20 63 75 72 72 65 257 "/" is curre
0010: 6e 74 20 64 69 72 65 63 74 6f 72 79 2e 0d 0a    nt directory... 
== Info: Entry path is '/'                                            
== Info: FTP 0xadf00 state change from PWD to STOP                    
== Info: protocol connect phase DONE                                  
== Info: DO phase starts                                               => Send header, 8 bytes (0x8)                                         
0000: 63 64 20 6d 65 6d 0d 0a                         cd mem..        
== Info: FTP 0xadf00 state change from STOP to QUOTE                  
<= Recv header, 30 bytes (0x1e)                                       
0000: 35 30 32 20 43 6f 6d 6d 61 6e 64 20 6e 6f 74 20 502 Command not 
0010: 69 6d 70 6c 65 6d 65 6e 74 65 64 2e 0d 0a       implemented...  
== Info: QUOT command failed with 502                                 
== Info: DO phase is complete                                         
== Info: Closing connection #0


Dan Fandrich wrote:
On Mon, Apr 02, 2007 at 02:45:08PM -0400, Steve Smith wrote:
  
Hello. Although the documentation covers this pretty well, I can't get FTP
quoting to work. Here's a simple session that tries quoting the FTP command
'bin':
    
[...]
  
bin
      
* FTP 0xadf00 state change from STOP to QUOTE
< 502 Command not implemented.
    

Looks like quoting worked fine--curl sent the command 'bin' just like you
asked.  You probably didn't want to send 'bin', though; if you want to 
emulate what the 'bin' command does in the ftp command-line client, you
need to enable debugging (with the 'debug' command) then see what the
client is actually sending to the server.  In this case, you'll see the
command 'TYPE I' being sent.  But curl sends that by default, anyway, so
this is a null exercise.  What you you trying to accomplish with this
command?

  
Dan
        

-- 
Steve Smith
Lead Programmer/Analyst
Omega EP Project
Laboratory for Laser Energetics (www.lle.rochester.edu)
University of Rochester
Rochester, NY 14623
Received on 2007-04-02