diff options
author | Chris Lumens <clumens@redhat.com> | 2005-01-12 21:39:14 +0000 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2005-01-12 21:39:14 +0000 |
commit | 0281e868090822dd6fbbb19ab21ee9277feabf0d (patch) | |
tree | d8647d7897ba6b1d9e3011c336857568accd7976 /loader2/ftp.c | |
parent | 0d202f91c2048bec9e1c193af558da4b9ec8408b (diff) | |
download | anaconda-0281e868090822dd6fbbb19ab21ee9277feabf0d.tar.gz anaconda-0281e868090822dd6fbbb19ab21ee9277feabf0d.tar.xz anaconda-0281e868090822dd6fbbb19ab21ee9277feabf0d.zip |
When unable to connect to an HTTP or FTP server for some reason, display an
error message instead of flashing back to the input screen. (#144546).
Diffstat (limited to 'loader2/ftp.c')
-rw-r--r-- | loader2/ftp.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/loader2/ftp.c b/loader2/ftp.c index f3a8004ce..9227a5c68 100644 --- a/loader2/ftp.c +++ b/loader2/ftp.c @@ -149,7 +149,10 @@ static int ftpCheckResponse(int sock, char ** str) { } while (doesContinue && !rc); if (*errorCode == '4' || *errorCode == '5') { - if (!strncmp(errorCode, "550", 3)) { + if (!strncmp(errorCode, "421", 3)) { + return FTPERR_TOO_MANY_CONNECTIONS; + } + else if (!strncmp(errorCode, "550", 3)) { return FTPERR_FILE_NOT_FOUND; } @@ -381,28 +384,34 @@ int ftpGetFileDone(int sock) { return 0; } -const char *ftpStrerror(int errorNumber) { +const char *ftpStrerror(int errorNumber, urlprotocol protocol) { switch (errorNumber) { case FTPERR_BAD_SERVER_RESPONSE: - return ("Bad FTP server response"); + return(protocol == URL_METHOD_FTP ? "Bad FTP server response" : + "Bad HTTP server response"); case FTPERR_SERVER_IO_ERROR: - return("FTP IO error"); + return(protocol == URL_METHOD_FTP ? "FTP IO error" : "HTTP IO error"); case FTPERR_SERVER_TIMEOUT: - return("FTP server timeout"); + return(protocol == URL_METHOD_FTP ? "FTP server timeout" : + "HTTP server timeout"); case FTPERR_BAD_HOST_ADDR: - return("Unable to lookup FTP server host address"); + return(protocol == URL_METHOD_FTP ? "Unable to lookup FTP server host address" : + "Unable to lookup HTTP server host address"); case FTPERR_BAD_HOSTNAME: - return("Unable to lookup FTP server host name"); + return(protocol == URL_METHOD_FTP ? "Unable to lookup FTP server host name" : + "Unable to lookup HTTP server host name"); case FTPERR_FAILED_CONNECT: - return("Failed to connect to FTP server"); + return(protocol == URL_METHOD_FTP ? "Failed to connect to FTP server" : + "Failed to connect to HTTP server"); case FTPERR_FAILED_DATA_CONNECT: - return("Failed to establish data connection to FTP server"); + return(protocol == URL_METHOD_FTP ? "Failed to establish data connection to FTP server" : + "Failed to establish data connection to HTTP server"); case FTPERR_FILE_IO_ERROR: return("IO error to local file"); @@ -413,9 +422,13 @@ const char *ftpStrerror(int errorNumber) { case FTPERR_FILE_NOT_FOUND: return("File not found on server"); + case FTPERR_TOO_MANY_CONNECTIONS: + return(protocol == URL_METHOD_FTP ? "Too many connections to FTP server" : + "Too many connections to HTTP server"); + case FTPERR_UNKNOWN: default: - return("FTP Unknown or unexpected error"); + return("Unknown or unexpected error"); } } |