cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: FTP Response

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 1 Feb 2010 23:31:18 +0100 (CET)

On Mon, 1 Feb 2010, Irvs wrote:

Now please don't top-post. Read the etiquette link for details.

> I have another question. I noticed that when an FTP server requires
> authentication, the curl returns an equivalent CURLE_"needs-authentication"
> error. While on the case of HTTP, curl just returns CURLE_OK, and you need
> to parse the header response for any errors returned by the server. Am I
> correct in saying that responses of FTP and HTTP are handled differently by
> curl?

Yes and no. They results in different return codes, but the (original) reason
for that is the complete different nature of the protocols and how they treat
authentication problems. In HTTP, there's no actual failure but just a
different return code, while in FTP there is a more clear error and break of
process.

> I am also faced with a problem when FTP requests are handled by an HTTP
> proxy since in this scenario, HTTP response format are used instead of the
> FTP response standard.

FTP over a HTTP proxy is completely unspecified and you should consider it
slightly better than pure mumbo jumbo. Different proxies will act differently.

> I don't know how to identify if the response is from a HTTP proxy server or
> from an FTP server. Or, it could be that when its from an FTP server, an
> equivalent CURLE_error is returned and if its an from an HTTP proxy CURLE_OK
> is returned and parse for error from the header response?

If a HTTP proxy is used for FTP, you know the response is HTTP.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-02-01