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) switch(dwResponse)
{ {
case 421: /* Service not available - Server may be shutting down. */ case 425: /* Cannot open data connection. */
dwCode = ERROR_INTERNET_EXTENDED_ERROR; dwCode = ERROR_INTERNET_CANNOT_CONNECT;
break; break;
case 425: /* Cannot open data connection. */ case 426: /* Connection closed, transer aborted. */
dwCode = ERROR_INTERNET_CANNOT_CONNECT; dwCode = ERROR_INTERNET_CONNECTION_ABORTED;
break; break;
case 426: /* Connection closed, transer aborted. */ case 530: /* Not logged in. Login incorrect. */
dwCode = ERROR_INTERNET_CONNECTION_ABORTED; dwCode = ERROR_INTERNET_LOGIN_FAILURE;
break; break;
case 500: /* Syntax error. Command unrecognized. */ case 421: /* Service not available - Server may be shutting down. */
case 501: /* Syntax error. Error in parameters or arguments. */ case 450: /* File action not taken. File may be busy. */
dwCode = ERROR_INTERNET_INCORRECT_FORMAT; case 451: /* Action aborted. Server error. */
break; 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. */ default:
dwCode = ERROR_INTERNET_LOGIN_FAILURE; dwCode = ERROR_INTERNET_EXTENDED_ERROR;
break; 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;
} }
INTERNET_SetLastError(dwCode); INTERNET_SetLastError(dwCode);

View File

@ -125,7 +125,6 @@ static void test_createdir(HINTERNET hFtp, HINTERNET hConnect)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
bRet = FtpCreateDirectoryA(hFtp, "new_directory_deadbeef"); bRet = FtpCreateDirectoryA(hFtp, "new_directory_deadbeef");
ok ( bRet == FALSE, "Expected FtpCreateDirectoryA to fail\n"); ok ( bRet == FALSE, "Expected FtpCreateDirectoryA to fail\n");
todo_wine
ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR, ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
"Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError()); "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
@ -165,7 +164,6 @@ static void test_deletefile(HINTERNET hFtp, HINTERNET hConnect)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
bRet = FtpDeleteFileA(hFtp, "non_existent_file_deadbeef"); bRet = FtpDeleteFileA(hFtp, "non_existent_file_deadbeef");
ok ( bRet == FALSE, "Expected FtpDeleteFileA to fail\n"); ok ( bRet == FALSE, "Expected FtpDeleteFileA to fail\n");
todo_wine
ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR, ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
"Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError()); "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
@ -256,14 +254,13 @@ static void test_getfile(HINTERNET hFtp, HINTERNET hConnect)
SetLastError(0xdeadbeef); 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); 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"); ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
todo_wine
{
ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR, ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
"Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError()); "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 */ /* 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, ok (GetFileAttributesA("should_also_be_non_existing_deadbeef") == INVALID_FILE_ATTRIBUTES,
"Local file should not have been created\n"); "Local file should not have been created\n");
}
DeleteFileA("should_also_be_non_existing_deadbeef"); 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 /* 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); 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); 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"); ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
todo_wine
{
ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR, ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
"Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError()); "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 */ /* 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, ok (GetFileAttributesA("should_also_be_non_existing_deadbeef") == INVALID_FILE_ATTRIBUTES,
"Local file should not have been created\n"); "Local file should not have been created\n");
}
DeleteFileA("should_also_be_non_existing_deadbeef"); DeleteFileA("should_also_be_non_existing_deadbeef");
/* This one should succeed */ /* This one should succeed */
@ -537,7 +533,6 @@ static void test_putfile(HINTERNET hFtp, HINTERNET hConnect)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
bRet = FtpPutFileA(hFtp, "now_existing_local", "non_existing_remote", FTP_TRANSFER_TYPE_UNKNOWN, 0); bRet = FtpPutFileA(hFtp, "now_existing_local", "non_existing_remote", FTP_TRANSFER_TYPE_UNKNOWN, 0);
ok ( bRet == FALSE, "Expected FtpPutFileA to fail\n"); ok ( bRet == FALSE, "Expected FtpPutFileA to fail\n");
todo_wine
ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR, ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
"Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError()); "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
@ -587,7 +582,6 @@ static void test_removedir(HINTERNET hFtp, HINTERNET hConnect)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
bRet = FtpRemoveDirectoryA(hFtp, "should_be_non_existing_deadbeef_dir"); bRet = FtpRemoveDirectoryA(hFtp, "should_be_non_existing_deadbeef_dir");
ok ( bRet == FALSE, "Expected FtpRemoveDirectoryA to fail\n"); ok ( bRet == FALSE, "Expected FtpRemoveDirectoryA to fail\n");
todo_wine
ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR, ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
"Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError()); "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
@ -595,7 +589,6 @@ static void test_removedir(HINTERNET hFtp, HINTERNET hConnect)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
bRet = FtpRemoveDirectoryA(hFtp, "pub"); bRet = FtpRemoveDirectoryA(hFtp, "pub");
ok ( bRet == FALSE, "Expected FtpRemoveDirectoryA to fail\n"); ok ( bRet == FALSE, "Expected FtpRemoveDirectoryA to fail\n");
todo_wine
ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR, ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
"Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError()); "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
@ -642,7 +635,6 @@ static void test_renamefile(HINTERNET hFtp, HINTERNET hConnect)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
bRet = FtpRenameFileA(hFtp , "should_be_non_existing_deadbeef", "new"); bRet = FtpRenameFileA(hFtp , "should_be_non_existing_deadbeef", "new");
ok ( bRet == FALSE, "Expected FtpRenameFileA to fail\n"); ok ( bRet == FALSE, "Expected FtpRenameFileA to fail\n");
todo_wine
ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR, ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
"Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError()); "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());