urlmon: Correctly handle INET_E_USE_DEFAULT_SETTING returned from GetBindString(BINDIND_ACCEPT_MIMES).

This commit is contained in:
Jacek Caban 2010-09-08 14:56:08 +02:00 committed by Alexandre Julliard
parent f68333cb6b
commit ed2b72248f
2 changed files with 12 additions and 2 deletions

View File

@ -76,6 +76,7 @@ static HRESULT HttpProtocol_open_request(Protocol *prot, LPCWSTR url, DWORD requ
IHttpNegotiate2 *http_negotiate2 = NULL;
LPWSTR host, user, pass, path;
LPOLESTR accept_mimes[257];
const WCHAR **accept_types;
URL_COMPONENTSW url_comp;
BYTE security_id[512];
DWORD len = 0;
@ -113,7 +114,15 @@ static HRESULT HttpProtocol_open_request(Protocol *prot, LPCWSTR url, DWORD requ
num = sizeof(accept_mimes)/sizeof(accept_mimes[0])-1;
hres = IInternetBindInfo_GetBindString(bind_info, BINDSTRING_ACCEPT_MIMES, accept_mimes, num, &num);
if(hres != S_OK) {
if(hres == INET_E_USE_DEFAULT_SETTING) {
static const WCHAR default_accept_mimeW[] = {'*','/','*',0};
static const WCHAR *default_accept_mimes[] = {default_accept_mimeW, NULL};
accept_types = default_accept_mimes;
num = 0;
}else if(hres == S_OK) {
accept_types = (const WCHAR**)accept_mimes;
}else {
WARN("GetBindString BINDSTRING_ACCEPT_MIMES failed: %08x\n", hres);
return INET_E_NO_VALID_MEDIA;
}
@ -130,7 +139,7 @@ static HRESULT HttpProtocol_open_request(Protocol *prot, LPCWSTR url, DWORD requ
This->base.request = HttpOpenRequestW(This->base.connection,
This->base.bind_info.dwBindVerb < BINDVERB_CUSTOM
? wszBindVerb[This->base.bind_info.dwBindVerb] : This->base.bind_info.szCustomVerb,
path, NULL, NULL, (LPCWSTR *)accept_mimes, request_flags, (DWORD_PTR)&This->base);
path, NULL, NULL, accept_types, request_flags, (DWORD_PTR)&This->base);
heap_free(path);
while(num--)
CoTaskMemFree(accept_mimes[num]);

View File

@ -1897,6 +1897,7 @@ cpp_quote("#define INET_E_SECURITY_PROBLEM _HRESULT_TYPEDEF_(0x800C000E
cpp_quote("#define INET_E_CANNOT_LOAD_DATA _HRESULT_TYPEDEF_(0x800C000F)")
cpp_quote("#define INET_E_CANNOT_INSTANTIATE_OBJECT _HRESULT_TYPEDEF_(0x800C0010)")
cpp_quote("#define INET_E_USE_DEFAULT_PROTOCOLHANDLER _HRESULT_TYPEDEF_(0x800C0011)")
cpp_quote("#define INET_E_USE_DEFAULT_SETTING _HRESULT_TYPEDEF_(0x800C0012L)")
cpp_quote("#define INET_E_QUERYOPTION_UNKNOWN _HRESULT_TYPEDEF_(0x800C0013)")
cpp_quote("#define INET_E_REDIRECT_FAILED _HRESULT_TYPEDEF_(0x800C0014)")
cpp_quote("#define INET_E_REDIRECT_TO_DIR _HRESULT_TYPEDEF_(0x800C0015)")