Commit 448e939e authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

msxml3: Embed user/password in uri used to create a moniker.

parent d8a86da6
......@@ -619,8 +619,27 @@ static HRESULT WINAPI Authenticate_Authenticate(IAuthenticate *iface,
HWND *hwnd, LPWSTR *username, LPWSTR *password)
{
BindStatusCallback *This = impl_from_IAuthenticate(iface);
FIXME("(%p)->(%p %p %p)\n", This, hwnd, username, password);
return E_NOTIMPL;
httprequest *request = This->request;
TRACE("(%p)->(%p %p %p)\n", This, hwnd, username, password);
if (request->user && *request->user)
{
if (hwnd) *hwnd = NULL;
*username = CoTaskMemAlloc(SysStringByteLen(request->user)+sizeof(WCHAR));
*password = CoTaskMemAlloc(SysStringByteLen(request->password)+sizeof(WCHAR));
if (!*username || !*password)
{
CoTaskMemFree(*username);
CoTaskMemFree(*password);
return E_OUTOFMEMORY;
}
memcpy(*username, request->user, SysStringByteLen(request->user)+sizeof(WCHAR));
memcpy(*password, request->password, SysStringByteLen(request->password)+sizeof(WCHAR));
}
return S_OK;
}
static const IAuthenticateVtbl AuthenticateVtbl = {
......@@ -882,12 +901,6 @@ static HRESULT httprequest_open(httprequest *This, BSTR method, BSTR url,
return hr;
}
This->uri = uri;
VariantInit(&is_async);
hr = VariantChangeType(&is_async, &async, 0, VT_BOOL);
This->async = hr == S_OK && V_BOOL(&is_async);
VariantInit(&str);
hr = VariantChangeType(&str, &user, 0, VT_BSTR);
if (hr == S_OK)
......@@ -898,6 +911,38 @@ static HRESULT httprequest_open(httprequest *This, BSTR method, BSTR url,
if (hr == S_OK)
This->password = V_BSTR(&str);
/* add authentication info */
if (This->user && *This->user)
{
IUriBuilder *builder;
hr = CreateIUriBuilder(uri, 0, 0, &builder);
if (hr == S_OK)
{
IUri *full_uri;
IUriBuilder_SetUserName(builder, This->user);
IUriBuilder_SetPassword(builder, This->password);
hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &full_uri);
if (hr == S_OK)
{
IUri_Release(uri);
uri = full_uri;
}
else
WARN("failed to create modified uri, 0x%08x\n", hr);
IUriBuilder_Release(builder);
}
else
WARN("IUriBuilder creation failed, 0x%08x\n", hr);
}
This->uri = uri;
VariantInit(&is_async);
hr = VariantChangeType(&is_async, &async, 0, VT_BOOL);
This->async = hr == S_OK && V_BOOL(&is_async);
httprequest_setreadystate(This, READYSTATE_LOADING);
return S_OK;
......
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