wininet: Correct several ftp server response to error code mappings.

This commit is contained in:
Hans Leidekker 2007-10-31 22:53:51 +01:00 committed by Alexandre Julliard
parent 83fd17f216
commit 5270b429fa
2 changed files with 30 additions and 47 deletions

View File

@ -3437,45 +3437,36 @@ static DWORD FTP_SetResponseError(DWORD dwResponse)
switch(dwResponse)
{
case 421: /* Service not available - Server may be shutting down. */
dwCode = ERROR_INTERNET_EXTENDED_ERROR;
break;
case 425: /* Cannot open data connection. */
dwCode = ERROR_INTERNET_CANNOT_CONNECT;
break;
case 425: /* Cannot open data connection. */
dwCode = ERROR_INTERNET_CANNOT_CONNECT;
break;
case 426: /* Connection closed, transer aborted. */
dwCode = ERROR_INTERNET_CONNECTION_ABORTED;
break;
case 426: /* Connection closed, transer aborted. */
dwCode = ERROR_INTERNET_CONNECTION_ABORTED;
break;
case 530: /* Not logged in. Login incorrect. */
dwCode = ERROR_INTERNET_LOGIN_FAILURE;
break;
case 500: /* Syntax error. Command unrecognized. */
case 501: /* Syntax error. Error in parameters or arguments. */
dwCode = ERROR_INTERNET_INCORRECT_FORMAT;
break;
case 421: /* Service not available - Server may be shutting down. */
case 450: /* File action not taken. File may be busy. */
case 451: /* Action aborted. Server error. */
case 452: /* Action not taken. Insufficient storage space on server. */
case 500: /* Syntax error. Command unrecognized. */
case 501: /* Syntax error. Error in parameters or arguments. */
case 502: /* Command not implemented. */
case 503: /* Bad sequence of commands. */
case 504: /* Command not implemented for that parameter. */
case 532: /* Need account for storing files */
case 550: /* File action not taken. File not found or no access. */
case 551: /* Requested action aborted. Page type unknown */
case 552: /* Action aborted. Exceeded storage allocation */
case 553: /* Action not taken. File name not allowed. */
case 530: /* Not logged in. Login incorrect. */
dwCode = ERROR_INTERNET_LOGIN_FAILURE;
break;
case 550: /* File action not taken. File not found or no access. */
dwCode = ERROR_INTERNET_ITEM_NOT_FOUND;
break;
case 450: /* File action not taken. File may be busy. */
case 451: /* Action aborted. Server error. */
case 452: /* Action not taken. Insufficient storage space on server. */
case 502: /* Command not implemented. */
case 503: /* Bad sequence of commands. */
case 504: /* Command not implemented for that parameter. */
case 532: /* Need account for storing files */
case 551: /* Requested action aborted. Page type unknown */
case 552: /* Action aborted. Exceeded storage allocation */
case 553: /* Action not taken. File name not allowed. */
default:
dwCode = ERROR_INTERNET_EXTENDED_ERROR;
break;
default:
dwCode = ERROR_INTERNET_EXTENDED_ERROR;
break;
}
INTERNET_SetLastError(dwCode);

View File

@ -125,7 +125,6 @@ static void test_createdir(HINTERNET hFtp, HINTERNET hConnect)
SetLastError(0xdeadbeef);
bRet = FtpCreateDirectoryA(hFtp, "new_directory_deadbeef");
ok ( bRet == FALSE, "Expected FtpCreateDirectoryA to fail\n");
todo_wine
ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
"Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
@ -165,7 +164,6 @@ static void test_deletefile(HINTERNET hFtp, HINTERNET hConnect)
SetLastError(0xdeadbeef);
bRet = FtpDeleteFileA(hFtp, "non_existent_file_deadbeef");
ok ( bRet == FALSE, "Expected FtpDeleteFileA to fail\n");
todo_wine
ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
"Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
@ -256,14 +254,13 @@ static void test_getfile(HINTERNET hFtp, HINTERNET hConnect)
SetLastError(0xdeadbeef);
bRet = FtpGetFileA(hFtp, "should_be_non_existing_deadbeef", "should_also_be_non_existing_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0);
ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
todo_wine
{
ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
"Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
/* Currently Wine always creates the local file (even on failure) which is not correct, hence the test */
todo_wine
ok (GetFileAttributesA("should_also_be_non_existing_deadbeef") == INVALID_FILE_ATTRIBUTES,
"Local file should not have been created\n");
}
DeleteFileA("should_also_be_non_existing_deadbeef");
/* Same call as the previous but now the local file does exists. Windows just removes the file if the call fails
@ -278,14 +275,13 @@ static void test_getfile(HINTERNET hFtp, HINTERNET hConnect)
SetLastError(0xdeadbeef);
bRet = FtpGetFileA(hFtp, "should_be_non_existing_deadbeef", "should_also_be_non_existing_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0);
ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
todo_wine
{
ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
"Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
/* Currently Wine always creates the local file (even on failure) which is not correct, hence the test */
todo_wine
ok (GetFileAttributesA("should_also_be_non_existing_deadbeef") == INVALID_FILE_ATTRIBUTES,
"Local file should not have been created\n");
}
DeleteFileA("should_also_be_non_existing_deadbeef");
/* This one should succeed */
@ -537,7 +533,6 @@ static void test_putfile(HINTERNET hFtp, HINTERNET hConnect)
SetLastError(0xdeadbeef);
bRet = FtpPutFileA(hFtp, "now_existing_local", "non_existing_remote", FTP_TRANSFER_TYPE_UNKNOWN, 0);
ok ( bRet == FALSE, "Expected FtpPutFileA to fail\n");
todo_wine
ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
"Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
@ -587,7 +582,6 @@ static void test_removedir(HINTERNET hFtp, HINTERNET hConnect)
SetLastError(0xdeadbeef);
bRet = FtpRemoveDirectoryA(hFtp, "should_be_non_existing_deadbeef_dir");
ok ( bRet == FALSE, "Expected FtpRemoveDirectoryA to fail\n");
todo_wine
ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
"Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
@ -595,7 +589,6 @@ static void test_removedir(HINTERNET hFtp, HINTERNET hConnect)
SetLastError(0xdeadbeef);
bRet = FtpRemoveDirectoryA(hFtp, "pub");
ok ( bRet == FALSE, "Expected FtpRemoveDirectoryA to fail\n");
todo_wine
ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
"Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
@ -642,7 +635,6 @@ static void test_renamefile(HINTERNET hFtp, HINTERNET hConnect)
SetLastError(0xdeadbeef);
bRet = FtpRenameFileA(hFtp , "should_be_non_existing_deadbeef", "new");
ok ( bRet == FALSE, "Expected FtpRenameFileA to fail\n");
todo_wine
ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
"Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());