urlmon: Allow available_bytes to be set before protocol_continue call.

This commit is contained in:
Jacek Caban 2013-02-14 18:04:53 +01:00 committed by Alexandre Julliard
parent 79b236c2d1
commit 5f14eb564e
1 changed files with 26 additions and 20 deletions

View File

@ -338,7 +338,8 @@ HRESULT protocol_continue(Protocol *protocol, PROTOCOLDATA *data)
protocol->flags |= FLAG_FIRST_CONTINUE_COMPLETE;
}
if(data->pData >= UlongToPtr(BINDSTATUS_DOWNLOADINGDATA) && !protocol->available_bytes) {
if(data->pData >= UlongToPtr(BINDSTATUS_DOWNLOADINGDATA)) {
if(!protocol->available_bytes) {
BOOL res;
/* InternetQueryDataAvailable may immediately fork and perform its asynchronous
@ -347,6 +348,7 @@ HRESULT protocol_continue(Protocol *protocol, PROTOCOLDATA *data)
protocol->flags &= ~FLAG_REQUEST_COMPLETE;
res = InternetQueryDataAvailable(protocol->request, &protocol->available_bytes, 0, 0);
if(res) {
TRACE("available %u bytes\n", protocol->available_bytes);
if(!protocol->available_bytes) {
if(is_start) {
TRACE("empty file\n");
@ -357,13 +359,17 @@ HRESULT protocol_continue(Protocol *protocol, PROTOCOLDATA *data)
}
return S_OK;
}
protocol->flags |= FLAG_REQUEST_COMPLETE;
report_data(protocol);
}else if(GetLastError() != ERROR_IO_PENDING) {
protocol->flags |= FLAG_REQUEST_COMPLETE;
WARN("InternetQueryDataAvailable failed: %d\n", GetLastError());
report_result(protocol, INET_E_DATA_NOT_AVAILABLE);
return S_OK;
}
protocol->flags |= FLAG_REQUEST_COMPLETE;
}
report_data(protocol);
}
return S_OK;