20#define NONAMELESSUNION
69 'A',
'c',
'c',
'e',
'p',
't',
'-',
'E',
'n',
'c',
'o',
'd',
'i',
'n',
'g',
':',
' ',
'g',
'z',
'i',
'p',
',',
' ',
'd',
'e',
'f',
'l',
'a',
't',
'e',0};
97 ERR(
"Failed to set security flags: %x\n",
flags);
115 return INET_E_INVALID_CERTIFICATE;
119 return INET_E_REDIRECT_FAILED;
121 return INET_E_DOWNLOAD_FAILURE;
157 hres = IInternetProtocolSink_QueryInterface(
This->base.protocol_sink, &IID_IServiceProvider,
160 ERR(
"Failed to get IServiceProvider.\n");
165 hres = IServiceProvider_QueryService(serv_prov, &IID_IHttpSecurity, &IID_IHttpSecurity,
171 TRACE(
"OnSecurityProblem returned %08x\n",
hres);
177 IServiceProvider_Release(serv_prov);
190 FIXME(
"Don't know how to ignore error %d\n",
error);
214 hres = IServiceProvider_QueryService(serv_prov, &IID_IWindowForBindingUI, &IID_IWindowForBindingUI, (
void**)&wfb_ui);
216 const IID *iid_reason;
219 iid_reason = &IID_IHttpSecurity;
221 iid_reason = &IID_IAuthenticate;
223 iid_reason = &IID_IWindowForBindingUI;
225 hres = IWindowForBindingUI_GetWindow(wfb_ui, iid_reason, &
hwnd);
226 IWindowForBindingUI_Release(wfb_ui);
232 if(
This->base.bindf & BINDF_NO_UI)
239 IServiceProvider_Release(serv_prov);
251 if(
This->base.bind_info.dwBindVerb != BINDVERB_GET) {
252 switch(
This->base.bind_info.stgmedData.tymed) {
258 case TYMED_ISTREAM: {
262 if(!
This->base.post_stream) {
263 This->base.post_stream =
This->base.bind_info.stgmedData.u.pstm;
264 IStream_AddRef(
This->base.post_stream);
268 IStream_Seek(
This->base.post_stream,
offset, STREAM_SEEK_SET,
NULL);
272 FIXME(
"Unsupported This->base.bind_info.stgmedData.tymed %d\n",
This->base.bind_info.stgmedData.tymed);
276 if(
This->base.post_stream)
299 const WCHAR **accept_types;
300 BYTE security_id[512];
306 static const WCHAR wszBindVerb[BINDVERB_CUSTOM][5] =
333 if(!
This->base.connection) {
335 return INET_E_CANNOT_CONNECT;
339 hres = IInternetBindInfo_GetBindString(
bind_info, BINDSTRING_ROOTDOC_URL, &rootdoc_url, 1, &
num);
346 hres = IInternetBindInfo_GetBindString(
bind_info, BINDSTRING_ACCEPT_MIMES, accept_mimes,
num, &
num);
347 if(
hres == INET_E_USE_DEFAULT_SETTING) {
348 static const WCHAR default_accept_mimeW[] = {
'*',
'/',
'*',0};
349 static const WCHAR *default_accept_mimes[] = {default_accept_mimeW,
NULL};
351 accept_types = default_accept_mimes;
354 accept_types = (
const WCHAR**)accept_mimes;
356 WARN(
"GetBindString BINDSTRING_ACCEPT_MIMES failed: %08x\n",
hres);
357 return INET_E_NO_VALID_MEDIA;
359 accept_mimes[
num] = 0;
367 This->base.bind_info.dwBindVerb < BINDVERB_CUSTOM
368 ? wszBindVerb[
This->base.bind_info.dwBindVerb] :
This->base.bind_info.szCustomVerb,
376 if (!
This->base.request) {
378 return INET_E_RESOURCE_NOT_FOUND;
381 hres = IInternetProtocolSink_QueryInterface(
This->base.protocol_sink, &IID_IServiceProvider,
384 WARN(
"IInternetProtocolSink_QueryInterface IID_IServiceProvider failed: %08x\n",
hres);
389 &IID_IHttpNegotiate, (
void **)&
This->http_negotiate);
391 WARN(
"IServiceProvider_QueryService IID_IHttpNegotiate failed: %08x\n",
hres);
406 WARN(
"IHttpNegotiate_BeginningTransaction failed: %08x\n",
hres);
414 if(!
This->full_header) {
425 &IID_IHttpNegotiate2, (
void **)&http_negotiate2);
428 WARN(
"IServiceProvider_QueryService IID_IHttpNegotiate2 failed: %08x\n",
hres);
432 hres = IHttpNegotiate2_GetRootSecurityId(http_negotiate2, security_id, &
len, 0);
433 IHttpNegotiate2_Release(http_negotiate2);
435 WARN(
"IHttpNegotiate2_GetRootSecurityId failed: %08x\n",
hres);
440 if(
This->base.bind_info.dwBindVerb == BINDVERB_POST) {
442 hres = IInternetBindInfo_GetBindString(
bind_info, BINDSTRING_POST_COOKIE, &post_cookie, 1, &
num);
445 post_cookie,
lstrlenW(post_cookie)))
446 WARN(
"InternetSetOption INTERNET_OPTION_SECONDARY_CACHE_KEY failed: %d\n",
GetLastError());
454 WARN(
"InternetSetOption(INTERNET_OPTION_ERROR_MASK) failed: %u\n",
GetLastError());
459 WARN(
"InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %u\n",
GetLastError());
478 WARN(
"HttpSendRequest failed: %d\n",
error);
516 static const WCHAR wszDefaultContentType[] =
517 {
't',
'e',
'x',
't',
'/',
'h',
't',
'm',
'l',0};
519 if(!
This->http_negotiate) {
520 WARN(
"Expected IHttpNegotiate pointer to be non-NULL\n");
527 WCHAR *response_headers;
532 TRACE(
"Got redirect with disabled auto redirects\n");
536 IInternetProtocolSink_ReportResult(
This->base.protocol_sink, INET_E_REDIRECT_FAILED, 0,
location);
538 return INET_E_REDIRECT_FAILED;
542 if(response_headers) {
547 WARN(
"IHttpNegotiate_OnResponse failed: %08x\n",
hres);
557 IInternetProtocolSink_ReportProgress(
This->base.protocol_sink, BINDSTATUS_ACCEPTRANGES,
NULL);
567 IInternetProtocolSink_ReportProgress(
This->base.protocol_sink,
568 (
This->base.bindf & BINDF_FROMURLMON)
569 ? BINDSTATUS_MIMETYPEAVAILABLE : BINDSTATUS_RAWMIMETYPE,
574 IInternetProtocolSink_ReportProgress(
This->base.protocol_sink,
575 (
This->base.bindf & BINDF_FROMURLMON)
576 ? BINDSTATUS_MIMETYPEAVAILABLE : BINDSTATUS_RAWMIMETYPE,
577 wszDefaultContentType);
593 if(
This->http_negotiate) {
594 IHttpNegotiate_Release(
This->http_negotiate);
642 TRACE(
"(%p)->(IID_IInternetProtocolRoot %p)\n",
This,
ppv);
643 *
ppv = &
This->IInternetProtocolEx_iface;
646 *
ppv = &
This->IInternetProtocolEx_iface;
648 TRACE(
"(%p)->(IID_IInternetProtocolEx %p)\n",
This,
ppv);
649 *
ppv = &
This->IInternetProtocolEx_iface;
652 *
ppv = &
This->IInternetPriority_iface;
655 *
ppv = &
This->IWinInetHttpInfo_iface;
658 *
ppv = &
This->IWinInetHttpInfo_iface;
704 return IUnknown_QueryInterface(
This->outer,
riid,
ppv);
711 return IUnknown_AddRef(
This->outer);
718 return IUnknown_Release(
This->outer);
736 hres = IInternetProtocolEx_StartEx(&
This->IInternetProtocolEx_iface,
uri, pOIProtSink,
747 TRACE(
"(%p)->(%p)\n",
This, pProtocolData);
791 TRACE(
"(%p)->(%p %u %p)\n",
This, pv,
cb, pcbRead);
800 FIXME(
"(%p)->(%d %d %p)\n",
This, dlibMove.
u.LowPart, dwOrigin, plibNewPosition);
830 TRACE(
"(%p)->(%p %p %p %08x %p)\n",
This, pUri, pOIProtSink,
840 pOIProtSink, pOIBindInfo);
863 return IInternetProtocolEx_QueryInterface(&
This->IInternetProtocolEx_iface,
riid,
ppv);
869 return IInternetProtocolEx_AddRef(&
This->IInternetProtocolEx_iface);
875 return IInternetProtocolEx_Release(&
This->IInternetProtocolEx_iface);
884 This->base.priority = nPriority;
894 *pnPriority =
This->base.priority;
909 return IInternetProtocolEx_QueryInterface(&
This->IInternetProtocolEx_iface,
riid,
ppv);
915 return IInternetProtocolEx_AddRef(&
This->IInternetProtocolEx_iface);
921 return IInternetProtocolEx_Release(&
This->IInternetProtocolEx_iface);
930 if(!
This->base.request)
944 if(!
This->base.request)
977 ret->outer = outer ? outer : &
ret->IUnknown_inner;
979 *ppobj = &
ret->IUnknown_inner;
static void * heap_alloc(size_t len)
static BOOL heap_free(void *mem)
#define InterlockedIncrement
#define InterlockedDecrement
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
void user(int argc, const char *argv[])
#define ERROR_INSUFFICIENT_BUFFER
static ULONG WINAPI HttpProtocol_AddRef(IInternetProtocolEx *iface)
static HRESULT WINAPI HttpPriority_SetPriority(IInternetPriority *iface, LONG nPriority)
static HRESULT internet_error_to_hres(DWORD error)
static ULONG send_http_request(HttpProtocol *This)
static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD request_flags, HINTERNET internet_session, IInternetBindInfo *bind_info)
static HRESULT HttpProtocol_start_downloading(Protocol *prot)
static ULONG WINAPI HttpProtocol_Release(IInternetProtocolEx *iface)
static void HttpProtocol_on_error(Protocol *prot, DWORD error)
static const IWinInetHttpInfoVtbl WinInetHttpInfoVtbl
static HRESULT WINAPI HttpPriority_GetPriority(IInternetPriority *iface, LONG *pnPriority)
static const IUnknownVtbl HttpProtocolUnkVtbl
static HRESULT WINAPI HttpInfo_QueryOption(IWinInetHttpInfo *iface, DWORD dwOption, void *pBuffer, DWORD *pcbBuffer)
HRESULT HttpProtocol_Construct(IUnknown *outer, void **ppv)
static HRESULT WINAPI HttpProtocol_QueryInterface(IInternetProtocolEx *iface, REFIID riid, void **ppv)
HRESULT HttpSProtocol_Construct(IUnknown *outer, void **ppv)
static HRESULT WINAPI HttpProtocol_LockRequest(IInternetProtocolEx *iface, DWORD dwOptions)
static HRESULT create_http_protocol(BOOL https, IUnknown *outer, void **ppobj)
static HttpProtocol * impl_from_IWinInetHttpInfo(IWinInetHttpInfo *iface)
static HRESULT WINAPI HttpPriority_QueryInterface(IInternetPriority *iface, REFIID riid, void **ppv)
static void HttpProtocol_close_connection(Protocol *prot)
static HRESULT WINAPI HttpProtocol_Abort(IInternetProtocolEx *iface, HRESULT hrReason, DWORD dwOptions)
static ULONG WINAPI HttpInfo_Release(IWinInetHttpInfo *iface)
static LPWSTR query_http_info(HttpProtocol *This, DWORD option)
static HttpProtocol * impl_from_IUnknown(IUnknown *iface)
static ULONG WINAPI HttpPriority_AddRef(IInternetPriority *iface)
static HRESULT WINAPI HttpInfo_QueryInterface(IWinInetHttpInfo *iface, REFIID riid, void **ppv)
static HRESULT HttpProtocol_end_request(Protocol *protocol)
static BOOL is_redirect_response(DWORD status_code)
static HRESULT WINAPI HttpProtocol_Suspend(IInternetProtocolEx *iface)
static HRESULT WINAPI HttpProtocol_UnlockRequest(IInternetProtocolEx *iface)
static ULONG WINAPI HttpInfo_AddRef(IWinInetHttpInfo *iface)
static HRESULT WINAPI HttpProtocolUnk_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
static HRESULT WINAPI HttpProtocol_Seek(IInternetProtocolEx *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
static HRESULT WINAPI HttpProtocol_Continue(IInternetProtocolEx *iface, PROTOCOLDATA *pProtocolData)
static ULONG WINAPI HttpProtocolUnk_AddRef(IUnknown *iface)
static HttpProtocol * impl_from_IInternetProtocolEx(IInternetProtocolEx *iface)
static const IInternetPriorityVtbl HttpPriorityVtbl
static ULONG WINAPI HttpProtocolUnk_Release(IUnknown *iface)
static HRESULT handle_http_error(HttpProtocol *This, DWORD error)
static HttpProtocol * impl_from_Protocol(Protocol *prot)
static const ProtocolVtbl AsyncProtocolVtbl
static HRESULT WINAPI HttpProtocol_Start(IInternetProtocolEx *iface, LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved)
static const IInternetProtocolExVtbl HttpProtocolVtbl
static BOOL set_security_flag(HttpProtocol *This, DWORD flags)
static HRESULT WINAPI HttpInfo_QueryInfo(IWinInetHttpInfo *iface, DWORD dwOption, void *pBuffer, DWORD *pcbBuffer, DWORD *pdwFlags, DWORD *pdwReserved)
static HRESULT WINAPI HttpProtocol_Read(IInternetProtocolEx *iface, void *pv, ULONG cb, ULONG *pcbRead)
static HRESULT WINAPI HttpProtocol_Resume(IInternetProtocolEx *iface)
static ULONG WINAPI HttpPriority_Release(IInternetPriority *iface)
static const WCHAR default_headersW[]
static HRESULT WINAPI HttpProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUri, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE *dwReserved)
static HRESULT WINAPI HttpProtocol_Terminate(IInternetProtocolEx *iface, DWORD dwOptions)
static HttpProtocol * impl_from_IInternetPriority(IInternetPriority *iface)
HRESULT protocol_syncbinding(Protocol *protocol)
HRESULT protocol_lock_request(Protocol *protocol)
HRESULT protocol_abort(Protocol *protocol, HRESULT reason)
void protocol_close_connection(Protocol *protocol)
HRESULT protocol_unlock_request(Protocol *protocol)
static HINTERNET internet_session
HRESULT protocol_continue(Protocol *protocol, PROTOCOLDATA *data)
HRESULT WINAPI CreateUri(LPCWSTR pwzURI, DWORD dwFlags, DWORD_PTR dwReserved, IUri **ppURI)
DWORD WINAPI InternetErrorDlg(HWND hWnd, HINTERNET hRequest, DWORD dwError, DWORD dwFlags, LPVOID *lppvData)
BOOL WINAPI HttpEndRequestW(HINTERNET hRequest, LPINTERNET_BUFFERSW lpBuffersOut, DWORD dwFlags, DWORD_PTR dwContext)
BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders, DWORD dwHeaderLength, LPVOID lpOptional, DWORD dwOptionalLength)
BOOL WINAPI HttpQueryInfoA(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest, LPINTERNET_BUFFERSW lpBuffersIn, LPINTERNET_BUFFERSW lpBuffersOut, DWORD dwFlags, DWORD_PTR dwContext)
HINTERNET WINAPI HttpOpenRequestW(HINTERNET hHttpSession, LPCWSTR lpszVerb, LPCWSTR lpszObjectName, LPCWSTR lpszVersion, LPCWSTR lpszReferrer, LPCWSTR *lpszAcceptTypes, DWORD dwFlags, DWORD_PTR dwContext)
BOOL WINAPI InternetQueryOptionW(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
HINTERNET WINAPI InternetConnectW(HINTERNET hInternet, LPCWSTR lpszServerName, INTERNET_PORT nServerPort, LPCWSTR lpszUserName, LPCWSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength)
GLboolean GLboolean GLboolean b
VOID WINAPI CoTaskMemFree(LPVOID ptr)
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define location(file, line)
#define memcpy(s1, s2, n)
static IServiceProvider service_provider
static IInternetBindInfo bind_info
#define protocol_start(p, u, e)
static HMODULE MODULEINFO DWORD cb
static IHttpSecurity http_security
static BOOL security_problem
static const char * send_buffer
static DWORD64 content_length
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
#define IsEqualGUID(rguid1, rguid2)
IHttpNegotiate * http_negotiate
IInternetProtocolEx IInternetProtocolEx_iface
IWinInetHttpInfo IWinInetHttpInfo_iface
IInternetPriority IInternetPriority_iface
#define CONTAINING_RECORD(address, type, field)
struct _LARGE_INTEGER::@2304 u
static void URLMON_LockModule(void)
static void URLMON_UnlockModule(void)
#define FLAG_LAST_DATA_REPORTED
#define FLAG_FIRST_CONTINUE_COMPLETE
#define FLAG_RESULT_REPORTED
DWORD WINAPI GetLastError(void)
_Reserved_ DWORD * pdwReserved
#define SECURITY_FLAG_IGNORE_CERT_DATE_INVALID
#define HTTP_STATUS_REDIRECT_KEEP_VERB
#define HTTP_STATUS_REDIRECT
#define HTTP_STATUS_MOVED
#define SECURITY_FLAG_IGNORE_UNKNOWN_CA
#define HTTP_STATUS_REDIRECT_METHOD
#define SECURITY_FLAG_IGNORE_CERT_CN_INVALID
struct _INTERNET_BUFFERSW INTERNET_BUFFERSW
#define INTERNET_ERROR_MASK_COMBINED_SEC_CERT
#define INTERNET_OPTION_SECURITY_FLAGS
#define ERROR_INTERNET_SEC_CERT_CN_INVALID
#define INTERNET_OPTION_SECONDARY_CACHE_KEY
#define ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR
#define HTTP_QUERY_RAW_HEADERS_CRLF
#define HTTP_QUERY_FLAG_NUMBER
#define ERROR_INTERNET_INVALID_CA
#define ERROR_INTERNET_INCORRECT_PASSWORD
#define FLAGS_ERROR_UI_FLAGS_GENERATE_DATA
#define ERROR_INTERNET_SEC_CERT_DATE_INVALID
#define INTERNET_FLAG_SECURE
#define HTTP_QUERY_ACCEPT_RANGES
#define HTTP_QUERY_CONTENT_TYPE
#define ERROR_INTERNET_FORCE_RETRY
#define ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED
#define FLAGS_ERROR_UI_FLAGS_NO_UI
#define HTTP_QUERY_LOCATION
#define ERROR_HTTP_REDIRECT_NEEDS_CONFIRMATION
#define HTTP_QUERY_STATUS_CODE
#define SECURITY_FLAG_IGNORE_REVOCATION
#define INTERNET_OPTION_ERROR_MASK
#define ERROR_INTERNET_SEC_CERT_REV_FAILED
#define ERROR_INTERNET_SEC_CERT_REVOKED
#define ERROR_INTERNET_SEC_CERT_NO_REV
#define ERROR_INTERNET_SEC_CERT_ERRORS
#define ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR
#define INTERNET_OPTION_HTTP_DECODING
#define FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS
#define ERROR_INTERNET_SEC_INVALID_CERT
#define HTTP_QUERY_CONTENT_LENGTH
#define INTERNET_SERVICE_HTTP