Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
da110750
Commit
da110750
authored
Nov 23, 2011
by
Andy Clayton
Committed by
Alexandre Julliard
Nov 23, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Avoid calling HTTP_ReceiveRequestData before reading headers.
parent
e034ddee
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
23 deletions
+69
-23
http.c
dlls/wininet/http.c
+1
-1
http.c
dlls/wininet/tests/http.c
+68
-22
No files found.
dlls/wininet/http.c
View file @
da110750
...
@@ -4936,7 +4936,7 @@ lend:
...
@@ -4936,7 +4936,7 @@ lend:
if
(
request
->
session
->
appInfo
->
hdr
.
dwFlags
&
INTERNET_FLAG_ASYNC
)
if
(
request
->
session
->
appInfo
->
hdr
.
dwFlags
&
INTERNET_FLAG_ASYNC
)
{
{
if
(
res
==
ERROR_SUCCESS
)
{
if
(
res
==
ERROR_SUCCESS
)
{
if
(
request
->
contentLength
&&
request
->
bytesWritten
==
request
->
bytesToWrite
)
if
(
bEndRequest
&&
request
->
contentLength
&&
request
->
bytesWritten
==
request
->
bytesToWrite
)
HTTP_ReceiveRequestData
(
request
,
TRUE
);
HTTP_ReceiveRequestData
(
request
,
TRUE
);
else
else
send_request_complete
(
request
,
send_request_complete
(
request
,
...
...
dlls/wininet/tests/http.c
View file @
da110750
...
@@ -3245,7 +3245,8 @@ static void CALLBACK check_notification( HINTERNET handle, DWORD_PTR context, DW
...
@@ -3245,7 +3245,8 @@ static void CALLBACK check_notification( HINTERNET handle, DWORD_PTR context, DW
return
;
return
;
}
}
while
(
info
->
test
[
i
].
status
!=
status
&&
info
->
test
[
i
].
optional
&&
while
(
info
->
test
[
i
].
status
!=
status
&&
(
info
->
test
[
i
].
optional
||
info
->
test
[
i
].
todo
)
&&
i
<
info
->
count
-
1
&&
i
<
info
->
count
-
1
&&
info
->
test
[
i
].
function
==
info
->
test
[
i
+
1
].
function
)
info
->
test
[
i
].
function
==
info
->
test
[
i
+
1
].
function
)
{
{
...
@@ -3282,6 +3283,13 @@ static void setup_test( struct info *info, enum api function, unsigned int line
...
@@ -3282,6 +3283,13 @@ static void setup_test( struct info *info, enum api function, unsigned int line
info
->
line
=
line
;
info
->
line
=
line
;
}
}
struct
notification_data
{
const
struct
notification
*
test
;
const
unsigned
int
count
;
const
char
*
data
;
};
static
const
struct
notification
async_send_request_ex_test
[]
=
static
const
struct
notification
async_send_request_ex_test
[]
=
{
{
{
internet_connect
,
INTERNET_STATUS_HANDLE_CREATED
,
0
},
{
internet_connect
,
INTERNET_STATUS_HANDLE_CREATED
,
0
},
...
@@ -3305,7 +3313,40 @@ static const struct notification async_send_request_ex_test[] =
...
@@ -3305,7 +3313,40 @@ static const struct notification async_send_request_ex_test[] =
{
internet_close_handle
,
INTERNET_STATUS_HANDLE_CLOSING
,
0
,
}
{
internet_close_handle
,
INTERNET_STATUS_HANDLE_CLOSING
,
0
,
}
};
};
static
void
test_async_HttpSendRequestEx
(
void
)
static
const
struct
notification
async_send_request_ex_test2
[]
=
{
{
internet_connect
,
INTERNET_STATUS_HANDLE_CREATED
,
0
},
{
http_open_request
,
INTERNET_STATUS_HANDLE_CREATED
,
0
},
{
http_send_request_ex
,
INTERNET_STATUS_DETECTING_PROXY
,
1
,
0
,
1
},
{
http_send_request_ex
,
INTERNET_STATUS_RESOLVING_NAME
,
1
,
0
,
1
},
{
http_send_request_ex
,
INTERNET_STATUS_NAME_RESOLVED
,
1
,
0
,
1
},
{
http_send_request_ex
,
INTERNET_STATUS_CONNECTING_TO_SERVER
,
1
,
1
},
{
http_send_request_ex
,
INTERNET_STATUS_CONNECTED_TO_SERVER
,
1
,
1
},
{
http_send_request_ex
,
INTERNET_STATUS_SENDING_REQUEST
,
1
},
{
http_send_request_ex
,
INTERNET_STATUS_REQUEST_SENT
,
1
},
{
http_send_request_ex
,
INTERNET_STATUS_REQUEST_COMPLETE
,
1
},
{
http_end_request
,
INTERNET_STATUS_RECEIVING_RESPONSE
,
1
},
{
http_end_request
,
INTERNET_STATUS_RESPONSE_RECEIVED
,
1
},
{
http_end_request
,
INTERNET_STATUS_REQUEST_COMPLETE
,
1
},
{
internet_close_handle
,
INTERNET_STATUS_CLOSING_CONNECTION
,
0
,
0
,
1
},
{
internet_close_handle
,
INTERNET_STATUS_CONNECTION_CLOSED
,
0
,
0
,
1
},
{
internet_close_handle
,
INTERNET_STATUS_HANDLE_CLOSING
,
0
,
},
{
internet_close_handle
,
INTERNET_STATUS_HANDLE_CLOSING
,
0
,
}
};
static
const
struct
notification_data
notification_data
[]
=
{
{
async_send_request_ex_test
,
sizeof
(
async_send_request_ex_test
)
/
sizeof
(
async_send_request_ex_test
[
0
]),
"Public ID=codeweavers"
},
{
async_send_request_ex_test2
,
sizeof
(
async_send_request_ex_test
)
/
sizeof
(
async_send_request_ex_test
[
0
])
},
};
static
void
test_async_HttpSendRequestEx
(
const
struct
notification_data
*
nd
)
{
{
BOOL
ret
;
BOOL
ret
;
HINTERNET
ses
,
req
,
con
;
HINTERNET
ses
,
req
,
con
;
...
@@ -3313,13 +3354,14 @@ static void test_async_HttpSendRequestEx(void)
...
@@ -3313,13 +3354,14 @@ static void test_async_HttpSendRequestEx(void)
DWORD
size
,
written
,
error
;
DWORD
size
,
written
,
error
;
INTERNET_BUFFERSA
b
;
INTERNET_BUFFERSA
b
;
static
const
char
*
accept
[
2
]
=
{
"*/*"
,
NULL
};
static
const
char
*
accept
[
2
]
=
{
"*/*"
,
NULL
};
static
char
data
[]
=
"Public ID=codeweavers"
;
char
buffer
[
32
];
char
buffer
[
32
];
trace
(
"
\n
"
);
InitializeCriticalSection
(
&
notification_cs
);
InitializeCriticalSection
(
&
notification_cs
);
info
.
test
=
async_send_request_ex_
test
;
info
.
test
=
nd
->
test
;
info
.
count
=
sizeof
(
async_send_request_ex_test
)
/
sizeof
(
async_send_request_ex_test
[
0
])
;
info
.
count
=
nd
->
count
;
info
.
index
=
0
;
info
.
index
=
0
;
info
.
wait
=
CreateEvent
(
NULL
,
FALSE
,
FALSE
,
NULL
);
info
.
wait
=
CreateEvent
(
NULL
,
FALSE
,
FALSE
,
NULL
);
info
.
thread
=
GetCurrentThreadId
();
info
.
thread
=
GetCurrentThreadId
();
...
@@ -3345,10 +3387,10 @@ static void test_async_HttpSendRequestEx(void)
...
@@ -3345,10 +3387,10 @@ static void test_async_HttpSendRequestEx(void)
b
.
dwStructSize
=
sizeof
(
INTERNET_BUFFERSA
);
b
.
dwStructSize
=
sizeof
(
INTERNET_BUFFERSA
);
b
.
lpcszHeader
=
"Content-Type: application/x-www-form-urlencoded"
;
b
.
lpcszHeader
=
"Content-Type: application/x-www-form-urlencoded"
;
b
.
dwHeadersLength
=
strlen
(
b
.
lpcszHeader
);
b
.
dwHeadersLength
=
strlen
(
b
.
lpcszHeader
);
b
.
dwBufferTotal
=
strlen
(
data
)
;
b
.
dwBufferTotal
=
nd
->
data
?
strlen
(
nd
->
data
)
:
0
;
setup_test
(
&
info
,
http_send_request_ex
,
__LINE__
);
setup_test
(
&
info
,
http_send_request_ex
,
__LINE__
);
ret
=
HttpSendRequestExA
(
req
,
&
b
,
NULL
,
0x28
,
0
);
ret
=
HttpSendRequestExA
(
req
,
nd
->
data
?
&
b
:
NULL
,
NULL
,
0x28
,
0
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_IO_PENDING
,
"HttpSendRequestExA failed %d %u
\n
"
,
ret
,
GetLastError
()
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_IO_PENDING
,
"HttpSendRequestExA failed %d %u
\n
"
,
ret
,
GetLastError
()
);
WaitForSingleObject
(
info
.
wait
,
10000
);
WaitForSingleObject
(
info
.
wait
,
10000
);
...
@@ -3362,20 +3404,23 @@ static void test_async_HttpSendRequestEx(void)
...
@@ -3362,20 +3404,23 @@ static void test_async_HttpSendRequestEx(void)
ok
(
error
==
ERROR_INTERNET_INCORRECT_HANDLE_STATE
,
ok
(
error
==
ERROR_INTERNET_INCORRECT_HANDLE_STATE
,
"expected ERROR_INTERNET_INCORRECT_HANDLE_STATE got %u
\n
"
,
error
);
"expected ERROR_INTERNET_INCORRECT_HANDLE_STATE got %u
\n
"
,
error
);
written
=
0
;
if
(
nd
->
data
)
size
=
strlen
(
data
);
{
setup_test
(
&
info
,
internet_writefile
,
__LINE__
);
written
=
0
;
ret
=
InternetWriteFile
(
req
,
data
,
size
,
&
written
);
size
=
strlen
(
nd
->
data
);
ok
(
ret
,
"InternetWriteFile failed %u
\n
"
,
GetLastError
()
);
setup_test
(
&
info
,
internet_writefile
,
__LINE__
);
ok
(
written
==
size
,
"expected %u got %u
\n
"
,
written
,
size
);
ret
=
InternetWriteFile
(
req
,
nd
->
data
,
size
,
&
written
);
ok
(
ret
,
"InternetWriteFile failed %u
\n
"
,
GetLastError
()
);
WaitForSingleObject
(
info
.
wait
,
10000
);
ok
(
written
==
size
,
"expected %u got %u
\n
"
,
written
,
size
);
SetLastError
(
0xdeadbeef
);
WaitForSingleObject
(
info
.
wait
,
10000
);
ret
=
HttpEndRequestA
(
req
,
(
void
*
)
data
,
0x28
,
0
);
error
=
GetLastError
();
SetLastError
(
0xdeadbeef
);
ok
(
!
ret
,
"HttpEndRequestA succeeded
\n
"
);
ret
=
HttpEndRequestA
(
req
,
(
void
*
)
nd
->
data
,
0x28
,
0
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER got %u
\n
"
,
error
);
error
=
GetLastError
();
ok
(
!
ret
,
"HttpEndRequestA succeeded
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER got %u
\n
"
,
error
);
}
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
setup_test
(
&
info
,
http_end_request
,
__LINE__
);
setup_test
(
&
info
,
http_end_request
,
__LINE__
);
...
@@ -3524,7 +3569,8 @@ START_TEST(http)
...
@@ -3524,7 +3569,8 @@ START_TEST(http)
InternetReadFile_test
(
0
,
&
test_data
[
2
]);
InternetReadFile_test
(
0
,
&
test_data
[
2
]);
InternetReadFileExA_test
(
INTERNET_FLAG_ASYNC
);
InternetReadFileExA_test
(
INTERNET_FLAG_ASYNC
);
test_open_url_async
();
test_open_url_async
();
test_async_HttpSendRequestEx
();
test_async_HttpSendRequestEx
(
&
notification_data
[
0
]);
test_async_HttpSendRequestEx
(
&
notification_data
[
1
]);
InternetOpenRequest_test
();
InternetOpenRequest_test
();
test_http_cache
();
test_http_cache
();
InternetOpenUrlA_test
();
InternetOpenUrlA_test
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment