[2/3] winhttp: Implement IWinHttpRequest::get_ResponseBody.
Hans Leidekker
hans at codeweavers.com
Fri Jul 22 09:00:44 CDT 2011
---
dlls/winhttp/request.c | 13 +++++++++++--
dlls/winhttp/tests/winhttp.c | 9 ++++++++-
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index 0c4c726..a73be22 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -2747,8 +2747,17 @@ static HRESULT WINAPI winhttp_request_get_ResponseBody(
IWinHttpRequest *iface,
VARIANT *body )
{
- FIXME("\n");
- return E_NOTIMPL;
+ struct winhttp_request *request = impl_from_IWinHttpRequest( iface );
+ DWORD err;
+
+ TRACE("%p, %p\n", request, body);
+
+ if ((err = request_read_body( request, INFINITE ))) return HRESULT_FROM_WIN32( err );
+
+ VariantInit( body );
+ V_VT( body ) = VT_ARRAY|VT_UI1;
+ V_ARRAY( body ) = request->buffer;
+ return S_OK;
}
static HRESULT WINAPI winhttp_request_get_ResponseStream(
diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c
index 8f2af5a..7dfd1cb 100644
--- a/dlls/winhttp/tests/winhttp.c
+++ b/dlls/winhttp/tests/winhttp.c
@@ -2107,7 +2107,7 @@ static void test_IWinHttpRequest(void)
HRESULT hr;
IWinHttpRequest *req;
BSTR method, url, response = NULL, status_text = NULL;
- VARIANT async, empty, timeout;
+ VARIANT async, empty, timeout, body;
VARIANT_BOOL succeeded;
LONG status;
@@ -2241,6 +2241,13 @@ static void test_IWinHttpRequest(void)
ok( hr == S_OK, "got %08x\n", hr );
SysFreeString( response );
+ VariantInit( &body );
+ V_VT( &body ) = VT_ERROR;
+ hr = IWinHttpRequest_get_ResponseBody( req, &body );
+ ok( hr == S_OK, "got %08x\n", hr );
+ ok( V_VT( &body ) == (VT_ARRAY|VT_UI1), "got %08x\n", V_VT( &body ) );
+
+ ok( hr == S_OK, "got %08x\n", hr );
hr = IWinHttpRequest_Send( req, empty );
ok( hr == S_OK, "got %08x\n", hr );
--
1.7.4.1
More information about the wine-patches
mailing list