Commit 68453a52 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wininet: Always set last error in HttpSendRequest{,Ex}.

parent ae8c2ec2
...@@ -4000,8 +4000,7 @@ lend: ...@@ -4000,8 +4000,7 @@ lend:
WININET_Release( &lpwhr->hdr ); WININET_Release( &lpwhr->hdr );
TRACE("<---\n"); TRACE("<---\n");
if(res != ERROR_SUCCESS) SetLastError(res);
SetLastError(res);
return res == ERROR_SUCCESS; return res == ERROR_SUCCESS;
} }
...@@ -4089,8 +4088,7 @@ lend: ...@@ -4089,8 +4088,7 @@ lend:
if( lpwhr ) if( lpwhr )
WININET_Release( &lpwhr->hdr ); WININET_Release( &lpwhr->hdr );
if(res != ERROR_SUCCESS) SetLastError(res);
SetLastError(res);
return res == ERROR_SUCCESS; return res == ERROR_SUCCESS;
} }
......
...@@ -971,8 +971,7 @@ static void HttpSendRequestEx_test(void) ...@@ -971,8 +971,7 @@ static void HttpSendRequestEx_test(void)
HINTERNET hRequest; HINTERNET hRequest;
INTERNET_BUFFERS BufferIn; INTERNET_BUFFERS BufferIn;
DWORD dwBytesWritten; DWORD dwBytesWritten, dwBytesRead, error;
DWORD dwBytesRead;
CHAR szBuffer[256]; CHAR szBuffer[256];
int i; int i;
BOOL ret; BOOL ret;
...@@ -1008,8 +1007,11 @@ static void HttpSendRequestEx_test(void) ...@@ -1008,8 +1007,11 @@ static void HttpSendRequestEx_test(void)
BufferIn.dwOffsetLow = 0; BufferIn.dwOffsetLow = 0;
BufferIn.dwOffsetHigh = 0; BufferIn.dwOffsetHigh = 0;
SetLastError(0xdeadbeef);
ret = HttpSendRequestEx(hRequest, &BufferIn, NULL, 0 ,0); ret = HttpSendRequestEx(hRequest, &BufferIn, NULL, 0 ,0);
ok(ret, "HttpSendRequestEx Failed with error %u\n", GetLastError()); error = GetLastError();
ok(ret, "HttpSendRequestEx Failed with error %u\n", error);
ok(error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", error);
for (i = 3; szPostData[i]; i++) for (i = 3; szPostData[i]; i++)
ok(InternetWriteFile(hRequest, &szPostData[i], 1, &dwBytesWritten), ok(InternetWriteFile(hRequest, &szPostData[i], 1, &dwBytesWritten),
...@@ -1752,7 +1754,7 @@ static DWORD CALLBACK server_thread(LPVOID param) ...@@ -1752,7 +1754,7 @@ static DWORD CALLBACK server_thread(LPVOID param)
static void test_basic_request(int port, const char *verb, const char *url) static void test_basic_request(int port, const char *verb, const char *url)
{ {
HINTERNET hi, hc, hr; HINTERNET hi, hc, hr;
DWORD r, count; DWORD r, count, error;
char buffer[0x100]; char buffer[0x100];
hi = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); hi = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
...@@ -1764,8 +1766,11 @@ static void test_basic_request(int port, const char *verb, const char *url) ...@@ -1764,8 +1766,11 @@ static void test_basic_request(int port, const char *verb, const char *url)
hr = HttpOpenRequest(hc, verb, url, NULL, NULL, NULL, 0, 0); hr = HttpOpenRequest(hc, verb, url, NULL, NULL, NULL, 0, 0);
ok(hr != NULL, "HttpOpenRequest failed\n"); ok(hr != NULL, "HttpOpenRequest failed\n");
SetLastError(0xdeadbeef);
r = HttpSendRequest(hr, NULL, 0, NULL, 0); r = HttpSendRequest(hr, NULL, 0, NULL, 0);
error = GetLastError();
ok(r, "HttpSendRequest failed\n"); ok(r, "HttpSendRequest failed\n");
ok(error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", error);
count = 0; count = 0;
memset(buffer, 0, sizeof buffer); memset(buffer, 0, sizeof buffer);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment