Hi I am new to libwww but have managed to integrate libwww into our application to retrieve small ASCII files transparently from either an ftp or webserver. However, I've hit a snag and would like to propose a small patch that gets around the problem. Problem occurs for the following: ftp://<host>:<port>/<top-dir>/<invalid-dir>/<filename> returns an empty directory listing, I expected "404 Not Found" error. By comparison the following scenario's produce: ftp://<host>:<port>/<top-dir>/<valid-dir> returns "404 Not Found" ftp://<host>:<port>/<top-dir>/<valid-dir>/ returns directory listing ftp://<host>:<port>/<top-dir>/<invalid-dir> return "404 Not Found" I am wondering whether the current behaviour of the library conforms to paragraph 3.2.2 of RFC 1738. Here is a portion of the trace of the communication between the client and the server: IN is the client OUT is the server .... OUT 230 Guest login ok, access restrictions apply. IN TYPE I OUT 200 Type set to I. IN PORT 192,168,35,47,153,217 OUT 200 PORT command successful. IN RETR /pub/nonsuch/anyfile OUT 550 /pub/nonsuch/anyfile: No such file or directory. IN CWD / OUT 250 CWD command successful. IN CWD pub OUT 250 CWD command successful. IN CWD nonsuch OUT 550 nonsuch: No such file or directory. IN SYST OUT 215 UNIX Type: L8 Version: SUNOS IN LIST anyfile OUT 150 Binary data connection for /bin/ls (192.168.35.47,39385) (0 bytes). OUT 226 Binary Transfer complete. Stepping through the code I found the code that causes this to be in HTFTP.c(v1.109): 1568: else if (!FTP_DIR(data) && !data->stream_error) { 1569: FTPListType(data, ctrl->server); If I delete the above lines, I get the results that I expect and am wondering whether the changes that were applied to CVS versions 1.95 and 1.104 have not made this code redundant. I am attaching a patch that shows my changes. Patch tests OK with: patch HTFTP.c HTFTP.patch (My platform is Solaris 5.7. Also the application defaults to FTP_DEFAULT_TRANSFER_MODE (i.e. 'I')) Is my 'fix' valid or am I misunderstanding something and making a mistake in my application? Regards Renate *** HTFTP.c.orig Fri Aug 8 19:35:58 2003 --- HTFTP.c Fri Aug 8 19:29:57 2003 *************** *** 1563,1575 **** ctrl->state = FTP_SUCCESS; else if (status == HT_OK) ctrl->state = FTP_NEED_DCON; ! else if (HTRequest_method(request) == METHOD_PUT) ctrl->state = FTP_ERROR; - else if (!FTP_DIR(data) && !data->stream_error) { - FTPListType(data, ctrl->server); - ctrl->state = FTP_NEED_SERVER; /* Try a dir instead? */ - } else - ctrl->state = FTP_ERROR; break; case FTP_NEED_SERVER: --- 1563,1570 ---- ctrl->state = FTP_SUCCESS; else if (status == HT_OK) ctrl->state = FTP_NEED_DCON; ! else ctrl->state = FTP_ERROR; break; case FTP_NEED_SERVER:Received on Monday, 11 August 2003 07:10:21 GMT
This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:43 GMT