Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
b3ae533e
Commit
b3ae533e
authored
Sep 14, 2005
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 14, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added MIME type checking to ResProtocol::Start.
parent
5d0a292d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
21 deletions
+20
-21
protocol.c
dlls/mshtml/protocol.c
+9
-6
protocol.c
dlls/mshtml/tests/protocol.c
+11
-15
No files found.
dlls/mshtml/protocol.c
View file @
b3ae533e
...
...
@@ -549,7 +549,7 @@ static HRESULT WINAPI ResProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
ResProtocol
*
This
=
PROTOCOL_THIS
(
iface
);
DWORD
grfBINDF
=
0
,
len
;
BINDINFO
bindinfo
;
LPWSTR
url_dll
,
url_file
,
url
;
LPWSTR
url_dll
,
url_file
,
url
,
mime
;
HMODULE
hdll
;
HRSRC
src
;
HRESULT
hres
;
...
...
@@ -564,10 +564,6 @@ static HRESULT WINAPI ResProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
IInternetBindInfo_GetBindInfo
(
pOIBindInfo
,
&
grfBINDF
,
&
bindinfo
);
ReleaseBindInfo
(
&
bindinfo
);
/* FIXME:
* Implement MIME type checking
*/
len
=
strlenW
(
szUrl
)
+
16
;
url
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
hres
=
CoInternetParseUrl
(
szUrl
,
PARSE_ENCODE
,
0
,
url
,
len
,
&
len
,
0
);
...
...
@@ -602,10 +598,10 @@ static HRESULT WINAPI ResProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
}
src
=
FindResourceW
(
hdll
,
url_file
,
(
LPCWSTR
)
RT_HTML
);
HeapFree
(
GetProcessHeap
(),
0
,
url
);
if
(
!
src
)
{
WARN
(
"Could not find resource
\n
"
);
IInternetProtocolSink_ReportResult
(
pOIProtSink
,
HRESULT_FROM_WIN32
(
GetLastError
()),
0
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
url
);
return
HRESULT_FROM_WIN32
(
GetLastError
());
}
...
...
@@ -621,6 +617,13 @@ static HRESULT WINAPI ResProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
FreeLibrary
(
hdll
);
hres
=
FindMimeFromData
(
NULL
,
url_file
,
NULL
,
0
,
NULL
,
0
,
&
mime
,
0
);
HeapFree
(
GetProcessHeap
(),
0
,
url
);
if
(
SUCCEEDED
(
hres
))
{
IInternetProtocolSink_ReportProgress
(
pOIProtSink
,
BINDSTATUS_MIMETYPEAVAILABLE
,
mime
);
CoTaskMemFree
(
mime
);
}
IInternetProtocolSink_ReportData
(
pOIProtSink
,
BSCF_FIRSTDATANOTIFICATION
|
BSCF_LASTDATANOTIFICATION
|
BSCF_DATAFULLYAVAILABLE
,
This
->
data_len
,
This
->
data_len
);
...
...
dlls/mshtml/tests/protocol.c
View file @
b3ae533e
...
...
@@ -192,7 +192,7 @@ static void test_protocol_fail(IInternetProtocol *protocol, LPCWSTR url, HRESULT
expect_GetBindInfo
=
called_GetBindInfo
=
FALSE
;
}
static
void
protocol_start
(
IInternetProtocol
*
protocol
,
LPCWSTR
url
,
BOOL
is_mime_todo
)
static
void
protocol_start
(
IInternetProtocol
*
protocol
,
LPCWSTR
url
)
{
HRESULT
hres
;
...
...
@@ -202,16 +202,12 @@ static void protocol_start(IInternetProtocol *protocol, LPCWSTR url, BOOL is_mim
expect_ReportData
=
TRUE
;
expect_hrResult
=
S_OK
;
expect_hr_win32err
=
FALSE
;
hres
=
IInternetProtocol_Start
(
protocol
,
url
,
&
protocol_sink
,
&
bind_info
,
0
,
0
);
ok
(
hres
==
S_OK
,
"Start failed: %08lx
\n
"
,
hres
);
ok
(
called_GetBindInfo
,
"expected GetBindInfo
\n
"
);
if
(
is_mime_todo
)
{
todo_wine
{
ok
(
called_ReportProgress
,
"expected ReportProgress
\n
"
);
}
}
else
{
ok
(
called_ReportProgress
,
"expected ReportProgress
\n
"
);
}
ok
(
called_ReportData
,
"expected ReportData
\n
"
);
ok
(
called_ReportResult
,
"expected ReportResult
\n
"
);
called_GetBindInfo
=
expect_GetBindInfo
=
FALSE
;
...
...
@@ -311,7 +307,7 @@ static void test_res_protocol(void)
ok
(
hres
==
E_FAIL
,
"Read returned %08lx expected E_FAIL
\n
"
,
hres
);
ok
(
cb
==
0xdeadbeef
,
"cb=%lu expected 0xdeadbeef
\n
"
,
cb
);
protocol_start
(
protocol
,
blank_url
,
TRUE
);
protocol_start
(
protocol
,
blank_url
);
hres
=
IInternetProtocol_Read
(
protocol
,
buf
,
2
,
&
cb
);
ok
(
hres
==
S_OK
,
"Read failed: %08lx
\n
"
,
hres
);
ok
(
cb
==
2
,
"cb=%lu expected 2
\n
"
,
cb
);
...
...
@@ -323,7 +319,7 @@ static void test_res_protocol(void)
hres
=
IInternetProtocol_UnlockRequest
(
protocol
);
ok
(
hres
==
S_OK
,
"UnlockRequest failed: %08lx
\n
"
,
hres
);
protocol_start
(
protocol
,
blank_url
,
TRUE
);
protocol_start
(
protocol
,
blank_url
);
hres
=
IInternetProtocol_Read
(
protocol
,
buf
,
2
,
&
cb
);
ok
(
hres
==
S_OK
,
"Read failed: %08lx
\n
"
,
hres
);
hres
=
IInternetProtocol_LockRequest
(
protocol
,
0
);
...
...
@@ -333,7 +329,7 @@ static void test_res_protocol(void)
hres
=
IInternetProtocol_Read
(
protocol
,
buf
,
sizeof
(
buf
),
&
cb
);
ok
(
hres
==
S_OK
,
"Read failed: %08lx
\n
"
,
hres
);
protocol_start
(
protocol
,
blank_url
,
TRUE
);
protocol_start
(
protocol
,
blank_url
);
hres
=
IInternetProtocol_LockRequest
(
protocol
,
0
);
ok
(
hres
==
S_OK
,
"LockRequest failed: %08lx
\n
"
,
hres
);
hres
=
IInternetProtocol_Terminate
(
protocol
,
0
);
...
...
@@ -350,12 +346,12 @@ static void test_res_protocol(void)
ok
(
hres
==
S_OK
,
"Read failed: %08lx
\n
"
,
hres
);
ok
(
cb
==
2
,
"cb=%lu expected 2
\n
"
,
cb
);
protocol_start
(
protocol
,
blank_url
,
TRUE
);
protocol_start
(
protocol
,
blank_url
);
hres
=
IInternetProtocol_LockRequest
(
protocol
,
0
);
ok
(
hres
==
S_OK
,
"LockRequest failed: %08lx
\n
"
,
hres
);
hres
=
IInternetProtocol_Read
(
protocol
,
buf
,
sizeof
(
buf
),
&
cb
);
ok
(
hres
==
S_OK
,
"Read failed: %08lx
\n
"
,
hres
);
protocol_start
(
protocol
,
blank_url
,
TRUE
);
protocol_start
(
protocol
,
blank_url
);
hres
=
IInternetProtocol_Read
(
protocol
,
buf
,
sizeof
(
buf
),
&
cb
);
ok
(
hres
==
S_OK
,
"Read failed: %08lx
\n
"
,
hres
);
hres
=
IInternetProtocol_Terminate
(
protocol
,
0
);
...
...
@@ -443,7 +439,7 @@ static void test_about_protocol(void)
ok
(
hres
==
S_OK
,
"Could not get IInternetProtocol: %08lx
\n
"
,
hres
);
if
(
SUCCEEDED
(
hres
))
{
protocol_start
(
protocol
,
blank_url
,
FALSE
);
protocol_start
(
protocol
,
blank_url
);
hres
=
IInternetProtocol_LockRequest
(
protocol
,
0
);
ok
(
hres
==
S_OK
,
"LockRequest failed: %08lx
\n
"
,
hres
);
hres
=
IInternetProtocol_Read
(
protocol
,
buf
,
sizeof
(
buf
),
&
cb
);
...
...
@@ -453,7 +449,7 @@ static void test_about_protocol(void)
hres
=
IInternetProtocol_UnlockRequest
(
protocol
);
ok
(
hres
==
S_OK
,
"UnlockRequest failed: %08lx
\n
"
,
hres
);
protocol_start
(
protocol
,
test_url
,
FALSE
);
protocol_start
(
protocol
,
test_url
);
hres
=
IInternetProtocol_LockRequest
(
protocol
,
0
);
ok
(
hres
==
S_OK
,
"LockRequest failed: %08lx
\n
"
,
hres
);
hres
=
IInternetProtocol_Read
(
protocol
,
buf
,
sizeof
(
buf
),
&
cb
);
...
...
@@ -463,7 +459,7 @@ static void test_about_protocol(void)
hres
=
IInternetProtocol_UnlockRequest
(
protocol
);
ok
(
hres
==
S_OK
,
"UnlockRequest failed: %08lx
\n
"
,
hres
);
protocol_start
(
protocol
,
res_url
,
FALSE
);
protocol_start
(
protocol
,
res_url
);
hres
=
IInternetProtocol_LockRequest
(
protocol
,
0
);
ok
(
hres
==
S_OK
,
"LockRequest failed: %08lx
\n
"
,
hres
);
hres
=
IInternetProtocol_Read
(
protocol
,
buf
,
sizeof
(
buf
),
&
cb
);
...
...
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