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 const IInternetProtocolExVtbl
*lpIInternetProtocolExVtbl
;
34 const IInternetPriorityVtbl
*lpInternetPriorityVtbl
;
35 const IWinInetHttpInfoVtbl
*lpWinInetHttpInfoVtbl
;
38 IHttpNegotiate
*http_negotiate
;
44 #define PROTOCOLEX(x) ((IInternetProtocolEx*)&(x)->lpIInternetProtocolExVtbl)
45 #define PRIORITY(x) ((IInternetPriority*) &(x)->lpInternetPriorityVtbl)
46 #define INETHTTPINFO(x) ((IWinInetHttpInfo*) &(x)->lpWinInetHttpInfoVtbl)
48 /* Default headers from native */
49 static const WCHAR wszHeaders
[] = {'A','c','c','e','p','t','-','E','n','c','o','d','i','n','g',
50 ':',' ','g','z','i','p',',',' ','d','e','f','l','a','t','e',0};
52 static LPWSTR
query_http_info(HttpProtocol
*This
, DWORD option
)
58 res
= HttpQueryInfoW(This
->base
.request
, option
, NULL
, &len
, NULL
);
59 if (!res
&& GetLastError() == ERROR_INSUFFICIENT_BUFFER
) {
60 ret
= heap_alloc(len
);
61 res
= HttpQueryInfoW(This
->base
.request
, option
, ret
, &len
, NULL
);
64 TRACE("HttpQueryInfoW(%d) failed: %08x\n", option
, GetLastError());
72 #define ASYNCPROTOCOL_THIS(iface) DEFINE_THIS2(HttpProtocol, base, iface)
74 static HRESULT
HttpProtocol_open_request(Protocol
*prot
, IUri
*uri
, DWORD request_flags
,
75 HINTERNET internet_session
, IInternetBindInfo
*bind_info
)
77 HttpProtocol
*This
= ASYNCPROTOCOL_THIS(prot
);
78 INTERNET_BUFFERSW send_buffer
= {sizeof(INTERNET_BUFFERSW
)};
79 LPWSTR addl_header
= NULL
, post_cookie
= NULL
;
80 IServiceProvider
*service_provider
= NULL
;
81 IHttpNegotiate2
*http_negotiate2
= NULL
;
82 BSTR url
, host
, user
, pass
, path
;
83 LPOLESTR accept_mimes
[257];
84 const WCHAR
**accept_types
;
85 BYTE security_id
[512];
91 static const WCHAR wszBindVerb
[BINDVERB_CUSTOM
][5] =
96 hres
= IUri_GetPort(uri
, &port
);
100 hres
= IUri_GetHost(uri
, &host
);
104 hres
= IUri_GetUserName(uri
, &user
);
105 if(SUCCEEDED(hres
)) {
106 hres
= IUri_GetPassword(uri
, &pass
);
108 if(SUCCEEDED(hres
)) {
109 This
->base
.connection
= InternetConnectW(internet_session
, host
, port
, user
, pass
,
110 INTERNET_SERVICE_HTTP
, This
->https
? INTERNET_FLAG_SECURE
: 0, (DWORD_PTR
)&This
->base
);
118 if(!This
->base
.connection
) {
119 WARN("InternetConnect failed: %d\n", GetLastError());
120 return INET_E_CANNOT_CONNECT
;
123 num
= sizeof(accept_mimes
)/sizeof(accept_mimes
[0])-1;
124 hres
= IInternetBindInfo_GetBindString(bind_info
, BINDSTRING_ACCEPT_MIMES
, accept_mimes
, num
, &num
);
125 if(hres
== INET_E_USE_DEFAULT_SETTING
) {
126 static const WCHAR default_accept_mimeW
[] = {'*','/','*',0};
127 static const WCHAR
*default_accept_mimes
[] = {default_accept_mimeW
, NULL
};
129 accept_types
= default_accept_mimes
;
131 }else if(hres
== S_OK
) {
132 accept_types
= (const WCHAR
**)accept_mimes
;
134 WARN("GetBindString BINDSTRING_ACCEPT_MIMES failed: %08x\n", hres
);
135 return INET_E_NO_VALID_MEDIA
;
137 accept_mimes
[num
] = 0;
140 request_flags
|= INTERNET_FLAG_SECURE
;
142 hres
= IUri_GetPathAndQuery(uri
, &path
);
143 if(SUCCEEDED(hres
)) {
144 This
->base
.request
= HttpOpenRequestW(This
->base
.connection
,
145 This
->base
.bind_info
.dwBindVerb
< BINDVERB_CUSTOM
146 ? wszBindVerb
[This
->base
.bind_info
.dwBindVerb
] : This
->base
.bind_info
.szCustomVerb
,
147 path
, NULL
, NULL
, accept_types
, request_flags
, (DWORD_PTR
)&This
->base
);
151 CoTaskMemFree(accept_mimes
[num
]);
154 if (!This
->base
.request
) {
155 WARN("HttpOpenRequest failed: %d\n", GetLastError());
156 return INET_E_RESOURCE_NOT_FOUND
;
159 hres
= IInternetProtocolSink_QueryInterface(This
->base
.protocol_sink
, &IID_IServiceProvider
,
160 (void **)&service_provider
);
162 WARN("IInternetProtocolSink_QueryInterface IID_IServiceProvider failed: %08x\n", hres
);
166 hres
= IServiceProvider_QueryService(service_provider
, &IID_IHttpNegotiate
,
167 &IID_IHttpNegotiate
, (void **)&This
->http_negotiate
);
169 WARN("IServiceProvider_QueryService IID_IHttpNegotiate failed: %08x\n", hres
);
170 IServiceProvider_Release(service_provider
);
174 hres
= IUri_GetAbsoluteUri(uri
, &url
);
176 IServiceProvider_Release(service_provider
);
180 hres
= IHttpNegotiate_BeginningTransaction(This
->http_negotiate
, url
, wszHeaders
,
184 WARN("IHttpNegotiate_BeginningTransaction failed: %08x\n", hres
);
185 IServiceProvider_Release(service_provider
);
190 int len_addl_header
= strlenW(addl_header
);
192 This
->full_header
= heap_alloc(len_addl_header
*sizeof(WCHAR
)+sizeof(wszHeaders
));
194 lstrcpyW(This
->full_header
, addl_header
);
195 lstrcpyW(&This
->full_header
[len_addl_header
], wszHeaders
);
196 CoTaskMemFree(addl_header
);
198 This
->full_header
= (LPWSTR
)wszHeaders
;
201 hres
= IServiceProvider_QueryService(service_provider
, &IID_IHttpNegotiate2
,
202 &IID_IHttpNegotiate2
, (void **)&http_negotiate2
);
203 IServiceProvider_Release(service_provider
);
205 WARN("IServiceProvider_QueryService IID_IHttpNegotiate2 failed: %08x\n", hres
);
206 /* No goto done as per native */
208 len
= sizeof(security_id
)/sizeof(security_id
[0]);
209 hres
= IHttpNegotiate2_GetRootSecurityId(http_negotiate2
, security_id
, &len
, 0);
210 IHttpNegotiate2_Release(http_negotiate2
);
212 WARN("IHttpNegotiate2_GetRootSecurityId failed: %08x\n", hres
);
215 /* FIXME: Handle security_id. Native calls undocumented function IsHostInProxyBypassList. */
217 if(This
->base
.bind_info
.dwBindVerb
== BINDVERB_POST
) {
219 hres
= IInternetBindInfo_GetBindString(bind_info
, BINDSTRING_POST_COOKIE
, &post_cookie
, 1, &num
);
220 if(hres
== S_OK
&& num
) {
221 if(!InternetSetOptionW(This
->base
.request
, INTERNET_OPTION_SECONDARY_CACHE_KEY
,
222 post_cookie
, lstrlenW(post_cookie
)))
223 WARN("InternetSetOption INTERNET_OPTION_SECONDARY_CACHE_KEY failed: %d\n", GetLastError());
224 CoTaskMemFree(post_cookie
);
228 send_buffer
.lpcszHeader
= This
->full_header
;
229 send_buffer
.dwHeadersLength
= send_buffer
.dwHeadersTotal
= strlenW(This
->full_header
);
231 if(This
->base
.bind_info
.dwBindVerb
!= BINDVERB_GET
) {
232 switch(This
->base
.bind_info
.stgmedData
.tymed
) {
234 /* Native does not use GlobalLock/GlobalUnlock, so we won't either */
235 send_buffer
.lpvBuffer
= This
->base
.bind_info
.stgmedData
.u
.hGlobal
;
236 send_buffer
.dwBufferLength
= send_buffer
.dwBufferTotal
= This
->base
.bind_info
.cbstgmedData
;
238 case TYMED_ISTREAM
: {
239 LARGE_INTEGER offset
;
241 send_buffer
.dwBufferTotal
= This
->base
.bind_info
.cbstgmedData
;
242 This
->base
.post_stream
= This
->base
.bind_info
.stgmedData
.u
.pstm
;
243 IStream_AddRef(This
->base
.post_stream
);
246 IStream_Seek(This
->base
.post_stream
, offset
, STREAM_SEEK_SET
, NULL
);
250 FIXME("Unsupported This->base.bind_info.stgmedData.tymed %d\n", This
->base
.bind_info
.stgmedData
.tymed
);
255 res
= InternetSetOptionW(This
->base
.request
, INTERNET_OPTION_HTTP_DECODING
, &b
, sizeof(b
));
257 WARN("InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %08x\n", GetLastError());
259 if(This
->base
.post_stream
)
260 res
= HttpSendRequestExW(This
->base
.request
, &send_buffer
, NULL
, 0, 0);
262 res
= HttpSendRequestW(This
->base
.request
, send_buffer
.lpcszHeader
, send_buffer
.dwHeadersLength
,
263 send_buffer
.lpvBuffer
, send_buffer
.dwBufferLength
);
264 if(!res
&& GetLastError() != ERROR_IO_PENDING
) {
265 WARN("HttpSendRequest failed: %d\n", GetLastError());
266 return INET_E_DOWNLOAD_FAILURE
;
272 static HRESULT
HttpProtocol_end_request(Protocol
*protocol
)
276 res
= HttpEndRequestW(protocol
->request
, NULL
, 0, 0);
277 if(!res
&& GetLastError() != ERROR_IO_PENDING
) {
278 FIXME("HttpEndRequest failed: %u\n", GetLastError());
285 static HRESULT
HttpProtocol_start_downloading(Protocol
*prot
)
287 HttpProtocol
*This
= ASYNCPROTOCOL_THIS(prot
);
288 LPWSTR content_type
, content_length
, ranges
;
289 DWORD len
= sizeof(DWORD
);
294 static const WCHAR wszDefaultContentType
[] =
295 {'t','e','x','t','/','h','t','m','l',0};
297 if(!This
->http_negotiate
) {
298 WARN("Expected IHttpNegotiate pointer to be non-NULL\n");
302 res
= HttpQueryInfoW(This
->base
.request
, HTTP_QUERY_STATUS_CODE
| HTTP_QUERY_FLAG_NUMBER
,
303 &status_code
, &len
, NULL
);
305 LPWSTR response_headers
= query_http_info(This
, HTTP_QUERY_RAW_HEADERS_CRLF
);
306 if(response_headers
) {
307 hres
= IHttpNegotiate_OnResponse(This
->http_negotiate
, status_code
, response_headers
,
309 heap_free(response_headers
);
311 WARN("IHttpNegotiate_OnResponse failed: %08x\n", hres
);
316 WARN("HttpQueryInfo failed: %d\n", GetLastError());
319 ranges
= query_http_info(This
, HTTP_QUERY_ACCEPT_RANGES
);
321 IInternetProtocolSink_ReportProgress(This
->base
.protocol_sink
, BINDSTATUS_ACCEPTRANGES
, NULL
);
325 content_type
= query_http_info(This
, HTTP_QUERY_CONTENT_TYPE
);
327 /* remove the charset, if present */
328 LPWSTR p
= strchrW(content_type
, ';');
331 IInternetProtocolSink_ReportProgress(This
->base
.protocol_sink
,
332 (This
->base
.bindf
& BINDF_FROMURLMON
)
333 ? BINDSTATUS_MIMETYPEAVAILABLE
: BINDSTATUS_RAWMIMETYPE
,
335 heap_free(content_type
);
337 WARN("HttpQueryInfo failed: %d\n", GetLastError());
338 IInternetProtocolSink_ReportProgress(This
->base
.protocol_sink
,
339 (This
->base
.bindf
& BINDF_FROMURLMON
)
340 ? BINDSTATUS_MIMETYPEAVAILABLE
: BINDSTATUS_RAWMIMETYPE
,
341 wszDefaultContentType
);
344 content_length
= query_http_info(This
, HTTP_QUERY_CONTENT_LENGTH
);
346 This
->base
.content_length
= atoiW(content_length
);
347 heap_free(content_length
);
353 static void HttpProtocol_close_connection(Protocol
*prot
)
355 HttpProtocol
*This
= ASYNCPROTOCOL_THIS(prot
);
357 if(This
->http_negotiate
) {
358 IHttpNegotiate_Release(This
->http_negotiate
);
359 This
->http_negotiate
= 0;
362 if(This
->full_header
) {
363 if(This
->full_header
!= wszHeaders
)
364 heap_free(This
->full_header
);
365 This
->full_header
= 0;
369 #undef ASYNCPROTOCOL_THIS
371 static const ProtocolVtbl AsyncProtocolVtbl
= {
372 HttpProtocol_open_request
,
373 HttpProtocol_end_request
,
374 HttpProtocol_start_downloading
,
375 HttpProtocol_close_connection
378 #define PROTOCOL_THIS(iface) DEFINE_THIS(HttpProtocol, IInternetProtocolEx, iface)
380 static HRESULT WINAPI
HttpProtocol_QueryInterface(IInternetProtocolEx
*iface
, REFIID riid
, void **ppv
)
382 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
385 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
386 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
387 *ppv
= PROTOCOLEX(This
);
388 }else if(IsEqualGUID(&IID_IInternetProtocolRoot
, riid
)) {
389 TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This
, ppv
);
390 *ppv
= PROTOCOLEX(This
);
391 }else if(IsEqualGUID(&IID_IInternetProtocol
, riid
)) {
392 TRACE("(%p)->(IID_IInternetProtocol %p)\n", This
, ppv
);
393 *ppv
= PROTOCOLEX(This
);
394 }else if(IsEqualGUID(&IID_IInternetProtocolEx
, riid
)) {
395 TRACE("(%p)->(IID_IInternetProtocolEx %p)\n", This
, ppv
);
396 *ppv
= PROTOCOLEX(This
);
397 }else if(IsEqualGUID(&IID_IInternetPriority
, riid
)) {
398 TRACE("(%p)->(IID_IInternetPriority %p)\n", This
, ppv
);
399 *ppv
= PRIORITY(This
);
400 }else if(IsEqualGUID(&IID_IWinInetInfo
, riid
)) {
401 TRACE("(%p)->(IID_IWinInetInfo %p)\n", This
, ppv
);
402 *ppv
= INETHTTPINFO(This
);
403 }else if(IsEqualGUID(&IID_IWinInetHttpInfo
, riid
)) {
404 TRACE("(%p)->(IID_IWinInetHttpInfo %p)\n", This
, ppv
);
405 *ppv
= INETHTTPINFO(This
);
409 IInternetProtocol_AddRef(iface
);
413 WARN("not supported interface %s\n", debugstr_guid(riid
));
414 return E_NOINTERFACE
;
417 static ULONG WINAPI
HttpProtocol_AddRef(IInternetProtocolEx
*iface
)
419 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
420 LONG ref
= InterlockedIncrement(&This
->ref
);
421 TRACE("(%p) ref=%d\n", This
, ref
);
425 static ULONG WINAPI
HttpProtocol_Release(IInternetProtocolEx
*iface
)
427 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
428 LONG ref
= InterlockedDecrement(&This
->ref
);
430 TRACE("(%p) ref=%d\n", This
, ref
);
433 protocol_close_connection(&This
->base
);
436 URLMON_UnlockModule();
442 static HRESULT WINAPI
HttpProtocol_Start(IInternetProtocolEx
*iface
, LPCWSTR szUrl
,
443 IInternetProtocolSink
*pOIProtSink
, IInternetBindInfo
*pOIBindInfo
,
444 DWORD grfPI
, HANDLE_PTR dwReserved
)
446 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
450 TRACE("(%p)->(%s %p %p %08x %lx)\n", This
, debugstr_w(szUrl
), pOIProtSink
,
451 pOIBindInfo
, grfPI
, dwReserved
);
453 hres
= CreateUri(szUrl
, 0, 0, &uri
);
457 hres
= IInternetProtocolEx_StartEx(PROTOCOLEX(This
), uri
, pOIProtSink
, pOIBindInfo
,
458 grfPI
, (HANDLE
*)dwReserved
);
464 static HRESULT WINAPI
HttpProtocol_Continue(IInternetProtocolEx
*iface
, PROTOCOLDATA
*pProtocolData
)
466 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
468 TRACE("(%p)->(%p)\n", This
, pProtocolData
);
470 return protocol_continue(&This
->base
, pProtocolData
);
473 static HRESULT WINAPI
HttpProtocol_Abort(IInternetProtocolEx
*iface
, HRESULT hrReason
,
476 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
478 TRACE("(%p)->(%08x %08x)\n", This
, hrReason
, dwOptions
);
480 return protocol_abort(&This
->base
, hrReason
);
483 static HRESULT WINAPI
HttpProtocol_Terminate(IInternetProtocolEx
*iface
, DWORD dwOptions
)
485 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
487 TRACE("(%p)->(%08x)\n", This
, dwOptions
);
489 protocol_close_connection(&This
->base
);
493 static HRESULT WINAPI
HttpProtocol_Suspend(IInternetProtocolEx
*iface
)
495 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
496 FIXME("(%p)\n", This
);
500 static HRESULT WINAPI
HttpProtocol_Resume(IInternetProtocolEx
*iface
)
502 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
503 FIXME("(%p)\n", This
);
507 static HRESULT WINAPI
HttpProtocol_Read(IInternetProtocolEx
*iface
, void *pv
,
508 ULONG cb
, ULONG
*pcbRead
)
510 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
512 TRACE("(%p)->(%p %u %p)\n", This
, pv
, cb
, pcbRead
);
514 return protocol_read(&This
->base
, pv
, cb
, pcbRead
);
517 static HRESULT WINAPI
HttpProtocol_Seek(IInternetProtocolEx
*iface
, LARGE_INTEGER dlibMove
,
518 DWORD dwOrigin
, ULARGE_INTEGER
*plibNewPosition
)
520 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
521 FIXME("(%p)->(%d %d %p)\n", This
, dlibMove
.u
.LowPart
, dwOrigin
, plibNewPosition
);
525 static HRESULT WINAPI
HttpProtocol_LockRequest(IInternetProtocolEx
*iface
, DWORD dwOptions
)
527 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
529 TRACE("(%p)->(%08x)\n", This
, dwOptions
);
531 return protocol_lock_request(&This
->base
);
534 static HRESULT WINAPI
HttpProtocol_UnlockRequest(IInternetProtocolEx
*iface
)
536 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
538 TRACE("(%p)\n", This
);
540 return protocol_unlock_request(&This
->base
);
543 static HRESULT WINAPI
HttpProtocol_StartEx(IInternetProtocolEx
*iface
, IUri
*pUri
,
544 IInternetProtocolSink
*pOIProtSink
, IInternetBindInfo
*pOIBindInfo
,
545 DWORD grfPI
, HANDLE
*dwReserved
)
547 HttpProtocol
*This
= PROTOCOL_THIS(iface
);
551 TRACE("(%p)->(%p %p %p %08x %p)\n", This
, pUri
, pOIProtSink
,
552 pOIBindInfo
, grfPI
, dwReserved
);
554 hres
= IUri_GetScheme(pUri
, &scheme
);
557 if(scheme
!= (This
->https
? URL_SCHEME_HTTPS
: URL_SCHEME_HTTP
))
560 return protocol_start(&This
->base
, (IInternetProtocol
*)PROTOCOLEX(This
), pUri
, pOIProtSink
, pOIBindInfo
);
565 static const IInternetProtocolExVtbl HttpProtocolVtbl
= {
566 HttpProtocol_QueryInterface
,
568 HttpProtocol_Release
,
570 HttpProtocol_Continue
,
572 HttpProtocol_Terminate
,
573 HttpProtocol_Suspend
,
577 HttpProtocol_LockRequest
,
578 HttpProtocol_UnlockRequest
,
582 #define PRIORITY_THIS(iface) DEFINE_THIS(HttpProtocol, InternetPriority, iface)
584 static HRESULT WINAPI
HttpPriority_QueryInterface(IInternetPriority
*iface
, REFIID riid
, void **ppv
)
586 HttpProtocol
*This
= PRIORITY_THIS(iface
);
587 return IInternetProtocolEx_QueryInterface(PROTOCOLEX(This
), riid
, ppv
);
590 static ULONG WINAPI
HttpPriority_AddRef(IInternetPriority
*iface
)
592 HttpProtocol
*This
= PRIORITY_THIS(iface
);
593 return IInternetProtocolEx_AddRef(PROTOCOLEX(This
));
596 static ULONG WINAPI
HttpPriority_Release(IInternetPriority
*iface
)
598 HttpProtocol
*This
= PRIORITY_THIS(iface
);
599 return IInternetProtocolEx_Release(PROTOCOLEX(This
));
602 static HRESULT WINAPI
HttpPriority_SetPriority(IInternetPriority
*iface
, LONG nPriority
)
604 HttpProtocol
*This
= PRIORITY_THIS(iface
);
606 TRACE("(%p)->(%d)\n", This
, nPriority
);
608 This
->base
.priority
= nPriority
;
612 static HRESULT WINAPI
HttpPriority_GetPriority(IInternetPriority
*iface
, LONG
*pnPriority
)
614 HttpProtocol
*This
= PRIORITY_THIS(iface
);
616 TRACE("(%p)->(%p)\n", This
, pnPriority
);
618 *pnPriority
= This
->base
.priority
;
624 static const IInternetPriorityVtbl HttpPriorityVtbl
= {
625 HttpPriority_QueryInterface
,
627 HttpPriority_Release
,
628 HttpPriority_SetPriority
,
629 HttpPriority_GetPriority
632 #define INETINFO_THIS(iface) DEFINE_THIS(HttpProtocol, WinInetHttpInfo, iface)
634 static HRESULT WINAPI
HttpInfo_QueryInterface(IWinInetHttpInfo
*iface
, REFIID riid
, void **ppv
)
636 HttpProtocol
*This
= INETINFO_THIS(iface
);
637 return IInternetProtocolEx_QueryInterface(PROTOCOLEX(This
), riid
, ppv
);
640 static ULONG WINAPI
HttpInfo_AddRef(IWinInetHttpInfo
*iface
)
642 HttpProtocol
*This
= INETINFO_THIS(iface
);
643 return IInternetProtocolEx_AddRef(PROTOCOLEX(This
));
646 static ULONG WINAPI
HttpInfo_Release(IWinInetHttpInfo
*iface
)
648 HttpProtocol
*This
= INETINFO_THIS(iface
);
649 return IInternetProtocolEx_Release(PROTOCOLEX(This
));
652 static HRESULT WINAPI
HttpInfo_QueryOption(IWinInetHttpInfo
*iface
, DWORD dwOption
,
653 void *pBuffer
, DWORD
*pcbBuffer
)
655 HttpProtocol
*This
= INETINFO_THIS(iface
);
656 FIXME("(%p)->(%x %p %p)\n", This
, dwOption
, pBuffer
, pcbBuffer
);
660 static HRESULT WINAPI
HttpInfo_QueryInfo(IWinInetHttpInfo
*iface
, DWORD dwOption
,
661 void *pBuffer
, DWORD
*pcbBuffer
, DWORD
*pdwFlags
, DWORD
*pdwReserved
)
663 HttpProtocol
*This
= INETINFO_THIS(iface
);
664 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
->lpIInternetProtocolExVtbl
= &HttpProtocolVtbl
;
688 ret
->lpInternetPriorityVtbl
= &HttpPriorityVtbl
;
689 ret
->lpWinInetHttpInfoVtbl
= &WinInetHttpInfoVtbl
;
694 *ppobj
= PROTOCOLEX(ret
);
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
);