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
2a85bc03
Commit
2a85bc03
authored
Sep 29, 2010
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 29, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3/httprequest: Store passed data for IXMLHttpRequest::open().
parent
6e4e8fb0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
15 deletions
+89
-15
httprequest.c
dlls/msxml3/httprequest.c
+66
-4
domdoc.c
dlls/msxml3/tests/domdoc.c
+23
-11
No files found.
dlls/msxml3/httprequest.c
View file @
2a85bc03
...
...
@@ -36,10 +36,22 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml);
#ifdef HAVE_LIBXML2
static
const
WCHAR
MethodGetW
[]
=
{
'G'
,
'E'
,
'T'
,
0
};
static
const
WCHAR
MethodPutW
[]
=
{
'P'
,
'U'
,
'T'
,
0
};
static
const
WCHAR
MethodPostW
[]
=
{
'P'
,
'O'
,
'S'
,
'T'
,
0
};
typedef
struct
_httprequest
{
const
struct
IXMLHTTPRequestVtbl
*
lpVtbl
;
LONG
ref
;
BINDVERB
verb
;
BSTR
url
;
BOOL
async
;
/* credentials */
BSTR
user
;
BSTR
password
;
}
httprequest
;
static
inline
httprequest
*
impl_from_IXMLHTTPRequest
(
IXMLHTTPRequest
*
iface
)
...
...
@@ -83,6 +95,9 @@ static ULONG WINAPI httprequest_Release(IXMLHTTPRequest *iface)
ref
=
InterlockedDecrement
(
&
This
->
ref
);
if
(
ref
==
0
)
{
SysFreeString
(
This
->
url
);
SysFreeString
(
This
->
user
);
SysFreeString
(
This
->
password
);
heap_free
(
This
);
}
...
...
@@ -158,14 +173,57 @@ static HRESULT WINAPI httprequest_Invoke(IXMLHTTPRequest *iface, DISPID dispIdMe
return
hr
;
}
static
HRESULT
WINAPI
httprequest_open
(
IXMLHTTPRequest
*
iface
,
BSTR
bstrMethod
,
BSTR
bstrU
rl
,
VARIANT
varAsync
,
VARIANT
bstrUser
,
VARIANT
bstrP
assword
)
static
HRESULT
WINAPI
httprequest_open
(
IXMLHTTPRequest
*
iface
,
BSTR
method
,
BSTR
u
rl
,
VARIANT
async
,
VARIANT
user
,
VARIANT
p
assword
)
{
httprequest
*
This
=
impl_from_IXMLHTTPRequest
(
iface
);
HRESULT
hr
;
VARIANT
str
;
FIXME
(
"stub (%p)
\n
"
,
This
);
TRACE
(
"(%p)->(%s %s)
\n
"
,
This
,
debugstr_w
(
method
),
debugstr_w
(
url
)
);
return
E_NOTIMPL
;
if
(
!
method
||
!
url
)
return
E_INVALIDARG
;
/* free previously set data */
SysFreeString
(
This
->
url
);
SysFreeString
(
This
->
user
);
SysFreeString
(
This
->
password
);
This
->
url
=
This
->
user
=
This
->
password
=
NULL
;
if
(
lstrcmpiW
(
method
,
MethodGetW
)
==
0
)
{
This
->
verb
=
BINDVERB_GET
;
}
else
if
(
lstrcmpiW
(
method
,
MethodPutW
)
==
0
)
{
This
->
verb
=
BINDVERB_PUT
;
}
else
if
(
lstrcmpiW
(
method
,
MethodPostW
)
==
0
)
{
This
->
verb
=
BINDVERB_POST
;
}
else
{
FIXME
(
"unsupported request type %s
\n
"
,
debugstr_w
(
method
));
This
->
verb
=
-
1
;
return
E_FAIL
;
}
This
->
url
=
SysAllocString
(
url
);
hr
=
VariantChangeType
(
&
async
,
&
async
,
0
,
VT_BOOL
);
This
->
async
=
hr
==
S_OK
&&
V_BOOL
(
&
async
)
==
VARIANT_TRUE
;
VariantInit
(
&
str
);
hr
=
VariantChangeType
(
&
str
,
&
user
,
0
,
VT_BSTR
);
if
(
hr
==
S_OK
)
This
->
user
=
V_BSTR
(
&
str
);
hr
=
VariantChangeType
(
&
str
,
&
password
,
0
,
VT_BSTR
);
if
(
hr
==
S_OK
)
This
->
password
=
V_BSTR
(
&
str
);
return
S_OK
;
}
static
HRESULT
WINAPI
httprequest_setRequestHeader
(
IXMLHTTPRequest
*
iface
,
BSTR
bstrHeader
,
BSTR
bstrValue
)
...
...
@@ -324,6 +382,10 @@ HRESULT XMLHTTPRequest_create(IUnknown *pUnkOuter, LPVOID *ppObj)
req
->
lpVtbl
=
&
dimimpl_vtbl
;
req
->
ref
=
1
;
req
->
async
=
FALSE
;
req
->
verb
=
-
1
;
req
->
url
=
req
->
user
=
req
->
password
=
NULL
;
*
ppObj
=
&
req
->
lpVtbl
;
TRACE
(
"returning iface %p
\n
"
,
*
ppObj
);
...
...
dlls/msxml3/tests/domdoc.c
View file @
2a85bc03
...
...
@@ -2883,9 +2883,9 @@ static void test_XMLHTTP(void)
'p'
,
'o'
,
's'
,
't'
,
't'
,
'e'
,
's'
,
't'
,
'.'
,
'p'
,
'h'
,
'p'
,
0
};
static
const
WCHAR
wszExpectedResponse
[]
=
{
'F'
,
'A'
,
'I'
,
'L'
,
'E'
,
'D'
,
0
};
IXMLHttpRequest
*
pXMLHttpRequest
;
BSTR
bstrResponse
,
str1
,
str2
;
BSTR
bstrResponse
,
method
,
url
;
VARIANT
dummy
;
VARIANT
varfalse
;
VARIANT
async
;
VARIANT
varbody
;
HRESULT
hr
=
CoCreateInstance
(
&
CLSID_XMLHTTPRequest
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IXMLHttpRequest
,
...
...
@@ -2899,18 +2899,30 @@ static void test_XMLHTTP(void)
VariantInit
(
&
dummy
);
V_VT
(
&
dummy
)
=
VT_ERROR
;
V_ERROR
(
&
dummy
)
=
DISP_E_MEMBERNOTFOUND
;
VariantInit
(
&
varfalse
);
V_VT
(
&
varfalse
)
=
VT_BOOL
;
V_BOOL
(
&
varfalse
)
=
VARIANT_FALSE
;
VariantInit
(
&
async
);
V_VT
(
&
async
)
=
VT_BOOL
;
V_BOOL
(
&
async
)
=
VARIANT_FALSE
;
V_VT
(
&
varbody
)
=
VT_BSTR
;
V_BSTR
(
&
varbody
)
=
SysAllocString
(
wszBody
);
str1
=
SysAllocString
(
wszPOST
);
str2
=
SysAllocString
(
wszUrl
);
hr
=
IXMLHttpRequest_open
(
pXMLHttpRequest
,
str1
,
str2
,
varfalse
,
dummy
,
dummy
);
todo_wine
ok
(
hr
==
S_OK
,
"IXMLHttpRequest_open should have succeeded instead of failing with 0x%08x
\n
"
,
hr
);
SysFreeString
(
str1
);
SysFreeString
(
str2
);
method
=
SysAllocString
(
wszPOST
);
url
=
SysAllocString
(
wszUrl
);
/* invalid parameters */
hr
=
IXMLHttpRequest_open
(
pXMLHttpRequest
,
NULL
,
NULL
,
async
,
dummy
,
dummy
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IXMLHttpRequest_open
(
pXMLHttpRequest
,
method
,
NULL
,
async
,
dummy
,
dummy
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IXMLHttpRequest_open
(
pXMLHttpRequest
,
NULL
,
url
,
async
,
dummy
,
dummy
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IXMLHttpRequest_open
(
pXMLHttpRequest
,
method
,
url
,
async
,
dummy
,
dummy
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
SysFreeString
(
method
);
SysFreeString
(
url
);
hr
=
IXMLHttpRequest_send
(
pXMLHttpRequest
,
varbody
);
if
(
hr
==
INET_E_RESOURCE_NOT_FOUND
)
...
...
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