curl-library
Active Mode put error
Date: Tue, 17 Apr 2018 15:11:15 +0200
Hello Everybody,
I'm writing a ftp client using libcurl
I put a file in active mode to filezilla ftp server, but I don't
understand completely the behaviour of libcurl
Here is the code what I'm doing with the client:
String fileName = "ftpTestFile.txt";
ftpClient->setIpAddress("127.0.0.1");
ftpClient->setPort(21);
ftpClient->connect("anonymous", "anonymous");
// might exist or not
ftpClient->rm(fileName);
ftpClient->setAsciiMode();
success = ftpClient->put(fileName , "Aloha");
Here what I'm wondering:
- I've done curl_easy_setopt(mCurl, CURLOPT_FTPPORT,
"127.0.0.1:33000-34999") but libcurl send PORT 127,0,0,1,128,232
- Why the the numerous PORT commands?
- Why is "TYPE I" used for the transfer?
- Why does my put fail?
I hope there is enough information and you don't need the ftp client
code to give me some hints.
PS: I use NOOP to test the connection
Here's the output
* Connection #0 to host 127.0.0.1 left intact
* Rebuilt URL to: ftp://127.0.0.1:21/
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 21 (#0)
< 220-FileZilla Server 0.9.60 beta
< 220-written by Tim Kosse (tim.kosse_at_filezilla-project.org)
< 220 Please visit https://filezilla-project.org/
> USER anonymous
< 331 Password required for anonymous
> PASS anonymous
< 230 Logged on
> PWD
< 257 "/" is current directory.
* Entry path is '/'
> PORT 127,0,0,1,128,232
* ftp_perform ends with SECONDARY: 1
< 200 Port command successful
* Connect data stream actively
> TYPE A
< 200 Type set to A
> NOOP
< 200 OK
* RETR response: 200
* Remembering we are in dir ""
* Connection #0 to host 127.0.0.1 left intact
* Found bundle for host 127.0.0.1: 0x23c572bd5d0 [serially]
* Re-using existing connection! (#0) with host 127.0.0.1
* Connected to 127.0.0.1 (127.0.0.1) port 21 (#0)
* Request has same path as previous transfer
* Hostname 127.0.0.1 was found in DNS cache
> PORT 127,0,0,1,128,232
* ftp_perform ends with SECONDARY: 1
< 200 Port command successful
* Connect data stream actively
> DELE ftpTestFile.txt
< 550 File not found
* RETR response: 550
* Remembering we are in dir ""
* Connection #0 to host 127.0.0.1 left intact
* Found bundle for host 127.0.0.1: 0x23c572bd5d0 [serially]
* Re-using existing connection! (#0) with host 127.0.0.1
* Connected to 127.0.0.1 (127.0.0.1) port 21 (#0)
* Request has same path as previous transfer
* Hostname 127.0.0.1 was found in DNS cache
> PORT 127,0,0,1,128,232
* ftp_perform ends with SECONDARY: 1
< 200 Port command successful
* Connect data stream actively
> TYPE A
< 200 Type set to A
* RETR response: 200
* Remembering we are in dir ""
* Connection #0 to host 127.0.0.1 left intact
* Found bundle for host 127.0.0.1: 0x23c572bd5d0 [serially]
* Re-using existing connection! (#0) with host 127.0.0.1
* Connected to 127.0.0.1 (127.0.0.1) port 21 (#0)
* Request has same path as previous transfer
* Hostname 127.0.0.1 was found in DNS cache
> PORT 127,0,0,1,128,232
* ftp_perform ends with SECONDARY: 1
< 200 Port command successful
* Connect data stream actively
> TYPE I
< 200 Type set to I
> STOR ftpTestFile.txt
< 150 Opening data channel for file upload to server of
"/ftpTestFile.txt"
* Preparing for accepting server on data port
* Checking for server connect
* Ctrl conn has data while waiting for data conn
< 425 Can't open data connection for transfer of "/ftpTestFile.txt"
* Remembering we are in dir ""
* Uploaded unaligned file size (0 out of 5 bytes)
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2018-04-17