cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_PREQUOTE does not take effect

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Wed, 2 Nov 2016 17:50:20 +0100

On Wed, Nov 02, 2016 at 03:05:44AM +0000, yuxia.gao_at_thomsonreuters.com wrote:
> The limitation on the server side is as below:
>
> On the server side, there is folder file with path info /REU/2016/10/11/INFOFILE/BONDMARKET/TPCP/Public/BondInfo20161011.zip
>
> While the default folder we entered after log on is /REU/2016/10/11/,
>
> If I try to download the file using the url ftp://104.8.220.20//REU/2016/10/11/INFOFILE/BONDMARKET/TPCP/Public/BondInfo20161011.zip
>
>
> The returned error code is " Server denied you to change to the given directory ", do you know why such kind of error is returned and how to solve it?

This is probably due to a broken FTP server. Try setting CURLOPT_FTP_FILEMETHOD
to CURLFTPMETHOD_SINGLECWD, and also make sure the user you're using to access
the server has permissions to access the file.

> But If I use CUSTOMREQUEST, send request "RETR /REU/2016/10/11/INFOFILE/BONDMARKET/TPCP/Public/BondInfo20161011.zip ", I can download the file, the only problem is the file is downloaded using ASCII type,

As Daniel explained, don't use RETR in a custom request! It's not going to work
properly.

> Which causes the file not same as server side. So, I need to set the transfer type to Binary before data transmission. Here, it comes the problem that PREQUOTE does not work.

Append ;type=i to the URL to explicitly set binary mode.

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