Commit 097750cf authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

Added MIME type checking to FileProtocol::Start.

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