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
9237479d
Commit
9237479d
authored
Jul 26, 2011
by
Hans Leidekker
Committed by
Alexandre Julliard
Jul 26, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Implement IWinHttpRequest::SetProxy.
parent
24eaf193
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
3 deletions
+85
-3
request.c
dlls/winhttp/request.c
+36
-2
winhttp.c
dlls/winhttp/tests/winhttp.c
+49
-1
No files found.
dlls/winhttp/request.c
View file @
9237479d
...
@@ -2168,6 +2168,7 @@ struct winhttp_request
...
@@ -2168,6 +2168,7 @@ struct winhttp_request
LONG
connect_timeout
;
LONG
connect_timeout
;
LONG
send_timeout
;
LONG
send_timeout
;
LONG
receive_timeout
;
LONG
receive_timeout
;
WINHTTP_PROXY_INFO
proxy
;
};
};
static
inline
struct
winhttp_request
*
impl_from_IWinHttpRequest
(
IWinHttpRequest
*
iface
)
static
inline
struct
winhttp_request
*
impl_from_IWinHttpRequest
(
IWinHttpRequest
*
iface
)
...
@@ -2355,8 +2356,34 @@ static HRESULT WINAPI winhttp_request_SetProxy(
...
@@ -2355,8 +2356,34 @@ static HRESULT WINAPI winhttp_request_SetProxy(
VARIANT
proxy_server
,
VARIANT
proxy_server
,
VARIANT
bypass_list
)
VARIANT
bypass_list
)
{
{
FIXME
(
"
\n
"
);
struct
winhttp_request
*
request
=
impl_from_IWinHttpRequest
(
iface
);
return
E_NOTIMPL
;
TRACE
(
"%p, %u, %s, %s
\n
"
,
request
,
proxy_setting
,
debugstr_variant
(
&
proxy_server
),
debugstr_variant
(
&
bypass_list
));
switch
(
proxy_setting
)
{
case
HTTPREQUEST_PROXYSETTING_DEFAULT
:
request
->
proxy
.
dwAccessType
=
WINHTTP_ACCESS_TYPE_DEFAULT_PROXY
;
request
->
proxy
.
lpszProxy
=
NULL
;
request
->
proxy
.
lpszProxyBypass
=
NULL
;
break
;
case
HTTPREQUEST_PROXYSETTING_DIRECT
:
request
->
proxy
.
dwAccessType
=
WINHTTP_ACCESS_TYPE_NO_PROXY
;
request
->
proxy
.
lpszProxy
=
NULL
;
request
->
proxy
.
lpszProxyBypass
=
NULL
;
break
;
case
HTTPREQUEST_PROXYSETTING_PROXY
:
request
->
proxy
.
dwAccessType
=
WINHTTP_ACCESS_TYPE_NAMED_PROXY
;
request
->
proxy
.
lpszProxy
=
V_BSTR
(
&
proxy_server
);
request
->
proxy
.
lpszProxyBypass
=
V_BSTR
(
&
bypass_list
);
break
;
default:
return
E_INVALIDARG
;
}
return
S_OK
;
}
}
static
HRESULT
WINAPI
winhttp_request_SetCredentials
(
static
HRESULT
WINAPI
winhttp_request_SetCredentials
(
...
@@ -2557,6 +2584,10 @@ static HRESULT WINAPI winhttp_request_Send(
...
@@ -2557,6 +2584,10 @@ static HRESULT WINAPI winhttp_request_Send(
}
}
if
(
request
->
state
>=
REQUEST_STATE_SENT
)
return
ERROR_SUCCESS
;
if
(
request
->
state
>=
REQUEST_STATE_SENT
)
return
ERROR_SUCCESS
;
if
(
!
WinHttpSetOption
(
request
->
hrequest
,
WINHTTP_OPTION_PROXY
,
&
request
->
proxy
,
sizeof
(
request
->
proxy
)
))
{
return
HRESULT_FROM_WIN32
(
get_last_error
()
);
}
if
(
!
WinHttpSetTimeouts
(
request
->
hrequest
,
if
(
!
WinHttpSetTimeouts
(
request
->
hrequest
,
request
->
resolve_timeout
,
request
->
resolve_timeout
,
request
->
connect_timeout
,
request
->
connect_timeout
,
...
@@ -2855,6 +2886,9 @@ static HRESULT WINAPI winhttp_request_Abort(
...
@@ -2855,6 +2886,9 @@ static HRESULT WINAPI winhttp_request_Abort(
request
->
bytes_available
=
0
;
request
->
bytes_available
=
0
;
request
->
bytes_read
=
0
;
request
->
bytes_read
=
0
;
request
->
error
=
ERROR_SUCCESS
;
request
->
error
=
ERROR_SUCCESS
;
request
->
proxy
.
dwAccessType
=
WINHTTP_ACCESS_TYPE_DEFAULT_PROXY
;
request
->
proxy
.
lpszProxy
=
NULL
;
request
->
proxy
.
lpszProxyBypass
=
NULL
;
return
S_OK
;
return
S_OK
;
}
}
...
...
dlls/winhttp/tests/winhttp.c
View file @
9237479d
...
@@ -2110,10 +2110,12 @@ static void test_IWinHttpRequest(void)
...
@@ -2110,10 +2110,12 @@ static void test_IWinHttpRequest(void)
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
};
static
const
WCHAR
proxy_serverW
[]
=
{
'p'
,
'r'
,
'o'
,
'x'
,
'y'
,
's'
,
'e'
,
'r'
,
'v'
,
'e'
,
'r'
,
0
};
static
const
WCHAR
bypas_listW
[]
=
{
'b'
,
'y'
,
'p'
,
'a'
,
's'
,
's'
,
'l'
,
'i'
,
's'
,
't'
,
0
};
HRESULT
hr
;
HRESULT
hr
;
IWinHttpRequest
*
req
;
IWinHttpRequest
*
req
;
BSTR
method
,
url
,
username
,
password
,
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
,
proxy_server
,
bypass_list
;
VARIANT_BOOL
succeeded
;
VARIANT_BOOL
succeeded
;
LONG
status
;
LONG
status
;
...
@@ -2198,6 +2200,19 @@ static void test_IWinHttpRequest(void)
...
@@ -2198,6 +2200,19 @@ static void test_IWinHttpRequest(void)
hr
=
IWinHttpRequest_SetCredentials
(
req
,
NULL
,
NULL
,
0xdeadbeef
);
hr
=
IWinHttpRequest_SetCredentials
(
req
,
NULL
,
NULL
,
0xdeadbeef
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_WINHTTP_CANNOT_CALL_BEFORE_OPEN
),
"got %08x
\n
"
,
hr
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_WINHTTP_CANNOT_CALL_BEFORE_OPEN
),
"got %08x
\n
"
,
hr
);
VariantInit
(
&
proxy_server
);
V_VT
(
&
proxy_server
)
=
VT_ERROR
;
VariantInit
(
&
bypass_list
);
V_VT
(
&
bypass_list
)
=
VT_ERROR
;
hr
=
IWinHttpRequest_SetProxy
(
req
,
HTTPREQUEST_PROXYSETTING_DIRECT
,
proxy_server
,
bypass_list
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
IWinHttpRequest_SetProxy
(
req
,
HTTPREQUEST_PROXYSETTING_PROXY
,
proxy_server
,
bypass_list
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
IWinHttpRequest_SetProxy
(
req
,
HTTPREQUEST_PROXYSETTING_DIRECT
,
proxy_server
,
bypass_list
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
SysFreeString
(
method
);
SysFreeString
(
method
);
method
=
SysAllocString
(
method1W
);
method
=
SysAllocString
(
method1W
);
SysFreeString
(
url
);
SysFreeString
(
url
);
...
@@ -2228,6 +2243,19 @@ static void test_IWinHttpRequest(void)
...
@@ -2228,6 +2243,19 @@ static void test_IWinHttpRequest(void)
hr
=
IWinHttpRequest_SetCredentials
(
req
,
username
,
password
,
HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
);
hr
=
IWinHttpRequest_SetCredentials
(
req
,
username
,
password
,
HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
V_VT
(
&
proxy_server
)
=
VT_BSTR
;
V_BSTR
(
&
proxy_server
)
=
SysAllocString
(
proxy_serverW
);
V_VT
(
&
bypass_list
)
=
VT_BSTR
;
V_BSTR
(
&
bypass_list
)
=
SysAllocString
(
bypas_listW
);
hr
=
IWinHttpRequest_SetProxy
(
req
,
HTTPREQUEST_PROXYSETTING_PROXY
,
proxy_server
,
bypass_list
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
IWinHttpRequest_SetProxy
(
req
,
0xdeadbeef
,
proxy_server
,
bypass_list
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
IWinHttpRequest_SetProxy
(
req
,
HTTPREQUEST_PROXYSETTING_DIRECT
,
proxy_server
,
bypass_list
);
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
);
...
@@ -2247,6 +2275,12 @@ static void test_IWinHttpRequest(void)
...
@@ -2247,6 +2275,12 @@ static void test_IWinHttpRequest(void)
hr
=
IWinHttpRequest_SetCredentials
(
req
,
username
,
password
,
HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
);
hr
=
IWinHttpRequest_SetCredentials
(
req
,
username
,
password
,
HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
IWinHttpRequest_SetProxy
(
req
,
HTTPREQUEST_PROXYSETTING_PROXY
,
proxy_server
,
bypass_list
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
IWinHttpRequest_SetProxy
(
req
,
HTTPREQUEST_PROXYSETTING_DIRECT
,
proxy_server
,
bypass_list
);
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
;
...
@@ -2263,6 +2297,12 @@ static void test_IWinHttpRequest(void)
...
@@ -2263,6 +2297,12 @@ static void test_IWinHttpRequest(void)
hr
=
IWinHttpRequest_SetCredentials
(
req
,
username
,
password
,
HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
);
hr
=
IWinHttpRequest_SetCredentials
(
req
,
username
,
password
,
HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
IWinHttpRequest_SetProxy
(
req
,
HTTPREQUEST_PROXYSETTING_PROXY
,
proxy_server
,
bypass_list
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
IWinHttpRequest_SetProxy
(
req
,
HTTPREQUEST_PROXYSETTING_DIRECT
,
proxy_server
,
bypass_list
);
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
);
...
@@ -2279,6 +2319,12 @@ static void test_IWinHttpRequest(void)
...
@@ -2279,6 +2319,12 @@ static void test_IWinHttpRequest(void)
hr
=
VariantClear
(
&
body
);
hr
=
VariantClear
(
&
body
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
IWinHttpRequest_SetProxy
(
req
,
HTTPREQUEST_PROXYSETTING_PROXY
,
proxy_server
,
bypass_list
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
IWinHttpRequest_SetProxy
(
req
,
HTTPREQUEST_PROXYSETTING_DIRECT
,
proxy_server
,
bypass_list
);
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
);
...
@@ -2295,6 +2341,8 @@ static void test_IWinHttpRequest(void)
...
@@ -2295,6 +2341,8 @@ static void test_IWinHttpRequest(void)
SysFreeString
(
url
);
SysFreeString
(
url
);
SysFreeString
(
username
);
SysFreeString
(
username
);
SysFreeString
(
password
);
SysFreeString
(
password
);
VariantClear
(
&
proxy_server
);
VariantClear
(
&
bypass_list
);
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