urlmon: Pass unescaped URLs to InternetOpenUrl in ftp protocol handler.

Based on a patch by André Hentschel.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=26445
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit d99605d714)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
oldstable
Alistair Leslie-Hughes 2019-03-26 15:21:32 +01:00 committed by Michael Stefaniuc
parent 0dd77b7c07
commit 6a5ecfedbc
3 changed files with 22 additions and 11 deletions

View File

@ -66,6 +66,7 @@ static HRESULT FtpProtocol_open_request(Protocol *prot, IUri *uri, DWORD request
HINTERNET internet_session, IInternetBindInfo *bind_info)
{
FtpProtocol *This = impl_from_Protocol(prot);
DWORD path_size = 0;
BSTR url;
HRESULT hres;
@ -73,16 +74,18 @@ static HRESULT FtpProtocol_open_request(Protocol *prot, IUri *uri, DWORD request
if(FAILED(hres))
return hres;
This->base.request = InternetOpenUrlW(internet_session, url, NULL, 0,
request_flags|INTERNET_FLAG_EXISTING_CONNECT|INTERNET_FLAG_PASSIVE,
(DWORD_PTR)&This->base);
SysFreeString(url);
if (!This->base.request && GetLastError() != ERROR_IO_PENDING) {
WARN("InternetOpenUrl failed: %d\n", GetLastError());
return INET_E_RESOURCE_NOT_FOUND;
hres = UrlUnescapeW(url, NULL, &path_size, URL_UNESCAPE_INPLACE);
if(SUCCEEDED(hres)) {
This->base.request = InternetOpenUrlW(internet_session, url, NULL, 0,
request_flags|INTERNET_FLAG_EXISTING_CONNECT|INTERNET_FLAG_PASSIVE,
(DWORD_PTR)&This->base);
if (!This->base.request && GetLastError() != ERROR_IO_PENDING) {
WARN("InternetOpenUrl failed: %d\n", GetLastError());
hres = INET_E_RESOURCE_NOT_FOUND;
}
}
return S_OK;
SysFreeString(url);
return hres;
}
static HRESULT FtpProtocol_end_request(Protocol *prot)

View File

@ -1,5 +1,5 @@
TESTDLL = urlmon.dll
IMPORTS = urlmon wininet ole32 oleaut32 user32 advapi32
IMPORTS = urlmon wininet ole32 oleaut32 shlwapi user32 advapi32
C_SRCS = \
generated.c \

View File

@ -32,6 +32,7 @@
#include "urlmon.h"
#include "wininet.h"
#include "mshtml.h"
#include "shlwapi.h"
#include "wine/test.h"
@ -2905,7 +2906,7 @@ static void init_bind_test(int protocol, DWORD flags, DWORD t)
url_a = (flags & BINDTEST_INVALID_CN) ? "https://4.15.184.77/favicon.ico" : "https://test.winehq.org/tests/hello.html";
break;
case FTP_TEST:
url_a = "ftp://ftp.winehq.org/welcome.msg";
url_a = "ftp://ftp.winehq.org/welcome%2emsg";
break;
default:
url_a = "winetest:test";
@ -2969,6 +2970,13 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
if(FAILED(hres))
return;
if(protocol == FTP_TEST)
{
/* FTP url dont have any escape characters, so convert the url to what is expected */
DWORD size = 0;
UrlUnescapeW(current_url, NULL, &size, URL_UNESCAPE_INPLACE);
}
hres = IMoniker_QueryInterface(mon, &IID_IBinding, (void**)&bind);
ok(hres == E_NOINTERFACE, "IMoniker should not have IBinding interface\n");
if(SUCCEEDED(hres))