Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
13aac41b
Commit
13aac41b
authored
Oct 17, 2013
by
Nikolay Sivov
Committed by
Alexandre Julliard
Oct 17, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Set referrer header to container url.
parent
3988ee94
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
7 deletions
+74
-7
httprequest.c
dlls/msxml3/httprequest.c
+24
-1
httpreq.c
dlls/msxml3/tests/httpreq.c
+50
-6
No files found.
dlls/msxml3/httprequest.c
View file @
13aac41b
...
...
@@ -458,9 +458,11 @@ static HRESULT WINAPI BSCHttpNegotiate_BeginningTransaction(IHttpNegotiate *ifac
{
static
const
WCHAR
content_type_utf8W
[]
=
{
'C'
,
'o'
,
'n'
,
't'
,
'e'
,
'n'
,
't'
,
'-'
,
'T'
,
'y'
,
'p'
,
'e'
,
':'
,
' '
,
't'
,
'e'
,
'x'
,
't'
,
'/'
,
'p'
,
'l'
,
'a'
,
'i'
,
'n'
,
';'
,
'c'
,
'h'
,
'a'
,
'r'
,
's'
,
'e'
,
't'
,
'='
,
'u'
,
't'
,
'f'
,
'-'
,
'8'
,
'\r'
,
'\n'
,
0
};
static
const
WCHAR
refererW
[]
=
{
'R'
,
'e'
,
'f'
,
'e'
,
'r'
,
'e'
,
'r'
,
':'
,
' '
,
0
};
BindStatusCallback
*
This
=
impl_from_IHttpNegotiate
(
iface
);
const
struct
httpheader
*
entry
;
BSTR
base_uri
=
NULL
;
WCHAR
*
buff
,
*
ptr
;
int
size
=
0
;
...
...
@@ -476,8 +478,18 @@ static HRESULT WINAPI BSCHttpNegotiate_BeginningTransaction(IHttpNegotiate *ifac
if
(
!
size
)
return
S_OK
;
if
(
This
->
request
->
base_uri
)
{
IUri_GetRawUri
(
This
->
request
->
base_uri
,
&
base_uri
);
size
+=
SysStringLen
(
base_uri
)
*
sizeof
(
WCHAR
)
+
sizeof
(
refererW
)
+
sizeof
(
crlfW
);
}
buff
=
CoTaskMemAlloc
(
size
);
if
(
!
buff
)
return
E_OUTOFMEMORY
;
if
(
!
buff
)
{
SysFreeString
(
base_uri
);
return
E_OUTOFMEMORY
;
}
ptr
=
buff
;
if
(
This
->
request
->
use_utf8_content
)
...
...
@@ -486,6 +498,15 @@ static HRESULT WINAPI BSCHttpNegotiate_BeginningTransaction(IHttpNegotiate *ifac
ptr
+=
sizeof
(
content_type_utf8W
)
/
sizeof
(
WCHAR
)
-
1
;
}
if
(
base_uri
)
{
strcpyW
(
ptr
,
refererW
);
strcatW
(
ptr
,
base_uri
);
strcatW
(
ptr
,
crlfW
);
ptr
+=
strlenW
(
refererW
)
+
SysStringLen
(
base_uri
)
+
strlenW
(
crlfW
);
SysFreeString
(
base_uri
);
}
/* user headers */
LIST_FOR_EACH_ENTRY
(
entry
,
&
This
->
request
->
reqheaders
,
struct
httpheader
,
entry
)
{
...
...
@@ -1571,6 +1592,8 @@ static void get_base_uri(httprequest *This)
return
;
hr
=
IServiceProvider_QueryService
(
provider
,
&
SID_SContainerDispatch
,
&
IID_IHTMLDocument2
,
(
void
**
)
&
doc
);
if
(
FAILED
(
hr
))
hr
=
IServiceProvider_QueryService
(
provider
,
&
SID_SInternetHostSecurityManager
,
&
IID_IHTMLDocument2
,
(
void
**
)
&
doc
);
IServiceProvider_Release
(
provider
);
if
(
FAILED
(
hr
))
return
;
...
...
dlls/msxml3/tests/httpreq.c
View file @
13aac41b
...
...
@@ -51,6 +51,8 @@ static void _expect_ref(IUnknown* obj, ULONG ref, int line)
DEFINE_GUID
(
SID_SContainerDispatch
,
0xb722be00
,
0x4e68
,
0x101b
,
0xa2
,
0xbc
,
0x00
,
0xaa
,
0x00
,
0x40
,
0x47
,
0x70
);
DEFINE_GUID
(
SID_UnknownSID
,
0x75dd09cb
,
0x6c40
,
0x11d5
,
0x85
,
0x43
,
0x00
,
0xc0
,
0x4f
,
0xa0
,
0xfb
,
0xa3
);
static
BOOL
g_enablecallchecks
;
#define DEFINE_EXPECT(func) \
static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
...
...
@@ -59,7 +61,8 @@ DEFINE_GUID(SID_UnknownSID, 0x75dd09cb, 0x6c40, 0x11d5, 0x85, 0x43, 0x00, 0xc0,
#define CHECK_EXPECT2(func) \
do { \
ok(expect_ ##func, "unexpected call " #func "\n"); \
if (g_enablecallchecks) \
ok(expect_ ##func, "unexpected call " #func "\n"); \
called_ ## func = TRUE; \
}while(0)
...
...
@@ -1147,6 +1150,18 @@ static HRESULT WINAPI sp_QueryService(IServiceProvider *iface, REFGUID service,
{
/* FIXME: unidentified service id */
}
else
if
(
IsEqualGUID
(
service
,
&
IID_IInternetProtocol
)
&&
IsEqualGUID
(
riid
,
&
IID_IInternetProtocol
))
{
}
else
if
(
IsEqualGUID
(
service
,
&
IID_IHttpNegotiate2
)
&&
IsEqualGUID
(
riid
,
&
IID_IHttpNegotiate2
))
{
}
else
if
(
IsEqualGUID
(
service
,
&
IID_IGetBindHandle
)
&&
IsEqualGUID
(
riid
,
&
IID_IGetBindHandle
))
{
}
else
ok
(
0
,
"unexpected request: sid %s, riid %s
\n
"
,
debugstr_guid
(
service
),
debugstr_guid
(
riid
));
...
...
@@ -1365,6 +1380,8 @@ static void set_xhr_site(IXMLHttpRequest *xhr)
hr
=
IXMLHttpRequest_QueryInterface
(
xhr
,
&
IID_IObjectWithSite
,
(
void
**
)
&
obj_site
);
ok
(
hr
==
S_OK
,
"Could not get IObjectWithSite iface: %08x
\n
"
,
hr
);
g_enablecallchecks
=
TRUE
;
SET_EXPECT
(
site_qi_IServiceProvider
);
SET_EXPECT
(
sp_queryservice_SID_SBindHost
);
SET_EXPECT
(
sp_queryservice_SID_SContainerDispatch_htmldoc2
);
...
...
@@ -1387,20 +1404,24 @@ static void set_xhr_site(IXMLHttpRequest *xhr)
todo_wine
CHECK_CALLED
(
sp_queryservice_SID_SBindHost
);
CHECK_CALLED
(
sp_queryservice_SID_SContainerDispatch_htmldoc2
);
todo_wine
{
CHECK_CALLED
(
sp_queryservice_SID_secmgr_htmldoc2
);
todo_wine
CHECK_CALLED
(
sp_queryservice_SID_secmgr_xmldomdoc
);
/* this one isn't very reliable
CHECK_CALLED(sp_queryservice_SID_secmgr_secmgr); */
todo_wine
{
CHECK_CALLED
(
htmldoc2_get_all
);
CHECK_CALLED
(
collection_get_length
);
}
CHECK_CALLED
(
htmldoc2_get_url
);
todo_wine
{
CHECK_CALLED
(
site_qi_IXMLDOMDocument
);
CHECK_CALLED
(
site_qi_IOleClientSite
);
}
g_enablecallchecks
=
FALSE
;
IObjectWithSite_Release
(
obj_site
);
}
...
...
@@ -1423,8 +1444,10 @@ static void test_XMLHTTP(void)
static
const
char
bodyA
[]
=
"mode=Test"
;
static
const
char
urlA
[]
=
"http://crossover.codeweavers.com/posttest.php"
;
static
const
char
xmltestA
[]
=
"http://crossover.codeweavers.com/xmltest.xml"
;
static
const
char
referertesturl
[]
=
"http://test.winehq.org/tests/referer.php"
;
static
const
WCHAR
wszExpectedResponse
[]
=
{
'F'
,
'A'
,
'I'
,
'L'
,
'E'
,
'D'
,
0
};
static
const
CHAR
xmltestbodyA
[]
=
"<?xml version=
\"
1.0
\"
encoding=
\"
utf-8
\"
?>
\n
<a>TEST</a>
\n
"
;
static
const
WCHAR
norefererW
[]
=
{
'n'
,
'o'
,
' '
,
'r'
,
'e'
,
'f'
,
'e'
,
'r'
,
'e'
,
'r'
,
' '
,
's'
,
'e'
,
't'
,
0
};
IXMLHttpRequest
*
xhr
;
IObjectWithSite
*
obj_site
,
*
obj_site2
;
...
...
@@ -1686,6 +1709,17 @@ static void test_XMLHTTP(void)
IDispatch_Release
(
event
);
/* test if referrer header is sent */
test_open
(
xhr
,
"GET"
,
referertesturl
,
S_OK
);
V_VT
(
&
varbody
)
=
VT_EMPTY
;
hr
=
IXMLHttpRequest_send
(
xhr
,
varbody
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IXMLHttpRequest_get_responseText
(
xhr
,
&
str
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
str
,
norefererW
),
"got response text %s
\n
"
,
wine_dbgstr_w
(
str
));
SysFreeString
(
str
);
/* interaction with object site */
hr
=
IXMLHttpRequest_QueryInterface
(
xhr
,
&
IID_IObjectWithSite
,
(
void
**
)
&
obj_site
);
EXPECT_HR
(
hr
,
S_OK
);
...
...
@@ -1700,10 +1734,20 @@ static void test_XMLHTTP(void)
set_xhr_site
(
xhr
);
/* try to set site another time */
SET_EXPECT
(
site_qi_IServiceProvider
);
SET_EXPECT
(
sp_queryservice_SID_SContainerDispatch_htmldoc2
);
test_open
(
xhr
,
"GET"
,
"tests/referer.php"
,
S_OK
);
str1
=
a2bstr
(
"http://test.winehq.org/"
);
V_VT
(
&
varbody
)
=
VT_EMPTY
;
hr
=
IXMLHttpRequest_send
(
xhr
,
varbody
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IXMLHttpRequest_get_responseText
(
xhr
,
&
str
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
str
,
str1
),
"got response text %s, expected %s
\n
"
,
wine_dbgstr_w
(
str
),
wine_dbgstr_w
(
str1
));
SysFreeString
(
str
);
SysFreeString
(
str1
);
/* try to set site another time */
hr
=
IObjectWithSite_SetSite
(
obj_site
,
&
testsite
);
EXPECT_HR
(
hr
,
S_OK
);
...
...
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