[6/7] qmgr: Add support for Basic authentication.

Hans Leidekker hans at codeweavers.com
Mon Jun 8 09:44:38 CDT 2015


Hi Jacek,
> Hi Hans,
> 
> On 06/08/15 14:32, Hans Leidekker wrote:
> >  static HRESULT WINAPI http_negotiate_BeginningTransaction(
> >      IHttpNegotiate *iface, LPCWSTR url, LPCWSTR headers, DWORD reserved, LPWSTR *add_headers)
> >  {
> >      DLBindStatusCallback *callback = impl_from_IHttpNegotiate(iface);
> > -    FIXME("(%p)->(%s %s %u %p)\n", callback, debugstr_w(url), debugstr_w(headers), reserved, add_headers);
> > -    return E_NOTIMPL;
> > +    BackgroundCopyJobImpl *job = callback->file->owner;
> > +    WCHAR *str, *auth_header;
> > +    DWORD len;
> > +
> > +    TRACE("(%p)->(%s %s %d %p)\n", callback, debugstr_w(url), debugstr_w(headers), reserved, add_headers);
> > +
> > +    if ((auth_header = build_auth_header(&job->http_options.creds)))
> > +    {
> > +        if (!job->http_options.headers)
> > +        {
> > +            *add_headers = auth_header;
> > +            return S_OK;
> > +        }
> > +        else
> > +        {
> > +            len = strlenW(auth_header) + strlenW(job->http_options.headers);
> > +            if (!(str = CoTaskMemAlloc((len + 1) * sizeof(WCHAR))))
> > +            {
> > +                CoTaskMemFree(auth_header);
> > +                return E_OUTOFMEMORY;
> > +            }
> > +            strcpyW(str, auth_header);
> > +            strcatW(str, job->http_options.headers);
> > +            CoTaskMemFree(auth_header);
> > +            *add_headers = str;
> > +            return S_OK;
> > +        }
> > +    }
> > +    else if (job->http_options.headers)
> > +    {
> > +        if (!(*add_headers = co_strdupW(job->http_options.headers))) return E_OUTOFMEMORY;
> > +        return S_OK;
> > +    }
> > +
> > +    *add_headers = NULL;
> > +    return S_OK;
> 
> It doesn't sound like a good idea to manually handle that here. We
> should most likely use IAuthenticate (although it's not yet supported in
> urlmon).

I considered that but it doesn't seem possible to select the authentication
target (server vs. proxy) or scheme with IAuthenticate.





More information about the wine-devel mailing list