Jacek Caban : urlmon: Use HttpQueryInfoA in IWinInetHttpInfo:: QueryInfo implementation.
Alexandre Julliard
julliard at winehq.org
Mon Feb 26 13:42:21 CST 2018
Module: wine
Branch: master
Commit: 216ad43f18fdf08b1c76758120c6bedbdf7043c2
URL: https://source.winehq.org/git/wine.git/?a=commit;h=216ad43f18fdf08b1c76758120c6bedbdf7043c2
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Feb 26 18:21:02 2018 +0100
urlmon: Use HttpQueryInfoA in IWinInetHttpInfo::QueryInfo implementation.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/urlmon/http.c | 8 +++----
dlls/urlmon/tests/protocol.c | 51 +++++++++++++++++++++++++++++++-------------
2 files changed, 39 insertions(+), 20 deletions(-)
diff --git a/dlls/urlmon/http.c b/dlls/urlmon/http.c
index 2fd9be6..9cc6117 100644
--- a/dlls/urlmon/http.c
+++ b/dlls/urlmon/http.c
@@ -912,11 +912,9 @@ static HRESULT WINAPI HttpInfo_QueryInfo(IWinInetHttpInfo *iface, DWORD dwOption
if(!This->base.request)
return E_FAIL;
- if(!HttpQueryInfoW(This->base.request, dwOption, pBuffer, pcbBuffer, pdwFlags)) {
- if(pBuffer)
- memset(pBuffer, 0, *pcbBuffer);
- return S_OK;
- }
+ if(!HttpQueryInfoA(This->base.request, dwOption, pBuffer, pcbBuffer, pdwFlags))
+ return S_FALSE;
+
return S_OK;
}
diff --git a/dlls/urlmon/tests/protocol.c b/dlls/urlmon/tests/protocol.c
index d88aa07..4ca4327 100644
--- a/dlls/urlmon/tests/protocol.c
+++ b/dlls/urlmon/tests/protocol.c
@@ -940,6 +940,39 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface,
return S_OK;
}
+static void test_http_info(IInternetProtocol *protocol)
+{
+ IWinInetHttpInfo *info;
+ char buf[1024];
+ DWORD size, len;
+ HRESULT hres;
+
+ static const WCHAR connectionW[] = {'c','o','n','n','e','c','t','i','o','n',0};
+
+ hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetHttpInfo, (void**)&info);
+ ok(hres == S_OK, "Could not get IWinInterHttpInfo iface: %08x\n", hres);
+
+ size = sizeof(buf);
+ strcpy(buf, "connection");
+ hres = IWinInetHttpInfo_QueryInfo(info, HTTP_QUERY_CUSTOM, buf, &size, NULL, NULL);
+ if(tested_protocol != FTP_TEST) {
+ ok(hres == S_OK, "QueryInfo failed: %08x\n", hres);
+
+ ok(!strcmp(buf, "Keep-Alive"), "buf = %s\n", buf);
+ len = strlen(buf);
+ ok(size == len, "size = %u, expected %u\n", size, len);
+
+ size = sizeof(buf);
+ memcpy(buf, connectionW, sizeof(connectionW));
+ hres = IWinInetHttpInfo_QueryInfo(info, HTTP_QUERY_CUSTOM, buf, &size, NULL, NULL);
+ ok(hres == S_FALSE, "QueryInfo returned %08x\n", hres);
+ }else {
+ ok(hres == S_FALSE, "QueryInfo failed: %08x\n", hres);
+ }
+
+ IWinInetHttpInfo_Release(info);
+}
+
static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWORD grfBSCF,
ULONG ulProgress, ULONG ulProgressMax)
{
@@ -1071,6 +1104,9 @@ static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWOR
"grcfBSCF = %08x\n", grfBSCF);
}
+ if((grfBSCF & BSCF_FIRSTDATANOTIFICATION) && !binding_test)
+ test_http_info(async_protocol);
+
if(!(bindf & BINDF_FROMURLMON) &&
!(grfBSCF & BSCF_LASTDATANOTIFICATION)) {
if(state == STATE_CONNECTING) {
@@ -3129,19 +3165,6 @@ static void test_protocol_terminate(IInternetProtocol *protocol)
ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
}
-static void test_http_info(IInternetProtocol *protocol)
-{
- IWinInetHttpInfo *info;
- HRESULT hres;
-
- hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetHttpInfo, (void**)&info);
- ok(hres == S_OK, "Could not get IWinInterHttpInfo iface: %08x\n", hres);
-
- /* TODO */
-
- IWinInetHttpInfo_Release(info);
-}
-
/* is_first refers to whether this is the first call to this function
* _for this url_ */
static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tymed)
@@ -3183,7 +3206,6 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tym
ULONG ref;
test_priority(async_protocol);
- test_http_info(async_protocol);
SET_EXPECT(ReportProgress_COOKIE_SENT);
if(http_is_first) {
@@ -3452,7 +3474,6 @@ static void test_ftp_protocol(void)
ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
test_priority(async_protocol);
- test_http_info(async_protocol);
SET_EXPECT(GetBindInfo);
SET_EXPECT(ReportProgress_FINDINGRESOURCE);
More information about the wine-cvs
mailing list