cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Failed Writing Body

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 22 Sep 2011 20:13:20 +0200 (CEST)

On Thu, 22 Sep 2011, Mark Schienbein wrote:

> Yes you misunderstood that I am not requesting a file from the remote FTP
> server but instead I am uploading a file to it.

Ouch. How sloppy of me.

When we're uploading data, everything is sent as binary by libcurl. Any
translations done to that data is done by the proxy.

> The "type=i" which automatically gets appended to the "PUT" command URL by
> CURLlib (because of the CURLOPT_PROXY_TRANSFER_MODE setting) becomes part of
> the uploaded filename on the FTP server. Using the
> CURLOPT_PROXY_TRANSFER_MODE setting does produce a binary file transfer to
> the remote server (the uploaded file is identical to the local source file).

CURLOPT_PROXY_TRANSFER_MODE _only_ adds that string to the URL, it makes no
other change to the data or how libcurl works.

> It appears that with the CURLOPT_PROXY_TRANSFER_MODE option set, CURL is
> setting the FTP option to binary (using the FTP binary command?)

No. It appends ";type=i" to the URL that is passed in the request to the
proxy. Remember that libcurl speaks HTTP with a HTTP proxy (as long as you
don't tunnel through it). It is the proxy that converts from HTTP to FTP and
the proxy will use the ";type=i" info and enable binary transfers.

> but then also passes the ";type=i" clause to the FTP server which gets
> interpreted as part of the file name.

";type=i" seems to be the only way to tell the server to use binary, right?

> So my question is: Is their some way to get CURL to indicate to the taget
> server to do a binary file transfer, but then not pass the ";type=i" clause
> on the PUT command url?

You tell us! As I've explained, FTP over an HTTP proxy is not a standard. It
is an extension that the proxy may allow and support, and exactly how it works
is unknown to us. You should probably investigate this question in the proxy
documentation/source code!

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-09-22