cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl doesn't handle responses from some old FTP servers

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 11 Apr 2003 10:09:03 +0200 (CEST)

On Fri, 4 Apr 2003, Alistair Campbell wrote:

> One of the FTP servers our system interacts with is an old Netware 3.12 FTP
> server. This server returns a 200 Command OK reponse code for successful
> completion of a CWD command, as opposed to the 250 File Command OK code
> that libcurl (ftp.c) expects (and the RFC requires).

Hi again Alistair,

I'm just now committing this change, I trust it will solve your problem?

diff -u -r1.174 ftp.c
--- lib/ftp.c 9 Apr 2003 11:56:31 -0000 1.174
+++ lib/ftp.c 11 Apr 2003 08:07:22 -0000
@@ -726,7 +726,10 @@
   if (result)
     return result;

- if (ftpcode != 250) {
+ /* According to RFC959, CWD is supposed to return 250 on success, but
+ there seem to be non-compliant FTP servers out there that return 200,
+ so we accept any '2xy' code here. */
+ if (ftpcode/100 != 2) {
     failf(conn->data, "Couldn't cd to %s", path);
     return CURLE_FTP_ACCESS_DENIED;
   }

-- 
 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger 
for complex code. Debugging C/C++ programs can leave you feeling lost and 
disoriented. TotalView can help you find your way. Available on major UNIX 
and Linux platforms. Try it free. www.etnus.com
Received on 2003-04-11