2 * Copyright 2005 Jacek Caban
3 * Copyright 2007 Misha Koshelev
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "urlmon_main.h"
23 #define NO_SHLWAPI_REG
26 #include "wine/debug.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(urlmon
);
33 IInternetProtocolEx IInternetProtocolEx_iface
;
34 IInternetPriority IInternetPriority_iface
;
35 IWinInetHttpInfo IWinInetHttpInfo_iface
;
38 IHttpNegotiate
*http_negotiate
;
44 static inline HttpProtocol
*impl_from_IInternetProtocolEx(IInternetProtocolEx
*iface
)
46 return CONTAINING_RECORD(iface
, HttpProtocol
, IInternetProtocolEx_iface
);
49 static inline HttpProtocol
*impl_from_IInternetPriority(IInternetPriority
*iface
)
51 return CONTAINING_RECORD(iface
, HttpProtocol
, IInternetPriority_iface
);
54 static inline HttpProtocol
*impl_from_IWinInetHttpInfo(IWinInetHttpInfo
*iface
)
56 return CONTAINING_RECORD(iface
, HttpProtocol
, IWinInetHttpInfo_iface
);
59 /* Default headers from native */
60 static const WCHAR wszHeaders
[] = {'A','c','c','e','p','t','-','E','n','c','o','d','i','n','g',
61 ':',' ','g','z','i','p',',',' ','d','e','f','l','a','t','e',0};
63 static LPWSTR
query_http_info(HttpProtocol
*This
, DWORD option
)
69 res
= HttpQueryInfoW(This
->base
.request
, option
, NULL
, &len
, NULL
);
70 if (!res
&& GetLastError() == ERROR_INSUFFICIENT_BUFFER
) {
71 ret
= heap_alloc(len
);
72 res
= HttpQueryInfoW(This
->base
.request
, option
, ret
, &len
, NULL
);
75 TRACE("HttpQueryInfoW(%d) failed: %08x\n", option
, GetLastError());
83 #define ASYNCPROTOCOL_THIS(iface) DEFINE_THIS2(HttpProtocol, base, iface)
85 static HRESULT
HttpProtocol_open_request(Protocol
*prot
, IUri
*uri
, DWORD request_flags
,
86 HINTERNET internet_session
, IInternetBindInfo
*bind_info
)
88 HttpProtocol
*This
= ASYNCPROTOCOL_THIS(prot
);
89 INTERNET_BUFFERSW send_buffer
= {sizeof(INTERNET_BUFFERSW
)};
90 LPWSTR addl_header
= NULL
, post_cookie
= NULL
;
91 IServiceProvider
*service_provider
= NULL
;
92 IHttpNegotiate2
*http_negotiate2
= NULL
;
93 BSTR url
, host
, user
, pass
, path
;
94 LPOLESTR accept_mimes
[257];
95 const WCHAR
**accept_types
;
96 BYTE security_id
[512];
102 static const WCHAR wszBindVerb
[BINDVERB_CUSTOM
][5] =
107 hres
= IUri_GetPort(uri
, &port
);
111 hres
= IUri_GetHost(uri
, &host
);
115 hres
= IUri_GetUserName(uri
, &user
);
116 if(SUCCEEDED(hres
)) {
117 hres
= IUri_GetPassword(uri
, &pass
);
119 if(SUCCEEDED(hres
)) {
120 This
->base
.connection
= InternetConnectW(internet_session
, host
, port
, user
, pass
,
121 INTERNET_SERVICE_HTTP
, This
->https
? INTERNET_FLAG_SECURE
: 0, (DWORD_PTR
)&This
->base
);
129 if(!This
->base
.connection
) {
130 WARN("InternetConnect failed: %d\n", GetLastError());
131 return INET_E_CANNOT_CONNECT
;
134 num
= sizeof(accept_mimes
)/sizeof(accept_mimes
[0])-1;
135 hres
= IInternetBindInfo_GetBindString(bind_info
, BINDSTRING_ACCEPT_MIMES
, accept_mimes
, num
, &num
);
136 if(hres
== INET_E_USE_DEFAULT_SETTING
) {
137 static const WCHAR default_accept_mimeW
[] = {'*','/','*',0};
138 static const WCHAR
*default_accept_mimes
[] = {default_accept_mimeW
, NULL
};
140 accept_types
= default_accept_mimes
;
142 }else if(hres
== S_OK
) {
143 accept_types
= (const WCHAR
**)accept_mimes
;
145 WARN("GetBindString BINDSTRING_ACCEPT_MIMES failed: %08x\n", hres
);
146 return INET_E_NO_VALID_MEDIA
;
148 accept_mimes
[num
] = 0;
151 request_flags
|= INTERNET_FLAG_SECURE
;
153 hres
= IUri_GetPathAndQuery(uri
, &path
);
154 if(SUCCEEDED(hres
)) {
155 This
->base
.request
= HttpOpenRequestW(This
->base
.connection
,
156 This
->base
.bind_info
.dwBindVerb
< BINDVERB_CUSTOM
157 ? wszBindVerb
[This
->base
.bind_info
.dwBindVerb
] : This
->base
.bind_info
.szCustomVerb
,
158 path
, NULL
, NULL
, accept_types
, request_flags
, (DWORD_PTR
)&This
->base
);
162 CoTaskMemFree(accept_mimes
[num
]);
165 if (!This
->base
.request
) {
166 WARN("HttpOpenRequest failed: %d\n", GetLastError());
167 return INET_E_RESOURCE_NOT_FOUND
;
170 hres
= IInternetProtocolSink_QueryInterface(This
->base
.protocol_sink
, &IID_IServiceProvider
,
171 (void **)&service_provider
);
173 WARN("IInternetProtocolSink_QueryInterface IID_IServiceProvider failed: %08x\n", hres
);
177 hres
= IServiceProvider_QueryService(service_provider
, &IID_IHttpNegotiate
,
178 &IID_IHttpNegotiate
, (void **)&This
->http_negotiate
);
180 WARN("IServiceProvider_QueryService IID_IHttpNegotiate failed: %08x\n", hres
);
181 IServiceProvider_Release(service_provider
);
185 hres
= IUri_GetAbsoluteUri(uri
, &url
);
187 IServiceProvider_Release(service_provider
);
191 hres
= IHttpNegotiate_BeginningTransaction(This
->http_negotiate
, url
, wszHeaders
,
195 WARN("IHttpNegotiate_BeginningTransaction failed: %08x\n", hres
);
196 IServiceProvider_Release(service_provider
);
201 int len_addl_header
= strlenW(addl_header
);
203 This
->full_header
= heap_alloc(len_addl_header
*sizeof(WCHAR
)+sizeof(wszHeaders
));
205 lstrcpyW(This
->full_header
, addl_header
);
206 lstrcpyW(&This
->full_header
[len_addl_header
], wszHeaders
);
207 CoTaskMemFree(addl_header
);
209 This
->full_header
= (LPWSTR
)wszHeaders
;
212 hres
= IServiceProvider_QueryService(service_provider
, &IID_IHttpNegotiate2
,
213 &IID_IHttpNegotiate2
, (void **)&http_negotiate2
);
214 IServiceProvider_Release(service_provider
);
216 WARN("IServiceProvider_QueryService IID_IHttpNegotiate2 failed: %08x\n", hres
);
217 /* No goto done as per native */
219 len
= sizeof(security_id
)/sizeof(security_id
[0]);
220 hres
= IHttpNegotiate2_GetRootSecurityId(http_negotiate2
, security_id
, &len
, 0);
221 IHttpNegotiate2_Release(http_negotiate2
);
223 WARN("IHttpNegotiate2_GetRootSecurityId failed: %08x\n", hres
);
226 /* FIXME: Handle security_id. Native calls undocumented function IsHostInProxyBypassList. */
228 if(This
->base
.bind_info
.dwBindVerb
== BINDVERB_POST
) {
230 hres
= IInternetBindInfo_GetBindString(bind_info
, BINDSTRING_POST_COOKIE
, &post_cookie
, 1, &num
);
231 if(hres
== S_OK
&& num
) {
232 if(!InternetSetOptionW(This
->base
.request
, INTERNET_OPTION_SECONDARY_CACHE_KEY
,
233 post_cookie
, lstrlenW(post_cookie
)))
234 WARN("InternetSetOption INTERNET_OPTION_SECONDARY_CACHE_KEY failed: %d\n", GetLastError());
235 CoTaskMemFree(post_cookie
);
239 send_buffer
.lpcszHeader
= This
->full_header
;
240 send_buffer
.dwHeadersLength
= send_buffer
.dwHeadersTotal
= strlenW(This
->full_header
);
242 if(This
->base
.bind_info
.dwBindVerb
!= BINDVERB_GET
) {
243 switch(This
->base
.bind_info
.stgmedData
.tymed
) {
245 /* Native does not use GlobalLock/GlobalUnlock, so we won't either */
246 send_buffer
.lpvBuffer
= This
->base
.bind_info
.stgmedData
.u
.hGlobal
;
247 send_buffer
.dwBufferLength
= send_buffer
.dwBufferTotal
= This
->base
.bind_info
.cbstgmedData
;
249 case TYMED_ISTREAM
: {
250 LARGE_INTEGER offset
;
252 send_buffer
.dwBufferTotal
= This
->base
.bind_info
.cbstgmedData
;
253 This
->base
.post_stream
= This
->base
.bind_info
.stgmedData
.u
.pstm
;
254 IStream_AddRef(This
->base
.post_stream
);
257 IStream_Seek(This
->base
.post_stream
, offset
, STREAM_SEEK_SET
, NULL
);
261 FIXME("Unsupported This->base.bind_info.stgmedData.tymed %d\n", This
->base
.bind_info
.stgmedData
.tymed
);
266 res
= InternetSetOptionW(This
->base
.request
, INTERNET_OPTION_HTTP_DECODING
, &b
, sizeof(b
));
268 WARN("InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %08x\n", GetLastError());
270 if(This
->base
.post_stream
)
271 res
= HttpSendRequestExW(This
->base
.request
, &send_buffer
, NULL
, 0, 0);
273 res
= HttpSendRequestW(This
->base
.request
, send_buffer
.lpcszHeader
, send_buffer
.dwHeadersLength
,
274 send_buffer
.lpvBuffer
, send_buffer
.dwBufferLength
);
275 if(!res
&& GetLastError() != ERROR_IO_PENDING
) {
276 WARN("HttpSendRequest failed: %d\n", GetLastError());
277 return INET_E_DOWNLOAD_FAILURE
;
283 static HRESULT
HttpProtocol_end_request(Protocol
*protocol
)
287 res
= HttpEndRequestW(protocol
->request
, NULL
, 0, 0);
288 if(!res
&& GetLastError() != ERROR_IO_PENDING
) {
289 FIXME("HttpEndRequest failed: %u\n", GetLastError());
296 static HRESULT
HttpProtocol_start_downloading(Protocol
*prot
)
298 HttpProtocol
*This
= ASYNCPROTOCOL_THIS(prot
);
299 LPWSTR content_type
, content_length
, ranges
;
300 DWORD len
= sizeof(DWORD
);
305 static const WCHAR wszDefaultContentType
[] =
306 {'t','e','x','t','/','h','t','m','l',0};
308 if(!This
->http_negotiate
) {
309 WARN("Expected IHttpNegotiate pointer to be non-NULL\n");
313 res
= HttpQueryInfoW(This
->base
.request
, HTTP_QUERY_STATUS_CODE
| HTTP_QUERY_FLAG_NUMBER
,
314 &status_code
, &len
, NULL
);
316 LPWSTR response_headers
= query_http_info(This
, HTTP_QUERY_RAW_HEADERS_CRLF
);
317 if(response_headers
) {
318 hres
= IHttpNegotiate_OnResponse(This
->http_negotiate
, status_code
, response_headers
,
320 heap_free(response_headers
);
322 WARN("IHttpNegotiate_OnResponse failed: %08x\n", hres
);
327 WARN("HttpQueryInfo failed: %d\n", GetLastError());
330 ranges
= query_http_info(This
, HTTP_QUERY_ACCEPT_RANGES
);
332 IInternetProtocolSink_ReportProgress(This
->base
.protocol_sink
, BINDSTATUS_ACCEPTRANGES
, NULL
);
336 content_type
= query_http_info(This
, HTTP_QUERY_CONTENT_TYPE
);
338 /* remove the charset, if present */
339 LPWSTR p
= strchrW(content_type
, ';');
342 IInternetProtocolSink_ReportProgress(This
->base
.protocol_sink
,
343 (This
->base
.bindf
& BINDF_FROMURLMON
)
344 ? BINDSTATUS_MIMETYPEAVAILABLE
: BINDSTATUS_RAWMIMETYPE
,
346 heap_free(content_type
);
348 WARN("HttpQueryInfo failed: %d\n", GetLastError());
349 IInternetProtocolSink_ReportProgress(This
->base
.protocol_sink
,
350 (This
->base
.bindf
& BINDF_FROMURLMON
)
351 ? BINDSTATUS_MIMETYPEAVAILABLE
: BINDSTATUS_RAWMIMETYPE
,
352 wszDefaultContentType
);
355 content_length
= query_http_info(This
, HTTP_QUERY_CONTENT_LENGTH
);
357 This
->base
.content_length
= atoiW(content_length
);
358 heap_free(content_length
);
364 static void HttpProtocol_close_connection(Protocol
*prot
)
366 HttpProtocol
*This
= ASYNCPROTOCOL_THIS(prot
);
368 if(This
->http_negotiate
) {
369 IHttpNegotiate_Release(This
->http_negotiate
);
370 This
->http_negotiate
= 0;
373 if(This
->full_header
) {
374 if(This
->full_header
!= wszHeaders
)
375 heap_free(This
->full_header
);
376 This
->full_header
= 0;
380 #undef ASYNCPROTOCOL_THIS
382 static const ProtocolVtbl AsyncProtocolVtbl
= {
383 HttpProtocol_open_request
,
384 HttpProtocol_end_request
,
385 HttpProtocol_start_downloading
,
386 HttpProtocol_close_connection
389 static HRESULT WINAPI
HttpProtocol_QueryInterface(IInternetProtocolEx
*iface
, REFIID riid
, void **ppv
)
391 HttpProtocol
*This
= impl_from_IInternetProtocolEx(iface
);
394 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
395 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
396 *ppv
= &This
->IInternetProtocolEx_iface
;
397 }else if(IsEqualGUID(&IID_IInternetProtocolRoot
, riid
)) {
398 TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This
, ppv
);
399 *ppv
= &This
->IInternetProtocolEx_iface
;
400 }else if(IsEqualGUID(&IID_IInternetProtocol
, riid
)) {
401 TRACE("(%p)->(IID_IInternetProtocol %p)\n", This
, ppv
);
402 *ppv
= &This
->IInternetProtocolEx_iface
;
403 }else if(IsEqualGUID(&IID_IInternetProtocolEx
, riid
)) {
404 TRACE("(%p)->(IID_IInternetProtocolEx %p)\n", This
, ppv
);
405 *ppv
= &This
->IInternetProtocolEx_iface
;
406 }else if(IsEqualGUID(&IID_IInternetPriority
, riid
)) {
407 TRACE("(%p)->(IID_IInternetPriority %p)\n", This
, ppv
);
408 *ppv
= &This
->IInternetPriority_iface
;
409 }else if(IsEqualGUID(&IID_IWinInetInfo
, riid
)) {
410 TRACE("(%p)->(IID_IWinInetInfo %p)\n", This
, ppv
);
411 *ppv
= &This
->IWinInetHttpInfo_iface
;
412 }else if(IsEqualGUID(&IID_IWinInetHttpInfo
, riid
)) {
413 TRACE("(%p)->(IID_IWinInetHttpInfo %p)\n", This
, ppv
);
414 *ppv
= &This
->IWinInetHttpInfo_iface
;
418 IInternetProtocol_AddRef(iface
);
422 WARN("not supported interface %s\n", debugstr_guid(riid
));
423 return E_NOINTERFACE
;
426 static ULONG WINAPI
HttpProtocol_AddRef(IInternetProtocolEx
*iface
)
428 HttpProtocol
*This
= impl_from_IInternetProtocolEx(iface
);
429 LONG ref
= InterlockedIncrement(&This
->ref
);
430 TRACE("(%p) ref=%d\n", This
, ref
);
434 static ULONG WINAPI
HttpProtocol_Release(IInternetProtocolEx
*iface
)
436 HttpProtocol
*This
= impl_from_IInternetProtocolEx(iface
);
437 LONG ref
= InterlockedDecrement(&This
->ref
);
439 TRACE("(%p) ref=%d\n", This
, ref
);
442 protocol_close_connection(&This
->base
);
445 URLMON_UnlockModule();
451 static HRESULT WINAPI
HttpProtocol_Start(IInternetProtocolEx
*iface
, LPCWSTR szUrl
,
452 IInternetProtocolSink
*pOIProtSink
, IInternetBindInfo
*pOIBindInfo
,
453 DWORD grfPI
, HANDLE_PTR dwReserved
)
455 HttpProtocol
*This
= impl_from_IInternetProtocolEx(iface
);
459 TRACE("(%p)->(%s %p %p %08x %lx)\n", This
, debugstr_w(szUrl
), pOIProtSink
,
460 pOIBindInfo
, grfPI
, dwReserved
);
462 hres
= CreateUri(szUrl
, 0, 0, &uri
);
466 hres
= IInternetProtocolEx_StartEx(&This
->IInternetProtocolEx_iface
, uri
, pOIProtSink
,
467 pOIBindInfo
, grfPI
, (HANDLE
*)dwReserved
);
473 static HRESULT WINAPI
HttpProtocol_Continue(IInternetProtocolEx
*iface
, PROTOCOLDATA
*pProtocolData
)
475 HttpProtocol
*This
= impl_from_IInternetProtocolEx(iface
);
477 TRACE("(%p)->(%p)\n", This
, pProtocolData
);
479 return protocol_continue(&This
->base
, pProtocolData
);
482 static HRESULT WINAPI
HttpProtocol_Abort(IInternetProtocolEx
*iface
, HRESULT hrReason
,
485 HttpProtocol
*This
= impl_from_IInternetProtocolEx(iface
);
487 TRACE("(%p)->(%08x %08x)\n", This
, hrReason
, dwOptions
);
489 return protocol_abort(&This
->base
, hrReason
);
492 static HRESULT WINAPI
HttpProtocol_Terminate(IInternetProtocolEx
*iface
, DWORD dwOptions
)
494 HttpProtocol
*This
= impl_from_IInternetProtocolEx(iface
);
496 TRACE("(%p)->(%08x)\n", This
, dwOptions
);
498 protocol_close_connection(&This
->base
);
502 static HRESULT WINAPI
HttpProtocol_Suspend(IInternetProtocolEx
*iface
)
504 HttpProtocol
*This
= impl_from_IInternetProtocolEx(iface
);
505 FIXME("(%p)\n", This
);
509 static HRESULT WINAPI
HttpProtocol_Resume(IInternetProtocolEx
*iface
)
511 HttpProtocol
*This
= impl_from_IInternetProtocolEx(iface
);
512 FIXME("(%p)\n", This
);
516 static HRESULT WINAPI
HttpProtocol_Read(IInternetProtocolEx
*iface
, void *pv
,
517 ULONG cb
, ULONG
*pcbRead
)
519 HttpProtocol
*This
= impl_from_IInternetProtocolEx(iface
);
521 TRACE("(%p)->(%p %u %p)\n", This
, pv
, cb
, pcbRead
);
523 return protocol_read(&This
->base
, pv
, cb
, pcbRead
);
526 static HRESULT WINAPI
HttpProtocol_Seek(IInternetProtocolEx
*iface
, LARGE_INTEGER dlibMove
,
527 DWORD dwOrigin
, ULARGE_INTEGER
*plibNewPosition
)
529 HttpProtocol
*This
= impl_from_IInternetProtocolEx(iface
);
530 FIXME("(%p)->(%d %d %p)\n", This
, dlibMove
.u
.LowPart
, dwOrigin
, plibNewPosition
);
534 static HRESULT WINAPI
HttpProtocol_LockRequest(IInternetProtocolEx
*iface
, DWORD dwOptions
)
536 HttpProtocol
*This
= impl_from_IInternetProtocolEx(iface
);
538 TRACE("(%p)->(%08x)\n", This
, dwOptions
);
540 return protocol_lock_request(&This
->base
);
543 static HRESULT WINAPI
HttpProtocol_UnlockRequest(IInternetProtocolEx
*iface
)
545 HttpProtocol
*This
= impl_from_IInternetProtocolEx(iface
);
547 TRACE("(%p)\n", This
);
549 return protocol_unlock_request(&This
->base
);
552 static HRESULT WINAPI
HttpProtocol_StartEx(IInternetProtocolEx
*iface
, IUri
*pUri
,
553 IInternetProtocolSink
*pOIProtSink
, IInternetBindInfo
*pOIBindInfo
,
554 DWORD grfPI
, HANDLE
*dwReserved
)
556 HttpProtocol
*This
= impl_from_IInternetProtocolEx(iface
);
560 TRACE("(%p)->(%p %p %p %08x %p)\n", This
, pUri
, pOIProtSink
,
561 pOIBindInfo
, grfPI
, dwReserved
);
563 hres
= IUri_GetScheme(pUri
, &scheme
);
566 if(scheme
!= (This
->https
? URL_SCHEME_HTTPS
: URL_SCHEME_HTTP
))
569 return protocol_start(&This
->base
, (IInternetProtocol
*)&This
->IInternetProtocolEx_iface
, pUri
,
570 pOIProtSink
, pOIBindInfo
);
573 static const IInternetProtocolExVtbl HttpProtocolVtbl
= {
574 HttpProtocol_QueryInterface
,
576 HttpProtocol_Release
,
578 HttpProtocol_Continue
,
580 HttpProtocol_Terminate
,
581 HttpProtocol_Suspend
,
585 HttpProtocol_LockRequest
,
586 HttpProtocol_UnlockRequest
,
590 static HRESULT WINAPI
HttpPriority_QueryInterface(IInternetPriority
*iface
, REFIID riid
, void **ppv
)
592 HttpProtocol
*This
= impl_from_IInternetPriority(iface
);
593 return IInternetProtocolEx_QueryInterface(&This
->IInternetProtocolEx_iface
, riid
, ppv
);
596 static ULONG WINAPI
HttpPriority_AddRef(IInternetPriority
*iface
)
598 HttpProtocol
*This
= impl_from_IInternetPriority(iface
);
599 return IInternetProtocolEx_AddRef(&This
->IInternetProtocolEx_iface
);
602 static ULONG WINAPI
HttpPriority_Release(IInternetPriority
*iface
)
604 HttpProtocol
*This
= impl_from_IInternetPriority(iface
);
605 return IInternetProtocolEx_Release(&This
->IInternetProtocolEx_iface
);
608 static HRESULT WINAPI
HttpPriority_SetPriority(IInternetPriority
*iface
, LONG nPriority
)
610 HttpProtocol
*This
= impl_from_IInternetPriority(iface
);
612 TRACE("(%p)->(%d)\n", This
, nPriority
);
614 This
->base
.priority
= nPriority
;
618 static HRESULT WINAPI
HttpPriority_GetPriority(IInternetPriority
*iface
, LONG
*pnPriority
)
620 HttpProtocol
*This
= impl_from_IInternetPriority(iface
);
622 TRACE("(%p)->(%p)\n", This
, pnPriority
);
624 *pnPriority
= This
->base
.priority
;
628 static const IInternetPriorityVtbl HttpPriorityVtbl
= {
629 HttpPriority_QueryInterface
,
631 HttpPriority_Release
,
632 HttpPriority_SetPriority
,
633 HttpPriority_GetPriority
636 static HRESULT WINAPI
HttpInfo_QueryInterface(IWinInetHttpInfo
*iface
, REFIID riid
, void **ppv
)
638 HttpProtocol
*This
= impl_from_IWinInetHttpInfo(iface
);
639 return IInternetProtocolEx_QueryInterface(&This
->IInternetProtocolEx_iface
, riid
, ppv
);
642 static ULONG WINAPI
HttpInfo_AddRef(IWinInetHttpInfo
*iface
)
644 HttpProtocol
*This
= impl_from_IWinInetHttpInfo(iface
);
645 return IInternetProtocolEx_AddRef(&This
->IInternetProtocolEx_iface
);
648 static ULONG WINAPI
HttpInfo_Release(IWinInetHttpInfo
*iface
)
650 HttpProtocol
*This
= impl_from_IWinInetHttpInfo(iface
);
651 return IInternetProtocolEx_Release(&This
->IInternetProtocolEx_iface
);
654 static HRESULT WINAPI
HttpInfo_QueryOption(IWinInetHttpInfo
*iface
, DWORD dwOption
,
655 void *pBuffer
, DWORD
*pcbBuffer
)
657 HttpProtocol
*This
= impl_from_IWinInetHttpInfo(iface
);
658 FIXME("(%p)->(%x %p %p)\n", This
, dwOption
, pBuffer
, pcbBuffer
);
662 static HRESULT WINAPI
HttpInfo_QueryInfo(IWinInetHttpInfo
*iface
, DWORD dwOption
,
663 void *pBuffer
, DWORD
*pcbBuffer
, DWORD
*pdwFlags
, DWORD
*pdwReserved
)
665 HttpProtocol
*This
= impl_from_IWinInetHttpInfo(iface
);
666 FIXME("(%p)->(%x %p %p %p %p)\n", This
, dwOption
, pBuffer
, pcbBuffer
, pdwFlags
, pdwReserved
);
670 static const IWinInetHttpInfoVtbl WinInetHttpInfoVtbl
= {
671 HttpInfo_QueryInterface
,
674 HttpInfo_QueryOption
,
678 static HRESULT
create_http_protocol(BOOL https
, void **ppobj
)
682 ret
= heap_alloc_zero(sizeof(HttpProtocol
));
684 return E_OUTOFMEMORY
;
686 ret
->base
.vtbl
= &AsyncProtocolVtbl
;
687 ret
->IInternetProtocolEx_iface
.lpVtbl
= &HttpProtocolVtbl
;
688 ret
->IInternetPriority_iface
.lpVtbl
= &HttpPriorityVtbl
;
689 ret
->IWinInetHttpInfo_iface
.lpVtbl
= &WinInetHttpInfoVtbl
;
694 *ppobj
= &ret
->IInternetProtocolEx_iface
;
700 HRESULT
HttpProtocol_Construct(IUnknown
*pUnkOuter
, LPVOID
*ppobj
)
702 TRACE("(%p %p)\n", pUnkOuter
, ppobj
);
704 return create_http_protocol(FALSE
, ppobj
);
707 HRESULT
HttpSProtocol_Construct(IUnknown
*pUnkOuter
, LPVOID
*ppobj
)
709 TRACE("(%p %p)\n", pUnkOuter
, ppobj
);
711 return create_http_protocol(TRUE
, ppobj
);