From 1005aceb22c8d13cdddf13745eec1187f507c4f4 Mon Sep 17 00:00:00 2001 From: "dougt%netscape.com" Date: Sat, 14 Apr 2001 20:36:24 +0000 Subject: [PATCH] Fixes 72774. Simple fix which checks the response code of the SYST command. If it is a 500 series we default to guessing the server is UNIX. r=bbaetz@cs.mcgill.ca git-svn-id: svn://10.0.0.236/trunk@92306 18797224-902f-48f8-a5cc-f745e15eee43 --- .../ftp/src/nsFtpConnectionThread.cpp | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp b/mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp index 74a8198dcee..08b07fc5813 100644 --- a/mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp +++ b/mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp @@ -1230,13 +1230,26 @@ nsFtpState::R_syst() { } else { - NS_ASSERTION(0, "Guessing FTP server type."); + NS_ASSERTION(0, "Guessing FTP server type."); // No clue. We will just hope it is UNIX type server. + // An assertion here indicates that we should be testing + // for another substring mServerType = FTP_UNIX_TYPE; mList = PR_TRUE; - } + } + + return FTP_S_PWD; + } + + if (mResponseCode/100 == 5) { + // server didn't like the SYST command. Probably (500, 501, 502) + // No clue. We will just hope it is UNIX type server. + mServerType = FTP_UNIX_TYPE; + mList = PR_TRUE; + + return FTP_S_PWD; } - return FTP_S_PWD; + return FTP_ERROR; } nsresult @@ -1456,8 +1469,13 @@ nsFtpState::S_list() { nsCOMPtr converter; rv = BuildStreamConverter(getter_AddRefs(converter)); - if (NS_FAILED(rv)) return rv; - + if (NS_FAILED(rv)) { + // clear mResponseMsg which is displayed to the user. + // TODO: we should probably set this to something + // meaningful. + mResponseMsg = ""; + return rv; + } mDRequestForwarder->SetStreamListener(converter); #ifdef DOUGT_NEW_CACHE