From: Yuxuan Shui yshui@codeweavers.com
If DISABLEAUTOREDIRECTS is set in BINDINFO options, urlmon does not set HTTP verb to GET when handling redirections.
Although HTTP specification is vague on the correct behaviour here, many web servers expect this. This is what's causing the "400 Bad Request" error when user tries to log into GMail accounts using Outlook. --- dlls/urlmon/bindprot.c | 14 ++++++++++++++ dlls/urlmon/urlmon_main.h | 1 + 2 files changed, 15 insertions(+)
diff --git a/dlls/urlmon/bindprot.c b/dlls/urlmon/bindprot.c index ec52ac5e999..c2eb47adf7d 100644 --- a/dlls/urlmon/bindprot.c +++ b/dlls/urlmon/bindprot.c @@ -18,6 +18,7 @@
#include "urlmon_main.h" #include "wine/debug.h" +#include "wininet.h"
WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
@@ -1016,6 +1017,7 @@ static HRESULT WINAPI ProtocolSinkHandler_ReportData(IInternetProtocolSink *ifac static HRESULT handle_redirect(BindProtocol *This, const WCHAR *url) { HRESULT hres; + IWinInetHttpInfo *http_info = NULL;
if(This->redirect_callback) { VARIANT_BOOL cancel = VARIANT_FALSE; @@ -1030,6 +1032,15 @@ static HRESULT handle_redirect(BindProtocol *This, const WCHAR *url) return hres; }
+ if (This->protocol_unk && IUnknown_QueryInterface(This->protocol_unk, &IID_IWinInetHttpInfo, (void **)&http_info) == S_OK) { + DWORD status_code = 0, size = sizeof(DWORD); + hres = IWinInetHttpInfo_QueryInfo(http_info, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, + &status_code, &size, NULL, NULL); + if (hres == S_OK && status_code != HTTP_STATUS_REDIRECT_KEEP_VERB) + This->redirect_override_verb = TRUE; + IWinInetHttpInfo_Release(http_info); + } + IInternetProtocol_Terminate(This->protocol, 0); /* should this be done in StartEx? */ release_protocol_handler(This);
@@ -1103,6 +1114,9 @@ static HRESULT WINAPI BindInfo_GetBindInfo(IInternetBindInfo *iface, return hres; }
+ if (This->redirect_override_verb) + pbindinfo->dwBindVerb = BINDVERB_GET; + if((pbindinfo->dwOptions & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS) && !This->redirect_callback) { IServiceProvider *service_provider;
diff --git a/dlls/urlmon/urlmon_main.h b/dlls/urlmon/urlmon_main.h index 81b0d629f53..c2e3ffe7057 100644 --- a/dlls/urlmon/urlmon_main.h +++ b/dlls/urlmon/urlmon_main.h @@ -192,6 +192,7 @@ typedef struct {
BOOL reported_result; BOOL reported_mime; + BOOL redirect_override_verb; DWORD pi;
DWORD bscf;