cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Re: Why CURLOPT_TRANSFERTEXT doesn't work while downloading file in FTP :(???

From: Ngo Hoa Lan Phuong <orchidanz_at_gmail.com>
Date: Mon, 15 Dec 2008 17:10:00 +0700

>
> *> Yeah, I'm sure libcurl is sending Type A, I'm using a DebugFunction and
> it *
> *> prints out that TYPE = A. *
> *> Besides, I downloaded a text file in Unix format and I received a file
> in *
> *> Window format (newline = CRLF) *
> *> The file's opened in binary mode and I don't use a proxy. Using *
> *> CURLOPT_PROXY_TRANSFER_MODE don't have any effect in my case. *
>
> Are you downloading a directory listing by any chance? Those are done in
> ASCII mode.
>
> *> You said about appending ;type=B to the URL, but how to set it through
> a *
> *> option? I can't find any document about it :( *
>
> Append it to the URL means just that: ftp://www.example.com/file;type=I
> (there was a typo in my earlier message--I meant ;type=I for binary mode).
>
> If you still can't get it going, you'll be better off showing your code
> and log output.
>
I knew where's the problem. I used curl_easy_setopt with
CURLOPT_CUSTOMREQUEST option.
With this option, the CURLOPT_TRANSFERTEXT will have no effect.
Bellow is my code
...
if(curl) {
        curl_easy_setopt(curl, CURLOPT_VERBOSE, TRUE);
        curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, my_trace);
        curl_easy_setopt(curl, CURLOPT_DEBUGDATA, &config);

        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback);
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, hd_src);
        curl_easy_setopt(curl, CURLOPT_TRANSFERTEXT, 1);

        //std::string strCustomRequest = std::string("RETR ") +
"UnixTextFile";
        //curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST,
strCustomRequest.c_str());

        curl_easy_setopt(curl,CURLOPT_URL, "
ftp://localhost:30021/UnixTextFile");
        curl_easy_setopt(curl, CURLOPT_USERPWD, "test:test");

        curl_easy_setopt(curl, CURLOPT_TRANSFERTEXT, FALSE);

        if(CURLE_OK != res) {
            fprintf(stderr, "curl told us %d\n", res);
        }
*...
Btw, do you know how to reply to a message in a thread :( I don't know how
and hope this message will place in correct thread.

*Phuong.Ngo
*
*
Received on 2008-12-15