cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: FTP CURLOPT_POSTQUOTE with CURLOPT_NOBODY bug ?

From: Philippe Vaucher <pvaucher_at_infomaniak.ch>
Date: Mon, 06 Feb 2006 23:24:25 +0100

Hello,

Sorry for the delay I've been testing quite a lot of things.
Ok so :

1) it doesn't happen because of multi-thread
2) it doesn't happen because of same server
3) it does happen all the time !

I made a very simplified testcase, that doesn't require any special libs
beside libcurl so you'd be able to test yourself out, it's very simple :

./test ftp://user:pass@server.com/path file.txt

file.txt MUST be in the same dir of the ./test binary. This simply
uploads the file
to that dir, creating it if it doesn't exists, and delete it using a
POSTQUOTE option.

I tried your patch, with your patch it doesn't do the error but it tries
to delete
the file twice (ending in an error file is unknown).

Tell me if you have problems with the testcase, and thank you VERY MUCH
so far you answered quickly to my problem and I appreciate it :)
Small question: how am I supposed to log what happens during
FTP transfer ? like I do now (CURLOPT_VERBOSE with CURLOPT_DEBUGFUNCTION) ?

Thank you in advance,
Philippe

Daniel Stenberg wrote:

> On Tue, 24 Jan 2006, Daniel Stenberg wrote:
>
>> I believe the problem is connected to the fact that the re-use of the
>> connection fails, and libcurl makes a new connection (and then calls
>> Curl_follow() in which this false error is detected). In fact, I
>> would like you to try this patch:
>
>
> Please let me know how this patch worked, as I have no easy way to
> test this situation, and thus the patch, myself.
>

-------- [CALL] upload(bla.txt, ftp://user:pass@server.com/path/__delme.txt) --------

[info] About to connect() to unitedsoft.ch port 21
[info] Trying 123.123.123.123... [info] connected
[info] Connected to unitedsoft.ch (123.123.123.123) port 21
<< recv: 220 ProFTPD 1.2.10 Server (ProFTPD) [123.123.123.123]

>> send: USER user

<< recv: 331 Password required for use.

>> send: PASS pass

<< recv: 230 USER user logged in.

>> send: PWD

<< recv: 257 "/web" is current directory.

[info] Entry path is '/web'
>> send: CWD path

<< recv: 250 CWD command successful

>> send: EPSV

[info] Connect data stream passively
<< recv: 229 Entering Extended Passive Mode (|||52420|)

[info] Trying 123.123.123.123... [info] connected
[info] Connecting to 123.123.123.123 (123.123.123.123) port 52420
>> send: TYPE I

<< recv: 200 Type set to I

>> send: STOR __delme.txt

<< recv: 150 Opening BINARY mode data connection for __delme.txt

>> send data (skip log)
[info] Remembering we are in dir path/
<< recv: 226 Transfer complete.

[info] Connection #0 to host unitedsoft.ch left intact

-------- [CALL] ftp_cmd(ftp://user:pass@server.com/path/, DELE __delme.txt) --------

[info] Re-using existing connection! (#0) with host server.com
[info] Connected to server.com (123.123.123.123) port 21
[info] Request has same path as previous transfer
[info] Connection died, retrying a fresh connect
[info] Remembering we are in dir path/
>> send: DELE __delme.txt

<< recv: 250 DELE command successful

>> send: QUIT

<< recv: 221 Goodbye.

[info] Closing connection #0
[info] Maximum (0) redirects followed
[info] number of redirects hit maximum amount

-------- [CALL] upload(bla.txt, ftp://user:pass@server.com/path/__delme.txt) --------

[info] About to connect() to server.com port 21
[info] Trying 123.123.123.123... [info] connected
[info] Connected to server.com (123.123.123.123) port 21
<< recv: 220 ProFTPD 1.2.10 Server (ProFTPD) [123.123.123.123]

>> send: USER user

<< recv: 331 Password required for use.

>> send: PASS pass

<< recv: 230 USER user logged in.

>> send: PWD

<< recv: 257 "/web" is current directory.

[info] Entry path is '/web'
>> send: CWD path

<< recv: 250 CWD command successful

>> send: EPSV

[info] Connect data stream passively
<< recv: 229 Entering Extended Passive Mode (|||52208|)

[info] Trying 123.123.123.123... [info] connected
[info] Connecting to 123.123.123.123 (123.123.123.123) port 52208
>> send: TYPE I

<< recv: 200 Type set to I

>> send: STOR __delme.txt

<< recv: 150 Opening BINARY mode data connection for __delme.txt

>> send data (skip log)
[info] Remembering we are in dir path/
<< recv: 226 Transfer complete.

[info] Connection #0 to host server.com left intact

-------- [CALL] ftp_cmd(ftp://user:pass@server.com/path/, DELE __delme.txt) --------

[info] Re-using existing connection! (#0) with host server.com
[info] Connected to server.com (123.123.123.123) port 21
[info] Request has same path as previous transfer
[info] Connection died, retrying a fresh connect
[info] Remembering we are in dir path/
>> send: DELE __delme.txt

<< recv: 250 DELE command successful

>> send: QUIT

<< recv: 221 Goodbye.

[info] Closing connection #0
[info] Issue another request to this URL: 'ftp://use:pass@server.com/path/'
[info] About to connect() to server.com port 21
[info] Trying 123.123.123.123... [info] connected
[info] Connected to server.com (123.123.123.123) port 21
<< recv: 220 ProFTPD 1.2.10 Server (ProFTPD) [123.123.123.123]

>> send: USER user

<< recv: 331 Password required for use.

>> send: PASS pass

<< recv: 230 USER user logged in.

>> send: PWD

<< recv: 257 "/web" is current directory.

[info] Entry path is '/web'
>> send: CWD path

<< recv: 250 CWD command successful

[info] Remembering we are in dir path/
>> send: DELE __delme.txt

<< recv: 550 __delme.txt: No such file or directory

[info] QUOT string not accepted: DELE __delme.txt
[info] Connection #0 to host server.com left intact
[info] FTP: a quote command returned error
>> send: QUIT

<< recv: 221 Goodbye.

[info] Closing connection #0

Received on 2006-02-06