urlmon/tests: Use the same thread for both connections in redirect tests.
Fixes a race spotted by Zebediah Figura. Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
df976fd57a
commit
749dbd81b1
|
@ -156,7 +156,7 @@ static PROTOCOLDATA protocoldata, *pdata, continue_protdata;
|
||||||
static DWORD prot_read, filter_state, http_post_test, thread_id;
|
static DWORD prot_read, filter_state, http_post_test, thread_id;
|
||||||
static BOOL security_problem, test_async_req, impl_protex;
|
static BOOL security_problem, test_async_req, impl_protex;
|
||||||
static BOOL async_read_pending, mimefilter_test, direct_read, wait_for_switch, emulate_prot, short_read, test_abort;
|
static BOOL async_read_pending, mimefilter_test, direct_read, wait_for_switch, emulate_prot, short_read, test_abort;
|
||||||
static BOOL empty_file, no_mime, bind_from_cache, file_with_hash;
|
static BOOL empty_file, no_mime, bind_from_cache, file_with_hash, reuse_protocol_thread;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
STATE_CONNECTING,
|
STATE_CONNECTING,
|
||||||
|
@ -1611,11 +1611,12 @@ static HRESULT WINAPI ProtocolEmul_QueryInterface(IInternetProtocolEx *iface, RE
|
||||||
|
|
||||||
static DWORD WINAPI thread_proc(PVOID arg)
|
static DWORD WINAPI thread_proc(PVOID arg)
|
||||||
{
|
{
|
||||||
BOOL redirect_only = redirect_on_continue;
|
BOOL redirect = redirect_on_continue;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
memset(&protocoldata, -1, sizeof(protocoldata));
|
memset(&protocoldata, -1, sizeof(protocoldata));
|
||||||
|
|
||||||
|
while(1) {
|
||||||
prot_state = 0;
|
prot_state = 0;
|
||||||
|
|
||||||
SET_EXPECT(ReportProgress_FINDINGRESOURCE);
|
SET_EXPECT(ReportProgress_FINDINGRESOURCE);
|
||||||
|
@ -1642,9 +1643,9 @@ static DWORD WINAPI thread_proc(PVOID arg)
|
||||||
CHECK_CALLED(Switch);
|
CHECK_CALLED(Switch);
|
||||||
ok(hres == S_OK, "Switch failed: %08x\n", hres);
|
ok(hres == S_OK, "Switch failed: %08x\n", hres);
|
||||||
|
|
||||||
if(redirect_only) {
|
if(!redirect)
|
||||||
prot_state = 0;
|
break;
|
||||||
return 0;
|
redirect = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!short_read) {
|
if(!short_read) {
|
||||||
|
@ -1799,6 +1800,7 @@ static void protocol_start(IInternetProtocolSink *pOIProtSink, IInternetBindInfo
|
||||||
|
|
||||||
IServiceProvider_Release(service_provider);
|
IServiceProvider_Release(service_provider);
|
||||||
|
|
||||||
|
if(!reuse_protocol_thread)
|
||||||
CreateThread(NULL, 0, thread_proc, NULL, 0, &tid);
|
CreateThread(NULL, 0, thread_proc, NULL, 0, &tid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1909,6 +1911,7 @@ static HRESULT WINAPI ProtocolEmul_Continue(IInternetProtocolEx *iface,
|
||||||
|
|
||||||
if(redirect_on_continue) {
|
if(redirect_on_continue) {
|
||||||
redirect_on_continue = FALSE;
|
redirect_on_continue = FALSE;
|
||||||
|
reuse_protocol_thread = TRUE;
|
||||||
|
|
||||||
if(bindinfo_options & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS)
|
if(bindinfo_options & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS)
|
||||||
SET_EXPECT(Redirect);
|
SET_EXPECT(Redirect);
|
||||||
|
@ -2632,6 +2635,7 @@ static void init_test(int prot, DWORD flags)
|
||||||
bind_from_cache = (flags & TEST_FROMCACHE) != 0;
|
bind_from_cache = (flags & TEST_FROMCACHE) != 0;
|
||||||
file_with_hash = FALSE;
|
file_with_hash = FALSE;
|
||||||
security_problem = FALSE;
|
security_problem = FALSE;
|
||||||
|
reuse_protocol_thread = FALSE;
|
||||||
|
|
||||||
bindinfo_options = 0;
|
bindinfo_options = 0;
|
||||||
if(flags & TEST_DISABLEAUTOREDIRECT)
|
if(flags & TEST_DISABLEAUTOREDIRECT)
|
||||||
|
|
Loading…
Reference in New Issue