20 #define NONAMELESSUNION 25 #define NO_SHLWAPI_REG 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;
struct _LARGE_INTEGER::@2253 u
#define HTTP_QUERY_CONTENT_LENGTH
#define ERROR_INTERNET_SEC_CERT_CN_INVALID
static HttpProtocol * impl_from_IInternetProtocolEx(IInternetProtocolEx *iface)
static HRESULT WINAPI HttpProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUri, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE *dwReserved)
IInternetPriority IInternetPriority_iface
HRESULT protocol_unlock_request(Protocol *protocol)
#define ERROR_INTERNET_SEC_CERT_NO_REV
static ULONG WINAPI HttpPriority_Release(IInternetPriority *iface)
#define HTTP_QUERY_CONTENT_TYPE
static HRESULT WINAPI HttpPriority_GetPriority(IInternetPriority *iface, LONG *pnPriority)
static const IInternetPriorityVtbl HttpPriorityVtbl
#define SECURITY_FLAG_IGNORE_UNKNOWN_CA
#define ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR
VOID WINAPI CoTaskMemFree(LPVOID ptr)
IWinInetHttpInfo IWinInetHttpInfo_iface
static ULONG WINAPI HttpProtocol_AddRef(IInternetProtocolEx *iface)
#define HTTP_QUERY_RAW_HEADERS_CRLF
#define HTTP_STATUS_REDIRECT_METHOD
static BOOL is_redirect_response(DWORD status_code)
GLsizei const GLchar ** path
static LPWSTR query_http_info(HttpProtocol *This, DWORD option)
static BOOL set_security_flag(HttpProtocol *This, DWORD flags)
#define ERROR_INTERNET_SEC_CERT_REV_FAILED
static HttpProtocol * impl_from_IWinInetHttpInfo(IWinInetHttpInfo *iface)
static ULONG WINAPI HttpProtocol_Release(IInternetProtocolEx *iface)
static ULONG send_http_request(HttpProtocol *This)
static HRESULT HttpProtocol_start_downloading(Protocol *prot)
#define INTERNET_FLAG_SECURE
HRESULT protocol_syncbinding(Protocol *protocol)
BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength)
static HRESULT WINAPI HttpInfo_QueryInterface(IWinInetHttpInfo *iface, REFIID riid, void **ppv)
static const WCHAR default_headersW[]
#define ERROR_INTERNET_SEC_CERT_REVOKED
static HRESULT create_http_protocol(BOOL https, IUnknown *outer, void **ppobj)
DWORD WINAPI GetLastError(VOID)
static HINTERNET internet_session
static HttpProtocol * impl_from_IUnknown(IUnknown *iface)
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define SECURITY_FLAG_IGNORE_CERT_CN_INVALID
static HRESULT handle_http_error(HttpProtocol *This, DWORD error)
static ULONG WINAPI HttpProtocolUnk_AddRef(IUnknown *iface)
static void * heap_alloc(size_t len)
static HRESULT WINAPI HttpProtocol_Seek(IInternetProtocolEx *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
void protocol_close_connection(Protocol *protocol)
struct status_code status_code
#define SECURITY_FLAG_IGNORE_REVOCATION
#define FLAGS_ERROR_UI_FLAGS_NO_UI
IInternetProtocolEx IInternetProtocolEx_iface
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
static HttpProtocol * impl_from_IInternetPriority(IInternetPriority *iface)
#define ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED
#define FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS
WINE_DEFAULT_DEBUG_CHANNEL(urlmon)
#define protocol_start(p, u, e)
#define ERROR_INTERNET_SEC_CERT_ERRORS
HRESULT protocol_abort(Protocol *protocol, HRESULT reason)
BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders, DWORD dwHeaderLength, LPVOID lpOptional, DWORD dwOptionalLength)
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest, LPINTERNET_BUFFERSW lpBuffersIn, LPINTERNET_BUFFERSW lpBuffersOut, DWORD dwFlags, DWORD_PTR dwContext)
#define HTTP_STATUS_REDIRECT
static void URLMON_UnlockModule(void)
static IServiceProvider service_provider
GLboolean GLboolean GLboolean b
static HRESULT WINAPI HttpProtocol_QueryInterface(IInternetProtocolEx *iface, REFIID riid, void **ppv)
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
static HRESULT WINAPI HttpProtocolUnk_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
static const IWinInetHttpInfoVtbl WinInetHttpInfoVtbl
BOOL WINAPI HttpEndRequestW(HINTERNET hRequest, LPINTERNET_BUFFERSW lpBuffersOut, DWORD dwFlags, DWORD_PTR dwContext)
static void HttpProtocol_close_connection(Protocol *prot)
#define FLAGS_ERROR_UI_FLAGS_GENERATE_DATA
static ULONG WINAPI HttpPriority_AddRef(IInternetPriority *iface)
static HRESULT WINAPI HttpInfo_QueryInfo(IWinInetHttpInfo *iface, DWORD dwOption, void *pBuffer, DWORD *pcbBuffer, DWORD *pdwFlags, DWORD *pdwReserved)
static const ProtocolVtbl AsyncProtocolVtbl
static HRESULT WINAPI HttpInfo_QueryOption(IWinInetHttpInfo *iface, DWORD dwOption, void *pBuffer, DWORD *pcbBuffer)
HRESULT protocol_continue(Protocol *protocol, PROTOCOLDATA *data)
BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
#define InterlockedDecrement
#define HTTP_STATUS_REDIRECT_KEEP_VERB
HRESULT protocol_lock_request(Protocol *protocol)
struct _INTERNET_BUFFERSW INTERNET_BUFFERSW
static ULONG WINAPI HttpProtocolUnk_Release(IUnknown *iface)
#define FLAG_RESULT_REPORTED
#define memcpy(s1, s2, n)
#define FLAG_FIRST_CONTINUE_COMPLETE
static void HttpProtocol_on_error(Protocol *prot, DWORD error)
static HRESULT WINAPI HttpProtocol_Start(IInternetProtocolEx *iface, LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved)
#define INTERNET_OPTION_SECONDARY_CACHE_KEY
static HRESULT WINAPI HttpProtocol_Terminate(IInternetProtocolEx *iface, DWORD dwOptions)
#define ERROR_INTERNET_FORCE_RETRY
static ULONG WINAPI HttpInfo_AddRef(IWinInetHttpInfo *iface)
_Reserved_ DWORD * pdwReserved
#define HTTP_QUERY_STATUS_CODE
#define location(file, line)
static HRESULT internet_error_to_hres(DWORD error)
HRESULT HttpSProtocol_Construct(IUnknown *outer, void **ppv)
static void WINAPI cb(HINTERNET handle, DWORD_PTR context, DWORD status, LPVOID info, DWORD size)
#define SECURITY_FLAG_IGNORE_CERT_DATE_INVALID
#define ERROR_INTERNET_SEC_CERT_DATE_INVALID
#define ERROR_INTERNET_INVALID_CA
#define INTERNET_OPTION_ERROR_MASK
static HRESULT WINAPI HttpProtocol_Continue(IInternetProtocolEx *iface, PROTOCOLDATA *pProtocolData)
#define ERROR_INTERNET_SEC_INVALID_CERT
#define InterlockedIncrement
#define ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR
static ULONG WINAPI HttpInfo_Release(IWinInetHttpInfo *iface)
#define INTERNET_OPTION_SECURITY_FLAGS
static const IInternetProtocolExVtbl HttpProtocolVtbl
static HRESULT WINAPI HttpProtocol_Suspend(IInternetProtocolEx *iface)
static IHttpSecurity http_security
static HRESULT WINAPI HttpProtocol_Resume(IInternetProtocolEx *iface)
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
IHttpNegotiate * http_negotiate
static HttpProtocol * impl_from_Protocol(Protocol *prot)
#define HTTP_QUERY_FLAG_NUMBER
static HRESULT WINAPI HttpPriority_SetPriority(IInternetPriority *iface, LONG nPriority)
static HRESULT WINAPI HttpProtocol_UnlockRequest(IInternetProtocolEx *iface)
static HRESULT WINAPI HttpProtocol_Abort(IInternetProtocolEx *iface, HRESULT hrReason, DWORD dwOptions)
#define ERROR_INTERNET_INCORRECT_PASSWORD
static IInternetBindInfo bind_info
#define INTERNET_OPTION_HTTP_DECODING
BOOL WINAPI InternetQueryOptionW(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
static DWORD64 content_length
HRESULT WINAPI CreateUri(LPCWSTR pwzURI, DWORD dwFlags, DWORD_PTR dwReserved, IUri **ppURI)
static const IUnknownVtbl HttpProtocolUnkVtbl
#define HTTP_STATUS_MOVED
#define FLAG_LAST_DATA_REPORTED
#define HTTP_QUERY_ACCEPT_RANGES
#define HTTP_QUERY_LOCATION
HRESULT HttpProtocol_Construct(IUnknown *outer, void **ppv)
HINTERNET WINAPI HttpOpenRequestW(HINTERNET hHttpSession, LPCWSTR lpszVerb, LPCWSTR lpszObjectName, LPCWSTR lpszVersion, LPCWSTR lpszReferrer, LPCWSTR *lpszAcceptTypes, DWORD dwFlags, DWORD_PTR dwContext)
#define ERROR_HTTP_REDIRECT_NEEDS_CONFIRMATION
static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD request_flags, HINTERNET internet_session, IInternetBindInfo *bind_info)
HINTERNET WINAPI InternetConnectW(HINTERNET hInternet, LPCWSTR lpszServerName, INTERNET_PORT nServerPort, LPCWSTR lpszUserName, LPCWSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
static void URLMON_LockModule(void)
static const char * send_buffer
#define INTERNET_ERROR_MASK_COMBINED_SEC_CERT
#define INTERNET_SERVICE_HTTP
void user(int argc, const char *argv[])
static HRESULT WINAPI HttpPriority_QueryInterface(IInternetPriority *iface, REFIID riid, void **ppv)
DWORD WINAPI InternetErrorDlg(HWND hWnd, HINTERNET hRequest, DWORD dwError, DWORD dwFlags, LPVOID *lppvData)
static HRESULT WINAPI HttpProtocol_Read(IInternetProtocolEx *iface, void *pv, ULONG cb, ULONG *pcbRead)
static BOOL security_problem
static HRESULT WINAPI HttpProtocol_LockRequest(IInternetProtocolEx *iface, DWORD dwOptions)
static HRESULT HttpProtocol_end_request(Protocol *protocol)
BOOL WINAPI HttpQueryInfoA(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
static BOOL heap_free(void *mem)
#define ERROR_INSUFFICIENT_BUFFER