cURL / Mailing Lists / curl-library / Single Mail

curl-library

Warkaround for double FTP response

From: Yastrebkov Dmitry <yastrebkov_at_gmail.com>
Date: Wed, 16 Dec 2009 13:42:35 +0600

Hi, everybody!

I'm trying to upload file to G6 FTP Server by appending blocks of data
to the existing file on the server.
After recieving APPE command my server send double response and curl
can't operate with it.
Curl get first response, extract response code 150, write "server did
not report OK, got 150" and return error
But in second response string server send "226 File received ok." That
mean transfer succeed.
If I add manual error parsing and analyze response code is equal to
150 second response string will be extracted from the queue for the
next command. So it will be response for old command already executed,
not for the new command.
How can I get last response or how can I flush response queue?

My application debug log:

* Remembering we are in dir ""
< 150 APPE supported. Ready to append file "TPG.pdf" at offset 16384.
* server did not report OK, got 150
* Connection #0 to host titan left intact
* Transferred a partial file

Here is a part of log on the server:

(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > EPSV
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > 500 Unknown command.
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > PASV
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > 227 Entering
Passive Mode (192,168,2,12,251,114).
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > TYPE A
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > 200 Type set to A.
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > LIST
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > 150 Data
connection accepted from 192.168.2.12:1537; transfer starting.
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > 226 File sent ok.
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > PASV
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > 227 Entering
Passive Mode (192,168,2,12,71,151).
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > TYPE I
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > 200 Type set to I.
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > STOR TPG.pdf
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > asked to upload
'TPG.pdf' in 'D:\ftp\user\test\ftp\' --> Access allowed.
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > 150 Data
connection accepted from 192.168.2.12:1538; transfer starting for
TPG.pdf.
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > started
uploading 'TPG.pdf' in 'D:\ftp\user\test\ftp\'.
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > 226 File received ok.
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > finished
uploading 'TPG.pdf' in 'D:\ftp\user\test\ftp\' - (00:00:01 - 16.000
KB - 16.000 KBytes/s).
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > PASV
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > 227 Entering
Passive Mode (192,168,2,12,95,110).
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > SIZE TPG.pdf
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > 213 16384
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > APPE TPG.pdf
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > asked to upload
'TPG.pdf' in 'D:\ftp\user\test\ftp\' --> Access allowed.
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > 150 Data
connection accepted from 192.168.2.12:1539; transfer starting for
TPG.pdf.
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > started
uploading 'TPG.pdf' in 'D:\ftp\user\test\ftp\'.
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > 150 APPE
supported. Ready to append file "TPG.pdf" at offset 16384.
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > 226 File received ok.
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > finished
uploading 'TPG.pdf' in 'D:\ftp\user\test\ftp\' - (00:00:01 - 16.000
KB - 16.000 KBytes/s).
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > PASV
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > 227 Entering
Passive Mode (192,168,2,12,245,151).
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > QUIT
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > 221 Bye bye ...
(000019) 12/16/2009 1:15:35 PM - user (192.168.2.12) > disconnected. (00:00:00)
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-12-16