cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: ftp SIZE command and ASCII/BINARY mode

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 21 Sep 2007 23:43:05 +0200 (CEST)

On Fri, 21 Sep 2007, Dan Fandrich wrote:

>> Really? Sounds like a bug then...
>
> SIZE is sent after TYPE for me even if I leave off the -I to curl:
>
> curl -v ftp://ftp.example.com/testfile

Right, but I believe Max wants CURLOPT_NOBODY set and then the current code
actually also requires CURL_HEADER to be set for the TYPE to be sent.

Possibly the patch below is what is needed, I'll try to get a test case
written to verify.

diff -u -r1.437 ftp.c
--- lib/ftp.c 11 Sep 2007 22:21:39 -0000 1.437
+++ lib/ftp.c 21 Sep 2007 21:41:02 -0000
@@ -1317,10 +1317,10 @@
    struct FTP *ftp = conn->data->reqdata.proto.ftp;
    struct SessionHandle *data = conn->data;

- /* If we have selected NOBODY and HEADER, it means that we only want file
+ /* If we have selected NOBODY, it means that we only want file
       information. Which in FTP can't be much more than the file size and
       date. */
- if(conn->bits.no_body && data->set.include_header && ftp->file &&
+ if(conn->bits.no_body && ftp->file &&
       ftp_need_type(conn, data->set.prefer_ascii)) {
      /* The SIZE command is _not_ RFC 959 specified, and therefor many servers
         may not support it! It is however the only way we have to get a file's

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-09-21