cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: CURLOPT_PREQUOTE does not take effect

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 1 Nov 2016 08:11:04 +0100 (CET)

On Tue, 1 Nov 2016, yuxia.gao_at_thomsonreuters.com wrote:

Please don't top-post!

> As I know, if we put the filename in the url, by default, we get the file in binary mode.
>
> But if we use RETR command to get the file, the default mode is ASCII.

How else would you get a file with FTP if not with RETR?

> Take curl tool for example as below, the default type used is different. And
> it is similar using libcurl.
>
> curl -v -v ftp://167.76.40.96/41943.ini --user bb:dd
>
> and curl -v -v ftp://167.76.40.96 --user bb:dd -X "RETR 41943.ini"

You don't need more than one -v, that has no extra effect.

Using a URL without a file path equals ending it with a trailing slash and
that will be treated as a directory listing by libcurl. You do directory
listings as ASCII with ftp really. You then try to send "RETR" for a directory
listing and that is highly weird and yes, I bet libcurl does have a problem
with that but I also couldn't tell you what could possibly be a sensible
reaction to that. Also, RETR will never work as a QUOTE command since it'll
need the second connection magic and libcurl does that only for its default
file transfer logci, not for the sequance of comments you can send with the
QUOTE options.

That's why your first example above works as binary, since that asks for a
file and then libcurl will set TYPE I by default.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html
Received on 2016-11-01