Commit 216ad43f authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

urlmon: Use HttpQueryInfoA in IWinInetHttpInfo::QueryInfo implementation.

parent a067ceb5
......@@ -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;
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment