Added MIME type checking to FileProtocol::Start.
This commit is contained in:
parent
53a0c30078
commit
097750cf95
|
@ -103,7 +103,7 @@ static HRESULT WINAPI FileProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl
|
|||
DWORD grfBINDF = 0;
|
||||
LARGE_INTEGER size;
|
||||
DWORD len;
|
||||
LPWSTR url;
|
||||
LPWSTR url, mime = NULL;
|
||||
HRESULT hres;
|
||||
|
||||
static const WCHAR wszFile[] = {'f','i','l','e',':'};
|
||||
|
@ -127,9 +127,9 @@ static HRESULT WINAPI FileProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl
|
|||
return hres;
|
||||
}
|
||||
|
||||
/* FIXME:
|
||||
* Implement MIME type checking
|
||||
*/
|
||||
hres = FindMimeFromData(NULL, url, NULL, 0, NULL, 0, &mime, 0);
|
||||
if(SUCCEEDED(hres))
|
||||
IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_DIRECTBIND, mime);
|
||||
|
||||
if(!This->file) {
|
||||
This->file = CreateFileW(url+sizeof(wszFile)/sizeof(WCHAR), GENERIC_READ, FILE_SHARE_READ,
|
||||
|
@ -140,16 +140,20 @@ static HRESULT WINAPI FileProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl
|
|||
IInternetProtocolSink_ReportResult(pOIProtSink, INET_E_RESOURCE_NOT_FOUND,
|
||||
GetLastError(), NULL);
|
||||
HeapFree(GetProcessHeap(), 0, url);
|
||||
CoTaskMemFree(mime);
|
||||
return INET_E_RESOURCE_NOT_FOUND;
|
||||
}
|
||||
|
||||
IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_CACHEFILENAMEAVAILABLE,
|
||||
url+sizeof(wszFile)/sizeof(WCHAR));
|
||||
if(mime)
|
||||
IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_MIMETYPEAVAILABLE, mime);
|
||||
IInternetProtocolSink_ReportResult(pOIProtSink, S_OK, 0, NULL);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, url);
|
||||
}
|
||||
|
||||
CoTaskMemFree(mime);
|
||||
HeapFree(GetProcessHeap(), 0, url);
|
||||
|
||||
if(GetFileSizeEx(This->file, &size))
|
||||
IInternetProtocolSink_ReportData(pOIProtSink,
|
||||
BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION,
|
||||
|
|
|
@ -215,10 +215,10 @@ static void file_protocol_start(IInternetProtocol *protocol, LPCWSTR url, BOOL i
|
|||
ok(hres == S_OK, "Start failed: %08lx\n", hres);
|
||||
|
||||
CHECK_CALLED(GetBindInfo);
|
||||
todo_wine { CHECK_CALLED(ReportProgress_DIRECTBIND); }
|
||||
CHECK_CALLED(ReportProgress_DIRECTBIND);
|
||||
if(is_first) {
|
||||
CHECK_CALLED(ReportProgress_CACHEFILENAMEAVAILABLE);
|
||||
todo_wine { CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE); }
|
||||
CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
|
||||
CHECK_CALLED(ReportResult);
|
||||
}
|
||||
CHECK_CALLED(ReportData);
|
||||
|
@ -373,7 +373,7 @@ static void test_file_protocol(void) {
|
|||
ok(hres == INET_E_RESOURCE_NOT_FOUND,
|
||||
"Start failed: %08lx expected INET_E_RESOURCE_NOT_FOUND\n", hres);
|
||||
CHECK_CALLED(GetBindInfo);
|
||||
todo_wine { CHECK_CALLED(ReportProgress_DIRECTBIND); }
|
||||
CHECK_CALLED(ReportProgress_DIRECTBIND);
|
||||
CHECK_CALLED(ReportResult);
|
||||
|
||||
IInternetProtocol_Release(protocol);
|
||||
|
@ -392,7 +392,7 @@ static void test_file_protocol(void) {
|
|||
ok(hres == INET_E_RESOURCE_NOT_FOUND,
|
||||
"Start failed: %08lx, expected INET_E_RESOURCE_NOT_FOUND\n", hres);
|
||||
CHECK_CALLED(GetBindInfo);
|
||||
todo_wine { CHECK_CALLED(ReportProgress_DIRECTBIND); }
|
||||
CHECK_CALLED(ReportProgress_DIRECTBIND);
|
||||
CHECK_CALLED(ReportResult);
|
||||
|
||||
IInternetProtocol_Release(protocol);
|
||||
|
|
Loading…
Reference in New Issue