2006-01-15 22:25:16 +00:00
|
|
|
/*
|
|
|
|
* Wininet
|
|
|
|
*
|
|
|
|
* Copyright 1999 Corel Corporation
|
|
|
|
*
|
|
|
|
* Ulrich Czekalla
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2007-11-29 12:52:01 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2006-01-15 22:25:16 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _WINE_INTERNET_H_
|
|
|
|
#define _WINE_INTERNET_H_
|
|
|
|
|
2014-01-01 21:52:15 +00:00
|
|
|
#include <wine/config.h>
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#define _INC_WINDOWS
|
|
|
|
#define COM_NO_WINDOWS_H
|
|
|
|
|
|
|
|
#define NONAMELESSUNION
|
|
|
|
#define NONAMELESSSTRUCT
|
2007-11-29 12:52:01 +00:00
|
|
|
|
2014-01-01 21:52:15 +00:00
|
|
|
#include <windef.h>
|
|
|
|
#include <winbase.h>
|
|
|
|
#include <winreg.h>
|
|
|
|
#include <winuser.h>
|
|
|
|
#include <wininet.h>
|
|
|
|
#define NO_SHLWAPI_STREAM
|
|
|
|
#define NO_SHLWAPI_REG
|
|
|
|
#define NO_SHLWAPI_GDI
|
|
|
|
#include <shlwapi.h>
|
|
|
|
|
|
|
|
#include <wine/list.h>
|
2014-01-26 13:23:06 +00:00
|
|
|
#include <wine/debug.h>
|
|
|
|
#include <wine/unicode.h>
|
2014-01-01 21:52:15 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_ARPA_INET_H
|
|
|
|
# include <arpa/inet.h>
|
|
|
|
#endif
|
2006-01-15 22:25:16 +00:00
|
|
|
#ifdef HAVE_NETDB_H
|
|
|
|
# include <netdb.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_NETINET_IN_H
|
|
|
|
# include <sys/types.h>
|
|
|
|
# include <netinet/in.h>
|
|
|
|
#endif
|
2014-01-01 21:52:15 +00:00
|
|
|
#ifdef HAVE_SYS_IOCTL_H
|
|
|
|
# include <sys/ioctl.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_POLL_H
|
|
|
|
# include <sys/poll.h>
|
|
|
|
#endif
|
2006-01-15 22:25:16 +00:00
|
|
|
#ifdef HAVE_SYS_SOCKET_H
|
|
|
|
# include <sys/socket.h>
|
|
|
|
#endif
|
2014-01-01 21:52:15 +00:00
|
|
|
#ifdef HAVE_SYS_TIME_H
|
|
|
|
# include <sys/time.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
2006-01-15 22:25:16 +00:00
|
|
|
|
2014-01-01 21:52:15 +00:00
|
|
|
#if defined(__MINGW32__) || defined (_MSC_VER)
|
|
|
|
#include <ws2tcpip.h>
|
|
|
|
#else
|
2006-01-15 22:25:16 +00:00
|
|
|
#define closesocket close
|
2008-05-31 13:02:59 +00:00
|
|
|
#define ioctlsocket ioctl
|
2006-01-15 22:25:16 +00:00
|
|
|
#endif /* __MINGW32__ */
|
|
|
|
|
2013-05-20 21:42:26 +00:00
|
|
|
#include <winineti.h>
|
|
|
|
|
2014-01-01 21:52:15 +00:00
|
|
|
#include "resource.h"
|
|
|
|
|
2014-01-26 13:23:06 +00:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(wininet);
|
|
|
|
|
2011-06-05 23:11:41 +00:00
|
|
|
extern HMODULE WININET_hModule DECLSPEC_HIDDEN;
|
|
|
|
|
|
|
|
#ifndef INET6_ADDRSTRLEN
|
|
|
|
#define INET6_ADDRSTRLEN 46
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
WCHAR *name;
|
|
|
|
INTERNET_PORT port;
|
2013-05-20 21:42:26 +00:00
|
|
|
BOOL is_https;
|
2011-06-05 23:11:41 +00:00
|
|
|
struct sockaddr_storage addr;
|
|
|
|
socklen_t addr_len;
|
|
|
|
char addr_str[INET6_ADDRSTRLEN];
|
|
|
|
|
2013-05-20 21:42:26 +00:00
|
|
|
WCHAR *scheme_host_port;
|
|
|
|
const WCHAR *host_port;
|
|
|
|
const WCHAR *canon_host_port;
|
|
|
|
|
2011-06-05 23:11:41 +00:00
|
|
|
LONG ref;
|
2013-05-20 21:42:26 +00:00
|
|
|
|
|
|
|
DWORD security_flags;
|
|
|
|
const CERT_CHAIN_CONTEXT *cert_chain;
|
2011-06-05 23:11:41 +00:00
|
|
|
|
|
|
|
struct list entry;
|
|
|
|
struct list conn_pool;
|
|
|
|
} server_t;
|
|
|
|
|
|
|
|
void server_addref(server_t*) DECLSPEC_HIDDEN;
|
|
|
|
void server_release(server_t*) DECLSPEC_HIDDEN;
|
2013-05-20 21:42:26 +00:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
COLLECT_TIMEOUT,
|
|
|
|
COLLECT_CONNECTIONS,
|
|
|
|
COLLECT_CLEANUP
|
|
|
|
} collect_type_t;
|
|
|
|
BOOL collect_connections(collect_type_t) DECLSPEC_HIDDEN;
|
2011-06-05 23:11:41 +00:00
|
|
|
|
2006-01-15 22:25:16 +00:00
|
|
|
/* used for netconnection.c stuff */
|
|
|
|
typedef struct
|
|
|
|
{
|
2013-05-20 21:42:26 +00:00
|
|
|
int socket;
|
|
|
|
BOOL secure;
|
2013-09-28 15:25:41 +00:00
|
|
|
CtxtHandle ssl_ctx;
|
|
|
|
SecPkgContext_StreamSizes ssl_sizes;
|
2011-06-05 23:11:41 +00:00
|
|
|
server_t *server;
|
2013-09-28 15:25:41 +00:00
|
|
|
char *ssl_buf;
|
|
|
|
char *extra_buf;
|
|
|
|
size_t extra_len;
|
|
|
|
char *peek_msg;
|
|
|
|
char *peek_msg_mem;
|
|
|
|
size_t peek_len;
|
2010-10-09 20:08:18 +00:00
|
|
|
DWORD security_flags;
|
2013-05-20 21:42:26 +00:00
|
|
|
BOOL mask_errors;
|
2011-06-05 23:11:41 +00:00
|
|
|
|
|
|
|
BOOL keep_alive;
|
|
|
|
DWORD64 keep_until;
|
|
|
|
struct list pool_entry;
|
|
|
|
} netconn_t;
|
|
|
|
|
|
|
|
static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
|
|
|
|
{
|
|
|
|
return HeapAlloc(GetProcessHeap(), 0, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
|
|
|
|
{
|
|
|
|
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
|
|
|
|
{
|
|
|
|
return HeapReAlloc(GetProcessHeap(), 0, mem, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
|
|
|
|
{
|
|
|
|
return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline BOOL heap_free(void *mem)
|
|
|
|
{
|
|
|
|
return HeapFree(GetProcessHeap(), 0, mem);
|
|
|
|
}
|
2006-01-15 22:25:16 +00:00
|
|
|
|
2010-03-15 11:35:51 +00:00
|
|
|
static inline LPWSTR heap_strdupW(LPCWSTR str)
|
2006-01-15 22:25:16 +00:00
|
|
|
{
|
2010-03-15 11:35:51 +00:00
|
|
|
LPWSTR ret = NULL;
|
|
|
|
|
|
|
|
if(str) {
|
|
|
|
DWORD size;
|
|
|
|
|
|
|
|
size = (strlenW(str)+1)*sizeof(WCHAR);
|
2011-06-05 23:11:41 +00:00
|
|
|
ret = heap_alloc(size);
|
2010-03-15 11:35:51 +00:00
|
|
|
if(ret)
|
|
|
|
memcpy(ret, str, size);
|
|
|
|
}
|
|
|
|
|
2006-01-15 22:25:16 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-09-28 15:25:41 +00:00
|
|
|
static inline char *heap_strdupA(const char *str)
|
|
|
|
{
|
|
|
|
char *ret = NULL;
|
|
|
|
|
|
|
|
if(str) {
|
|
|
|
DWORD size = strlen(str)+1;
|
|
|
|
|
|
|
|
ret = heap_alloc(size);
|
|
|
|
if(ret)
|
|
|
|
memcpy(ret, str, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-10-09 20:08:18 +00:00
|
|
|
static inline LPWSTR heap_strndupW(LPCWSTR str, UINT max_len)
|
|
|
|
{
|
|
|
|
LPWSTR ret;
|
|
|
|
UINT len;
|
|
|
|
|
|
|
|
if(!str)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
for(len=0; len<max_len; len++)
|
|
|
|
if(str[len] == '\0')
|
|
|
|
break;
|
|
|
|
|
2011-06-05 23:11:41 +00:00
|
|
|
ret = heap_alloc(sizeof(WCHAR)*(len+1));
|
2010-10-09 20:08:18 +00:00
|
|
|
if(ret) {
|
|
|
|
memcpy(ret, str, sizeof(WCHAR)*len);
|
|
|
|
ret[len] = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-03-15 11:35:51 +00:00
|
|
|
static inline WCHAR *heap_strdupAtoW(const char *str)
|
2006-01-15 22:25:16 +00:00
|
|
|
{
|
2010-03-15 11:35:51 +00:00
|
|
|
LPWSTR ret = NULL;
|
|
|
|
|
|
|
|
if(str) {
|
|
|
|
DWORD len;
|
|
|
|
|
|
|
|
len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
|
2011-06-05 23:11:41 +00:00
|
|
|
ret = heap_alloc(len*sizeof(WCHAR));
|
2010-03-15 11:35:51 +00:00
|
|
|
if(ret)
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
|
|
|
|
}
|
|
|
|
|
2006-01-15 22:25:16 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-03-15 11:35:51 +00:00
|
|
|
static inline char *heap_strdupWtoA(LPCWSTR str)
|
2006-01-15 22:25:16 +00:00
|
|
|
{
|
2010-03-15 11:35:51 +00:00
|
|
|
char *ret = NULL;
|
|
|
|
|
|
|
|
if(str) {
|
|
|
|
DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
|
2011-06-05 23:11:41 +00:00
|
|
|
ret = heap_alloc(size);
|
2010-03-15 11:35:51 +00:00
|
|
|
if(ret)
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
2006-01-15 22:25:16 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2007-11-29 12:52:01 +00:00
|
|
|
static inline void WININET_find_data_WtoA(LPWIN32_FIND_DATAW dataW, LPWIN32_FIND_DATAA dataA)
|
2006-01-15 22:25:16 +00:00
|
|
|
{
|
|
|
|
dataA->dwFileAttributes = dataW->dwFileAttributes;
|
|
|
|
dataA->ftCreationTime = dataW->ftCreationTime;
|
|
|
|
dataA->ftLastAccessTime = dataW->ftLastAccessTime;
|
|
|
|
dataA->ftLastWriteTime = dataW->ftLastWriteTime;
|
|
|
|
dataA->nFileSizeHigh = dataW->nFileSizeHigh;
|
|
|
|
dataA->nFileSizeLow = dataW->nFileSizeLow;
|
|
|
|
dataA->dwReserved0 = dataW->dwReserved0;
|
|
|
|
dataA->dwReserved1 = dataW->dwReserved1;
|
2007-11-29 12:52:01 +00:00
|
|
|
WideCharToMultiByte(CP_ACP, 0, dataW->cFileName, -1,
|
2006-01-15 22:25:16 +00:00
|
|
|
dataA->cFileName, sizeof(dataA->cFileName),
|
|
|
|
NULL, NULL);
|
2007-11-29 12:52:01 +00:00
|
|
|
WideCharToMultiByte(CP_ACP, 0, dataW->cAlternateFileName, -1,
|
2006-01-15 22:25:16 +00:00
|
|
|
dataA->cAlternateFileName, sizeof(dataA->cAlternateFileName),
|
|
|
|
NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
WH_HINIT = INTERNET_HANDLE_TYPE_INTERNET,
|
|
|
|
WH_HFTPSESSION = INTERNET_HANDLE_TYPE_CONNECT_FTP,
|
|
|
|
WH_HGOPHERSESSION = INTERNET_HANDLE_TYPE_CONNECT_GOPHER,
|
|
|
|
WH_HHTTPSESSION = INTERNET_HANDLE_TYPE_CONNECT_HTTP,
|
|
|
|
WH_HFILE = INTERNET_HANDLE_TYPE_FTP_FILE,
|
2007-11-29 12:52:01 +00:00
|
|
|
WH_HFTPFINDNEXT = INTERNET_HANDLE_TYPE_FTP_FIND,
|
2006-01-15 22:25:16 +00:00
|
|
|
WH_HHTTPREQ = INTERNET_HANDLE_TYPE_HTTP_REQUEST,
|
|
|
|
} WH_TYPE;
|
|
|
|
|
|
|
|
#define INET_OPENURL 0x0001
|
|
|
|
#define INET_CALLBACKW 0x0002
|
|
|
|
|
2010-03-15 11:35:51 +00:00
|
|
|
typedef struct _object_header_t object_header_t;
|
2006-01-15 22:25:16 +00:00
|
|
|
|
2008-05-31 13:02:59 +00:00
|
|
|
typedef struct {
|
2010-03-15 11:35:51 +00:00
|
|
|
void (*Destroy)(object_header_t*);
|
|
|
|
void (*CloseConnection)(object_header_t*);
|
|
|
|
DWORD (*QueryOption)(object_header_t*,DWORD,void*,DWORD*,BOOL);
|
|
|
|
DWORD (*SetOption)(object_header_t*,DWORD,void*,DWORD);
|
|
|
|
DWORD (*ReadFile)(object_header_t*,void*,DWORD,DWORD*);
|
2013-05-20 21:42:26 +00:00
|
|
|
DWORD (*ReadFileEx)(object_header_t*,void*,DWORD,DWORD*,DWORD,DWORD_PTR);
|
2010-03-15 11:35:51 +00:00
|
|
|
DWORD (*WriteFile)(object_header_t*,const void*,DWORD,DWORD*);
|
|
|
|
DWORD (*QueryDataAvailable)(object_header_t*,DWORD*,DWORD,DWORD_PTR);
|
|
|
|
DWORD (*FindNextFileW)(object_header_t*,void*);
|
|
|
|
} object_vtbl_t;
|
|
|
|
|
2010-10-09 20:08:18 +00:00
|
|
|
#define INTERNET_HANDLE_IN_USE 1
|
|
|
|
|
2010-03-15 11:35:51 +00:00
|
|
|
struct _object_header_t
|
2006-01-15 22:25:16 +00:00
|
|
|
{
|
|
|
|
WH_TYPE htype;
|
2010-03-15 11:35:51 +00:00
|
|
|
const object_vtbl_t *vtbl;
|
2007-11-29 12:52:01 +00:00
|
|
|
HINTERNET hInternet;
|
2011-06-05 23:11:41 +00:00
|
|
|
BOOL valid_handle;
|
2006-01-15 22:25:16 +00:00
|
|
|
DWORD dwFlags;
|
2007-11-29 12:52:01 +00:00
|
|
|
DWORD_PTR dwContext;
|
2006-01-15 22:25:16 +00:00
|
|
|
DWORD dwError;
|
2010-05-29 13:41:35 +00:00
|
|
|
ULONG ErrorMask;
|
2006-01-15 22:25:16 +00:00
|
|
|
DWORD dwInternalFlags;
|
2008-05-31 13:02:59 +00:00
|
|
|
LONG refs;
|
2006-01-15 22:25:16 +00:00
|
|
|
INTERNET_STATUS_CALLBACK lpfnStatusCB;
|
2007-11-29 12:52:01 +00:00
|
|
|
struct list entry;
|
|
|
|
struct list children;
|
2006-01-15 22:25:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2010-03-15 11:35:51 +00:00
|
|
|
object_header_t hdr;
|
2011-06-05 23:11:41 +00:00
|
|
|
LPWSTR agent;
|
|
|
|
LPWSTR proxy;
|
|
|
|
LPWSTR proxyBypass;
|
|
|
|
LPWSTR proxyUsername;
|
|
|
|
LPWSTR proxyPassword;
|
|
|
|
DWORD accessType;
|
2013-05-20 21:42:26 +00:00
|
|
|
DWORD connect_timeout;
|
2010-03-15 11:35:51 +00:00
|
|
|
} appinfo_t;
|
2006-01-15 22:25:16 +00:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2010-03-15 11:35:51 +00:00
|
|
|
object_header_t hdr;
|
2011-06-05 23:11:41 +00:00
|
|
|
appinfo_t *appInfo;
|
|
|
|
LPWSTR hostName; /* the final destination of the request */
|
|
|
|
LPWSTR userName;
|
|
|
|
LPWSTR password;
|
|
|
|
INTERNET_PORT hostPort; /* the final destination port of the request */
|
2012-06-20 13:50:00 +00:00
|
|
|
DWORD connect_timeout;
|
|
|
|
DWORD send_timeout;
|
|
|
|
DWORD receive_timeout;
|
2010-03-15 11:35:51 +00:00
|
|
|
} http_session_t;
|
2006-01-15 22:25:16 +00:00
|
|
|
|
|
|
|
#define HDR_ISREQUEST 0x0001
|
|
|
|
#define HDR_COMMADELIMITED 0x0002
|
|
|
|
#define HDR_SEMIDELIMITED 0x0004
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
LPWSTR lpszField;
|
|
|
|
LPWSTR lpszValue;
|
|
|
|
WORD wFlags;
|
|
|
|
WORD wCount;
|
|
|
|
} HTTPHEADERW, *LPHTTPHEADERW;
|
|
|
|
|
|
|
|
|
2007-11-29 12:52:01 +00:00
|
|
|
struct HttpAuthInfo;
|
|
|
|
|
2011-06-05 23:11:41 +00:00
|
|
|
typedef struct data_stream_vtbl_t data_stream_vtbl_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
const data_stream_vtbl_t *vtbl;
|
|
|
|
} data_stream_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
data_stream_t data_stream;
|
|
|
|
DWORD content_length;
|
|
|
|
DWORD content_read;
|
|
|
|
} netconn_stream_t;
|
|
|
|
|
|
|
|
#define READ_BUFFER_SIZE 8192
|
2010-03-15 11:35:51 +00:00
|
|
|
|
2006-01-15 22:25:16 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2010-03-15 11:35:51 +00:00
|
|
|
object_header_t hdr;
|
2011-06-05 23:11:41 +00:00
|
|
|
http_session_t *session;
|
2013-05-20 21:42:26 +00:00
|
|
|
server_t *server;
|
|
|
|
server_t *proxy;
|
2011-06-05 23:11:41 +00:00
|
|
|
LPWSTR path;
|
|
|
|
LPWSTR verb;
|
|
|
|
netconn_t *netconn;
|
|
|
|
DWORD security_flags;
|
2012-06-20 13:50:00 +00:00
|
|
|
DWORD connect_timeout;
|
|
|
|
DWORD send_timeout;
|
|
|
|
DWORD receive_timeout;
|
2011-06-05 23:11:41 +00:00
|
|
|
LPWSTR version;
|
2012-06-20 13:50:00 +00:00
|
|
|
DWORD status_code;
|
2011-06-05 23:11:41 +00:00
|
|
|
LPWSTR statusText;
|
|
|
|
DWORD bytesToWrite;
|
|
|
|
DWORD bytesWritten;
|
|
|
|
HTTPHEADERW *custHeaders;
|
2006-01-15 22:25:16 +00:00
|
|
|
DWORD nCustHeaders;
|
2011-06-05 23:11:41 +00:00
|
|
|
FILETIME last_modified;
|
2008-05-31 13:02:59 +00:00
|
|
|
HANDLE hCacheFile;
|
2011-06-05 23:11:41 +00:00
|
|
|
LPWSTR cacheFile;
|
|
|
|
FILETIME expires;
|
|
|
|
struct HttpAuthInfo *authInfo;
|
|
|
|
struct HttpAuthInfo *proxyAuthInfo;
|
2010-03-15 11:35:51 +00:00
|
|
|
|
|
|
|
CRITICAL_SECTION read_section; /* section to protect the following fields */
|
2011-06-05 23:11:41 +00:00
|
|
|
DWORD contentLength; /* total number of bytes to be read */
|
2010-03-15 11:35:51 +00:00
|
|
|
BOOL read_chunked; /* are we reading in chunked mode? */
|
2011-06-05 23:11:41 +00:00
|
|
|
BOOL read_gzip; /* are we reading in gzip mode? */
|
2010-03-15 11:35:51 +00:00
|
|
|
DWORD read_pos; /* current read position in read_buf */
|
|
|
|
DWORD read_size; /* valid data size in read_buf */
|
2011-06-05 23:11:41 +00:00
|
|
|
BYTE read_buf[READ_BUFFER_SIZE]; /* buffer for already read but not returned data */
|
2010-03-15 11:35:51 +00:00
|
|
|
|
|
|
|
BOOL decoding;
|
2011-06-05 23:11:41 +00:00
|
|
|
data_stream_t *data_stream;
|
|
|
|
netconn_stream_t netconn_stream;
|
2010-03-15 11:35:51 +00:00
|
|
|
} http_request_t;
|
2006-01-15 22:25:16 +00:00
|
|
|
|
2013-05-20 21:42:26 +00:00
|
|
|
typedef struct task_header_t task_header_t;
|
|
|
|
typedef void (*async_task_proc_t)(task_header_t*);
|
2006-01-15 22:25:16 +00:00
|
|
|
|
2013-05-20 21:42:26 +00:00
|
|
|
struct task_header_t
|
2006-01-15 22:25:16 +00:00
|
|
|
{
|
2013-05-20 21:42:26 +00:00
|
|
|
async_task_proc_t proc;
|
2010-03-15 11:35:51 +00:00
|
|
|
object_header_t *hdr;
|
2013-05-20 21:42:26 +00:00
|
|
|
};
|
2006-01-15 22:25:16 +00:00
|
|
|
|
2013-05-20 21:42:26 +00:00
|
|
|
void *alloc_async_task(object_header_t*,async_task_proc_t,size_t) DECLSPEC_HIDDEN;
|
2006-01-15 22:25:16 +00:00
|
|
|
|
2011-06-05 23:11:41 +00:00
|
|
|
void *alloc_object(object_header_t*,const object_vtbl_t*,size_t) DECLSPEC_HIDDEN;
|
|
|
|
object_header_t *get_handle_object( HINTERNET hinternet ) DECLSPEC_HIDDEN;
|
|
|
|
object_header_t *WININET_AddRef( object_header_t *info ) DECLSPEC_HIDDEN;
|
|
|
|
BOOL WININET_Release( object_header_t *info ) DECLSPEC_HIDDEN;
|
2006-01-15 22:25:16 +00:00
|
|
|
|
2012-06-20 13:50:00 +00:00
|
|
|
DWORD INET_QueryOption(object_header_t*,DWORD,void*,DWORD*,BOOL) DECLSPEC_HIDDEN;
|
|
|
|
DWORD INET_SetOption(object_header_t*,DWORD,void*,DWORD) DECLSPEC_HIDDEN;
|
2008-09-04 18:37:34 +00:00
|
|
|
|
2011-06-05 23:11:41 +00:00
|
|
|
time_t ConvertTimeString(LPCWSTR asctime) DECLSPEC_HIDDEN;
|
2006-01-15 22:25:16 +00:00
|
|
|
|
2010-03-15 11:35:51 +00:00
|
|
|
HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName,
|
2006-01-15 22:25:16 +00:00
|
|
|
INTERNET_PORT nServerPort, LPCWSTR lpszUserName,
|
2007-11-29 12:52:01 +00:00
|
|
|
LPCWSTR lpszPassword, DWORD dwFlags, DWORD_PTR dwContext,
|
2011-06-05 23:11:41 +00:00
|
|
|
DWORD dwInternalFlags) DECLSPEC_HIDDEN;
|
2006-01-15 22:25:16 +00:00
|
|
|
|
2010-03-15 11:35:51 +00:00
|
|
|
DWORD HTTP_Connect(appinfo_t*,LPCWSTR,
|
|
|
|
INTERNET_PORT nServerPort, LPCWSTR lpszUserName,
|
|
|
|
LPCWSTR lpszPassword, DWORD dwFlags, DWORD_PTR dwContext,
|
2011-06-05 23:11:41 +00:00
|
|
|
DWORD dwInternalFlags, HINTERNET*) DECLSPEC_HIDDEN;
|
2006-01-15 22:25:16 +00:00
|
|
|
|
|
|
|
BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
|
2011-06-05 23:11:41 +00:00
|
|
|
struct sockaddr *psa, socklen_t *sa_len) DECLSPEC_HIDDEN;
|
|
|
|
|
2013-05-20 21:42:26 +00:00
|
|
|
DWORD get_cookie(const WCHAR*,const WCHAR*,WCHAR*,DWORD*) DECLSPEC_HIDDEN;
|
2011-06-05 23:11:41 +00:00
|
|
|
BOOL set_cookie(const WCHAR*,const WCHAR*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN;
|
2006-01-15 22:25:16 +00:00
|
|
|
|
2011-06-05 23:11:41 +00:00
|
|
|
void INTERNET_SetLastError(DWORD dwError) DECLSPEC_HIDDEN;
|
|
|
|
DWORD INTERNET_GetLastError(void) DECLSPEC_HIDDEN;
|
2013-05-20 21:42:26 +00:00
|
|
|
DWORD INTERNET_AsyncCall(task_header_t*) DECLSPEC_HIDDEN;
|
2011-06-05 23:11:41 +00:00
|
|
|
LPSTR INTERNET_GetResponseBuffer(void) DECLSPEC_HIDDEN;
|
|
|
|
LPSTR INTERNET_GetNextLine(INT nSocket, LPDWORD dwLen) DECLSPEC_HIDDEN;
|
2006-01-15 22:25:16 +00:00
|
|
|
|
2010-03-15 11:35:51 +00:00
|
|
|
VOID SendAsyncCallback(object_header_t *hdr, DWORD_PTR dwContext,
|
2006-01-15 22:25:16 +00:00
|
|
|
DWORD dwInternetStatus, LPVOID lpvStatusInfo,
|
2011-06-05 23:11:41 +00:00
|
|
|
DWORD dwStatusInfoLength) DECLSPEC_HIDDEN;
|
2006-01-15 22:25:16 +00:00
|
|
|
|
2010-03-15 11:35:51 +00:00
|
|
|
VOID INTERNET_SendCallback(object_header_t *hdr, DWORD_PTR dwContext,
|
2006-01-15 22:25:16 +00:00
|
|
|
DWORD dwInternetStatus, LPVOID lpvStatusInfo,
|
2011-06-05 23:11:41 +00:00
|
|
|
DWORD dwStatusInfoLength) DECLSPEC_HIDDEN;
|
|
|
|
BOOL INTERNET_FindProxyForProtocol(LPCWSTR szProxy, LPCWSTR proto, WCHAR *foundProxy, DWORD *foundProxyLen) DECLSPEC_HIDDEN;
|
|
|
|
|
2013-05-20 21:42:26 +00:00
|
|
|
DWORD create_netconn(BOOL,server_t*,DWORD,BOOL,DWORD,netconn_t**) DECLSPEC_HIDDEN;
|
2011-06-05 23:11:41 +00:00
|
|
|
void free_netconn(netconn_t*) DECLSPEC_HIDDEN;
|
|
|
|
void NETCON_unload(void) DECLSPEC_HIDDEN;
|
2013-05-20 21:42:26 +00:00
|
|
|
DWORD NETCON_secure_connect(netconn_t*,server_t*) DECLSPEC_HIDDEN;
|
2011-06-05 23:11:41 +00:00
|
|
|
DWORD NETCON_send(netconn_t *connection, const void *msg, size_t len, int flags,
|
|
|
|
int *sent /* out */) DECLSPEC_HIDDEN;
|
|
|
|
DWORD NETCON_recv(netconn_t *connection, void *buf, size_t len, int flags,
|
|
|
|
int *recvd /* out */) DECLSPEC_HIDDEN;
|
|
|
|
BOOL NETCON_query_data_available(netconn_t *connection, DWORD *available) DECLSPEC_HIDDEN;
|
|
|
|
BOOL NETCON_is_alive(netconn_t*) DECLSPEC_HIDDEN;
|
|
|
|
LPCVOID NETCON_GetCert(netconn_t *connection) DECLSPEC_HIDDEN;
|
|
|
|
int NETCON_GetCipherStrength(netconn_t*) DECLSPEC_HIDDEN;
|
2012-06-20 13:50:00 +00:00
|
|
|
DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, DWORD value) DECLSPEC_HIDDEN;
|
2012-06-20 12:24:12 +00:00
|
|
|
#ifndef __REACTOS__
|
|
|
|
int sock_get_error(int) DECLSPEC_HIDDEN;
|
|
|
|
#else
|
2010-10-09 18:40:16 +00:00
|
|
|
#define sock_get_error(x) WSAGetLastError()
|
2012-06-20 15:10:50 +00:00
|
|
|
const char *inet_ntop(int, const void *, char *, socklen_t);
|
|
|
|
|
|
|
|
static inline long unix_recv(int socket, void *buffer, size_t length, int flags)
|
|
|
|
{
|
|
|
|
return recv(socket, buffer, length, flags);
|
|
|
|
}
|
|
|
|
#define recv unix_recv
|
|
|
|
|
|
|
|
static inline int unix_ioctl(int filedes, long request, void *arg)
|
|
|
|
{
|
|
|
|
return ioctlsocket(filedes, request, arg);
|
|
|
|
}
|
|
|
|
#define ioctlsocket unix_ioctl
|
|
|
|
|
|
|
|
static inline int unix_getsockopt(int socket, int level, int option_name, void *option_value, socklen_t *option_len)
|
|
|
|
{
|
|
|
|
return getsockopt(socket, level, option_name, option_value, option_len);
|
|
|
|
}
|
|
|
|
#define getsockopt unix_getsockopt
|
2012-06-20 12:24:12 +00:00
|
|
|
#endif
|
2006-01-15 22:25:16 +00:00
|
|
|
|
2013-05-20 21:42:26 +00:00
|
|
|
server_t *get_server(const WCHAR*,INTERNET_PORT,BOOL,BOOL);
|
|
|
|
|
|
|
|
BOOL init_urlcache(void) DECLSPEC_HIDDEN;
|
|
|
|
void free_urlcache(void) DECLSPEC_HIDDEN;
|
|
|
|
void free_cookie(void) DECLSPEC_HIDDEN;
|
2006-01-15 22:25:16 +00:00
|
|
|
|
|
|
|
#define MAX_REPLY_LEN 0x5B4
|
|
|
|
|
|
|
|
/* Used for debugging - maybe need to be shared in the Wine debugging code ? */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
DWORD val;
|
|
|
|
const char* name;
|
|
|
|
} wininet_flag_info;
|
|
|
|
|
2013-05-20 21:42:26 +00:00
|
|
|
/* Undocumented security flags */
|
|
|
|
#define _SECURITY_FLAG_CERT_REV_FAILED 0x00800000
|
|
|
|
#define _SECURITY_FLAG_CERT_INVALID_CA 0x01000000
|
|
|
|
#define _SECURITY_FLAG_CERT_INVALID_CN 0x02000000
|
|
|
|
#define _SECURITY_FLAG_CERT_INVALID_DATE 0x04000000
|
|
|
|
|
|
|
|
#define _SECURITY_ERROR_FLAGS_MASK \
|
|
|
|
(_SECURITY_FLAG_CERT_REV_FAILED \
|
|
|
|
|_SECURITY_FLAG_CERT_INVALID_CA \
|
|
|
|
|_SECURITY_FLAG_CERT_INVALID_CN \
|
|
|
|
|_SECURITY_FLAG_CERT_INVALID_DATE)
|
|
|
|
|
2006-01-15 22:25:16 +00:00
|
|
|
#endif /* _WINE_INTERNET_H_ */
|