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
b218ed1a
Commit
b218ed1a
authored
Jul 23, 2011
by
Hans Leidekker
Committed by
Alexandre Julliard
Jul 24, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Implement IWinHttpRequest::SetCredentials.
parent
a25c865c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
3 deletions
+50
-3
request.c
dlls/winhttp/request.c
+22
-2
winhttp.c
dlls/winhttp/tests/winhttp.c
+28
-1
No files found.
dlls/winhttp/request.c
View file @
b218ed1a
...
@@ -2361,8 +2361,28 @@ static HRESULT WINAPI winhttp_request_SetCredentials(
...
@@ -2361,8 +2361,28 @@ static HRESULT WINAPI winhttp_request_SetCredentials(
BSTR
password
,
BSTR
password
,
HTTPREQUEST_SETCREDENTIALS_FLAGS
flags
)
HTTPREQUEST_SETCREDENTIALS_FLAGS
flags
)
{
{
FIXME
(
"
\n
"
);
struct
winhttp_request
*
request
=
impl_from_IWinHttpRequest
(
iface
);
return
E_NOTIMPL
;
DWORD
target
,
scheme
=
WINHTTP_AUTH_SCHEME_BASIC
;
/* FIXME: query supported schemes */
TRACE
(
"%p, %s, %p
\n
"
,
request
,
debugstr_w
(
username
),
password
);
if
(
request
->
state
<
REQUEST_STATE_OPEN
)
{
return
HRESULT_FROM_WIN32
(
ERROR_WINHTTP_CANNOT_CALL_BEFORE_OPEN
);
}
switch
(
flags
)
{
case
HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
:
target
=
WINHTTP_AUTH_TARGET_SERVER
;
break
;
case
HTTPREQUEST_SETCREDENTIALS_FOR_PROXY
:
target
=
WINHTTP_AUTH_TARGET_PROXY
;
break
;
default:
return
E_INVALIDARG
;
}
if
(
WinHttpSetCredentials
(
request
->
hrequest
,
target
,
scheme
,
username
,
password
,
NULL
))
return
S_OK
;
return
HRESULT_FROM_WIN32
(
GetLastError
()
);
}
}
static
HRESULT
WINAPI
winhttp_request_Open
(
static
HRESULT
WINAPI
winhttp_request_Open
(
...
...
dlls/winhttp/tests/winhttp.c
View file @
b218ed1a
...
@@ -2100,13 +2100,15 @@ static void test_credentials(void)
...
@@ -2100,13 +2100,15 @@ static void test_credentials(void)
static
void
test_IWinHttpRequest
(
void
)
static
void
test_IWinHttpRequest
(
void
)
{
{
static
const
WCHAR
usernameW
[]
=
{
'u'
,
's'
,
'e'
,
'r'
,
'n'
,
'a'
,
'm'
,
'e'
,
0
};
static
const
WCHAR
passwordW
[]
=
{
'p'
,
'a'
,
's'
,
's'
,
'w'
,
'o'
,
'r'
,
'd'
,
0
};
static
const
WCHAR
url1W
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'w'
,
'i'
,
'n'
,
'e'
,
'h'
,
'q'
,
'.'
,
'o'
,
'r'
,
'g'
,
0
};
static
const
WCHAR
url1W
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
'w'
,
'i'
,
'n'
,
'e'
,
'h'
,
'q'
,
'.'
,
'o'
,
'r'
,
'g'
,
0
};
static
const
WCHAR
url2W
[]
=
{
'w'
,
'i'
,
'n'
,
'e'
,
'h'
,
'q'
,
'.'
,
'o'
,
'r'
,
'g'
,
0
};
static
const
WCHAR
url2W
[]
=
{
'w'
,
'i'
,
'n'
,
'e'
,
'h'
,
'q'
,
'.'
,
'o'
,
'r'
,
'g'
,
0
};
static
const
WCHAR
method1W
[]
=
{
'G'
,
'E'
,
'T'
,
0
};
static
const
WCHAR
method1W
[]
=
{
'G'
,
'E'
,
'T'
,
0
};
static
const
WCHAR
method2W
[]
=
{
'I'
,
'N'
,
'V'
,
'A'
,
'L'
,
'I'
,
'D'
,
0
};
static
const
WCHAR
method2W
[]
=
{
'I'
,
'N'
,
'V'
,
'A'
,
'L'
,
'I'
,
'D'
,
0
};
HRESULT
hr
;
HRESULT
hr
;
IWinHttpRequest
*
req
;
IWinHttpRequest
*
req
;
BSTR
method
,
url
,
response
=
NULL
,
status_text
=
NULL
;
BSTR
method
,
url
,
username
,
password
,
response
=
NULL
,
status_text
=
NULL
;
VARIANT
async
,
empty
,
timeout
,
body
;
VARIANT
async
,
empty
,
timeout
,
body
;
VARIANT_BOOL
succeeded
;
VARIANT_BOOL
succeeded
;
LONG
status
;
LONG
status
;
...
@@ -2189,6 +2191,9 @@ static void test_IWinHttpRequest(void)
...
@@ -2189,6 +2191,9 @@ static void test_IWinHttpRequest(void)
hr
=
IWinHttpRequest_SetTimeouts
(
req
,
10000
,
10000
,
10000
,
10000
);
hr
=
IWinHttpRequest_SetTimeouts
(
req
,
10000
,
10000
,
10000
,
10000
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
IWinHttpRequest_SetCredentials
(
req
,
NULL
,
NULL
,
0xdeadbeef
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_WINHTTP_CANNOT_CALL_BEFORE_OPEN
),
"got %08x
\n
"
,
hr
);
SysFreeString
(
method
);
SysFreeString
(
method
);
method
=
SysAllocString
(
method1W
);
method
=
SysAllocString
(
method1W
);
SysFreeString
(
url
);
SysFreeString
(
url
);
...
@@ -2205,6 +2210,20 @@ static void test_IWinHttpRequest(void)
...
@@ -2205,6 +2210,20 @@ static void test_IWinHttpRequest(void)
hr
=
IWinHttpRequest_SetTimeouts
(
req
,
10000
,
10000
,
10000
,
10000
);
hr
=
IWinHttpRequest_SetTimeouts
(
req
,
10000
,
10000
,
10000
,
10000
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
IWinHttpRequest_SetCredentials
(
req
,
NULL
,
NULL
,
0xdeadbeef
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
username
=
SysAllocString
(
usernameW
);
hr
=
IWinHttpRequest_SetCredentials
(
req
,
username
,
NULL
,
0xdeadbeef
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
password
=
SysAllocString
(
passwordW
);
hr
=
IWinHttpRequest_SetCredentials
(
req
,
username
,
password
,
0xdeadbeef
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
IWinHttpRequest_SetCredentials
(
req
,
username
,
password
,
HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
IWinHttpRequest_Send
(
req
,
empty
);
hr
=
IWinHttpRequest_Send
(
req
,
empty
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
@@ -2221,6 +2240,9 @@ static void test_IWinHttpRequest(void)
...
@@ -2221,6 +2240,9 @@ static void test_IWinHttpRequest(void)
trace
(
"%s
\n
"
,
wine_dbgstr_w
(
status_text
));
trace
(
"%s
\n
"
,
wine_dbgstr_w
(
status_text
));
SysFreeString
(
status_text
);
SysFreeString
(
status_text
);
hr
=
IWinHttpRequest_SetCredentials
(
req
,
username
,
password
,
HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
VariantInit
(
&
timeout
);
VariantInit
(
&
timeout
);
V_VT
(
&
timeout
)
=
VT_I4
;
V_VT
(
&
timeout
)
=
VT_I4
;
V_I4
(
&
timeout
)
=
10
;
V_I4
(
&
timeout
)
=
10
;
...
@@ -2234,6 +2256,9 @@ static void test_IWinHttpRequest(void)
...
@@ -2234,6 +2256,9 @@ static void test_IWinHttpRequest(void)
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
SysFreeString
(
status_text
);
SysFreeString
(
status_text
);
hr
=
IWinHttpRequest_SetCredentials
(
req
,
username
,
password
,
HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
IWinHttpRequest_Send
(
req
,
empty
);
hr
=
IWinHttpRequest_Send
(
req
,
empty
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
@@ -2264,6 +2289,8 @@ static void test_IWinHttpRequest(void)
...
@@ -2264,6 +2289,8 @@ static void test_IWinHttpRequest(void)
SysFreeString
(
method
);
SysFreeString
(
method
);
SysFreeString
(
url
);
SysFreeString
(
url
);
SysFreeString
(
username
);
SysFreeString
(
password
);
CoUninitialize
();
CoUninitialize
();
}
}
...
...
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