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
2c8765e7
Commit
2c8765e7
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::GetResponseHeader.
parent
36389080
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
9 deletions
+60
-9
request.c
dlls/winhttp/request.c
+31
-9
winhttp.c
dlls/winhttp/tests/winhttp.c
+29
-0
No files found.
dlls/winhttp/request.c
View file @
2c8765e7
...
...
@@ -2515,15 +2515,6 @@ static HRESULT WINAPI winhttp_request_SetRequestHeader(
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
winhttp_request_GetResponseHeader
(
IWinHttpRequest
*
iface
,
BSTR
header
,
BSTR
*
value
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
DWORD
wait_for_completion
(
struct
winhttp_request
*
request
,
DWORD
timeout
)
{
HANDLE
handles
[
2
];
...
...
@@ -2591,6 +2582,37 @@ static DWORD request_wait_for_response( struct winhttp_request *request, DWORD t
return
wait_for_completion
(
request
,
timeout
);
}
static
HRESULT
WINAPI
winhttp_request_GetResponseHeader
(
IWinHttpRequest
*
iface
,
BSTR
header
,
BSTR
*
value
)
{
struct
winhttp_request
*
request
=
impl_from_IWinHttpRequest
(
iface
);
DWORD
err
,
size
;
TRACE
(
"%p, %p
\n
"
,
request
,
header
);
if
(
request
->
state
<
REQUEST_STATE_SENT
)
{
return
HRESULT_FROM_WIN32
(
ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND
);
}
if
(
!
header
||
!
value
)
return
E_INVALIDARG
;
if
((
err
=
request_wait_for_response
(
request
,
INFINITE
)))
return
HRESULT_FROM_WIN32
(
err
);
request
->
state
=
REQUEST_STATE_RESPONSE_RECEIVED
;
size
=
0
;
WinHttpQueryHeaders
(
request
->
hrequest
,
WINHTTP_QUERY_CUSTOM
,
header
,
NULL
,
&
size
,
NULL
);
err
=
get_last_error
();
if
(
err
!=
ERROR_INSUFFICIENT_BUFFER
)
return
HRESULT_FROM_WIN32
(
err
);
if
(
!
(
*
value
=
SysAllocStringLen
(
NULL
,
size
/
sizeof
(
WCHAR
)
)))
return
E_OUTOFMEMORY
;
if
(
!
WinHttpQueryHeaders
(
request
->
hrequest
,
WINHTTP_QUERY_CUSTOM
,
header
,
*
value
,
&
size
,
NULL
))
{
SysFreeString
(
*
value
);
return
HRESULT_FROM_WIN32
(
get_last_error
()
);
}
return
S_OK
;
}
static
HRESULT
WINAPI
winhttp_request_GetAllResponseHeaders
(
IWinHttpRequest
*
iface
,
BSTR
*
headers
)
...
...
dlls/winhttp/tests/winhttp.c
View file @
2c8765e7
...
...
@@ -2112,9 +2112,11 @@ static void test_IWinHttpRequest(void)
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
};
static
const
WCHAR
connectionW
[]
=
{
'C'
,
'o'
,
'n'
,
'n'
,
'e'
,
'c'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
HRESULT
hr
;
IWinHttpRequest
*
req
;
BSTR
method
,
url
,
username
,
password
,
response
=
NULL
,
status_text
=
NULL
,
headers
=
NULL
;
BSTR
connection
,
value
=
NULL
;
VARIANT
async
,
empty
,
timeout
,
body
,
proxy_server
,
bypass_list
;
VARIANT_BOOL
succeeded
;
LONG
status
;
...
...
@@ -2236,6 +2238,16 @@ static void test_IWinHttpRequest(void)
hr
=
IWinHttpRequest_GetAllResponseHeaders
(
req
,
&
headers
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND
),
"got %08x
\n
"
,
hr
);
hr
=
IWinHttpRequest_GetResponseHeader
(
req
,
NULL
,
NULL
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND
),
"got %08x
\n
"
,
hr
);
connection
=
SysAllocString
(
connectionW
);
hr
=
IWinHttpRequest_GetResponseHeader
(
req
,
connection
,
NULL
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND
),
"got %08x
\n
"
,
hr
);
hr
=
IWinHttpRequest_GetResponseHeader
(
req
,
connection
,
&
value
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND
),
"got %08x
\n
"
,
hr
);
SysFreeString
(
method
);
method
=
SysAllocString
(
method1W
);
SysFreeString
(
url
);
...
...
@@ -2297,6 +2309,9 @@ static void test_IWinHttpRequest(void)
hr
=
IWinHttpRequest_GetAllResponseHeaders
(
req
,
&
headers
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND
),
"got %08x
\n
"
,
hr
);
hr
=
IWinHttpRequest_GetResponseHeader
(
req
,
connection
,
&
value
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND
),
"got %08x
\n
"
,
hr
);
hr
=
IWinHttpRequest_Send
(
req
,
empty
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
@@ -2345,6 +2360,16 @@ static void test_IWinHttpRequest(void)
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
SysFreeString
(
headers
);
hr
=
IWinHttpRequest_GetResponseHeader
(
req
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
IWinHttpRequest_GetResponseHeader
(
req
,
connection
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got %08x
\n
"
,
hr
);
hr
=
IWinHttpRequest_GetResponseHeader
(
req
,
connection
,
&
value
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
SysFreeString
(
value
);
VariantInit
(
&
timeout
);
V_VT
(
&
timeout
)
=
VT_I4
;
V_I4
(
&
timeout
)
=
10
;
...
...
@@ -2399,6 +2424,10 @@ static void test_IWinHttpRequest(void)
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
SysFreeString
(
headers
);
hr
=
IWinHttpRequest_GetResponseHeader
(
req
,
connection
,
&
value
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
SysFreeString
(
value
);
hr
=
IWinHttpRequest_Send
(
req
,
empty
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
...
...
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