ReactOS  0.4.14-dev-297-g23e575c
internet.h File Reference
#include "wine/unicode.h"
#include "wine/heap.h"
#include "wine/list.h"
#include <time.h>
#include "winineti.h"
Include dependency graph for internet.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  server_t
 
struct  netconn_t
 
struct  substr_t
 
struct  req_file_t
 
struct  object_vtbl_t
 
struct  _object_header_t
 
struct  appinfo_t
 
struct  http_session_t
 
struct  HTTPHEADERW
 
struct  data_stream_t
 
struct  netconn_stream_t
 
struct  http_request_t
 
struct  task_header_t
 
struct  wininet_flag_info
 

Macros

#define INET_OPENURL   0x0001
 
#define INET_CALLBACKW   0x0002
 
#define INTERNET_HANDLE_IN_USE   1
 
#define HDR_ISREQUEST   0x0001
 
#define HDR_COMMADELIMITED   0x0002
 
#define HDR_SEMIDELIMITED   0x0004
 
#define READ_BUFFER_SIZE   8192
 
#define MAX_REPLY_LEN   0x5B4
 
#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
 

Typedefs

typedef struct _object_header_t object_header_t
 
typedef struct HTTPHEADERWLPHTTPHEADERW
 
typedef struct data_stream_vtbl_t data_stream_vtbl_t
 
typedef struct task_header_t task_header_t
 
typedef void(* async_task_proc_t) (task_header_t *)
 

Enumerations

enum  collect_type_t { COLLECT_TIMEOUT, COLLECT_CONNECTIONS, COLLECT_CLEANUP }
 
enum  WH_TYPE {
  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, WH_HFTPFINDNEXT = INTERNET_HANDLE_TYPE_FTP_FIND, WH_HHTTPREQ = INTERNET_HANDLE_TYPE_HTTP_REQUEST
}
 

Functions

void server_addref (server_t *) DECLSPEC_HIDDEN
 
void server_release (server_t *) DECLSPEC_HIDDEN
 
BOOL collect_connections (collect_type_t) DECLSPEC_HIDDEN
 
BOOL is_valid_netconn (netconn_t *) DECLSPEC_HIDDEN
 
void close_netconn (netconn_t *) DECLSPEC_HIDDEN
 
static void__WINE_ALLOC_SIZE (2) heap_realloc_zero(void *mem
 
static LPWSTR heap_strdupW (LPCWSTR str)
 
static charheap_strdupA (const char *str)
 
static LPWSTR heap_strndupW (LPCWSTR str, UINT max_len)
 
static WCHARheap_strndupAtoW (const char *str, int len_a, DWORD *len_w)
 
static WCHARheap_strdupAtoW (const char *str)
 
static charheap_strdupWtoA (LPCWSTR str)
 
static substr_t substr (const WCHAR *str, size_t len)
 
static substr_t substrz (const WCHAR *str)
 
static void WININET_find_data_WtoA (LPWIN32_FIND_DATAW dataW, LPWIN32_FIND_DATAA dataA)
 
voidalloc_async_task (object_header_t *, async_task_proc_t, size_t) DECLSPEC_HIDDEN
 
voidalloc_object (object_header_t *, const object_vtbl_t *, size_t) DECLSPEC_HIDDEN
 
object_header_tget_handle_object (HINTERNET hinternet) DECLSPEC_HIDDEN
 
object_header_tWININET_AddRef (object_header_t *info) DECLSPEC_HIDDEN
 
BOOL WININET_Release (object_header_t *info) DECLSPEC_HIDDEN
 
DWORD INET_QueryOption (object_header_t *, DWORD, void *, DWORD *, BOOL) DECLSPEC_HIDDEN
 
DWORD INET_SetOption (object_header_t *, DWORD, void *, DWORD) DECLSPEC_HIDDEN
 
time_t ConvertTimeString (LPCWSTR asctime) DECLSPEC_HIDDEN
 
HINTERNET FTP_Connect (appinfo_t *hIC, LPCWSTR lpszServerName, INTERNET_PORT nServerPort, LPCWSTR lpszUserName, LPCWSTR lpszPassword, DWORD dwFlags, DWORD_PTR dwContext, DWORD dwInternalFlags) DECLSPEC_HIDDEN
 
DWORD HTTP_Connect (appinfo_t *, LPCWSTR, INTERNET_PORT nServerPort, LPCWSTR lpszUserName, LPCWSTR lpszPassword, DWORD dwFlags, DWORD_PTR dwContext, DWORD dwInternalFlags, HINTERNET *) DECLSPEC_HIDDEN
 
BOOL GetAddress (const WCHAR *, INTERNET_PORT, SOCKADDR *, int *, char *) DECLSPEC_HIDDEN
 
DWORD get_cookie_header (const WCHAR *, const WCHAR *, WCHAR **) DECLSPEC_HIDDEN
 
DWORD set_cookie (substr_t, substr_t, substr_t, substr_t, DWORD) DECLSPEC_HIDDEN
 
void INTERNET_SetLastError (DWORD dwError) DECLSPEC_HIDDEN
 
DWORD INTERNET_GetLastError (void) DECLSPEC_HIDDEN
 
DWORD INTERNET_AsyncCall (task_header_t *) DECLSPEC_HIDDEN
 
LPSTR INTERNET_GetResponseBuffer (void) DECLSPEC_HIDDEN
 
VOID INTERNET_SendCallback (object_header_t *hdr, DWORD_PTR dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInfo, DWORD dwStatusInfoLength) DECLSPEC_HIDDEN
 
WCHARINTERNET_FindProxyForProtocol (LPCWSTR szProxy, LPCWSTR proto) DECLSPEC_HIDDEN
 
DWORD create_netconn (BOOL, server_t *, DWORD, BOOL, DWORD, netconn_t **) DECLSPEC_HIDDEN
 
void free_netconn (netconn_t *) DECLSPEC_HIDDEN
 
void NETCON_unload (void) DECLSPEC_HIDDEN
 
DWORD NETCON_secure_connect (netconn_t *, server_t *) DECLSPEC_HIDDEN
 
DWORD NETCON_send (netconn_t *connection, const void *msg, size_t len, int flags, int *sent) DECLSPEC_HIDDEN
 
DWORD NETCON_recv (netconn_t *, void *, size_t, BOOL, int *) 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
 
DWORD NETCON_set_timeout (netconn_t *connection, BOOL send, DWORD value) DECLSPEC_HIDDEN
 
int sock_send (int fd, const void *msg, size_t len, int flags) DECLSPEC_HIDDEN
 
int sock_recv (int fd, void *msg, size_t len, int flags) DECLSPEC_HIDDEN
 
server_tget_server (substr_t, INTERNET_PORT, BOOL, BOOL) DECLSPEC_HIDDEN
 
DWORD create_req_file (const WCHAR *, req_file_t **) DECLSPEC_HIDDEN
 
void req_file_release (req_file_t *) DECLSPEC_HIDDEN
 
static req_file_treq_file_addref (req_file_t *req_file)
 
BOOL init_urlcache (void) DECLSPEC_HIDDEN
 
void free_urlcache (void) DECLSPEC_HIDDEN
 
void free_cookie (void) DECLSPEC_HIDDEN
 
void init_winsock (void) DECLSPEC_HIDDEN
 

Variables

HMODULE WININET_hModule DECLSPEC_HIDDEN
 
static void size_t len
 

Macro Definition Documentation

◆ _SECURITY_ERROR_FLAGS_MASK

#define _SECURITY_ERROR_FLAGS_MASK
Value:
#define _SECURITY_FLAG_CERT_INVALID_CN
Definition: internet.h:474
#define _SECURITY_FLAG_CERT_INVALID_DATE
Definition: internet.h:475
#define _SECURITY_FLAG_CERT_INVALID_CA
Definition: internet.h:473
#define _SECURITY_FLAG_CERT_REV_FAILED
Definition: internet.h:472

Definition at line 477 of file internet.h.

◆ _SECURITY_FLAG_CERT_INVALID_CA

#define _SECURITY_FLAG_CERT_INVALID_CA   0x01000000

Definition at line 473 of file internet.h.

◆ _SECURITY_FLAG_CERT_INVALID_CN

#define _SECURITY_FLAG_CERT_INVALID_CN   0x02000000

Definition at line 474 of file internet.h.

◆ _SECURITY_FLAG_CERT_INVALID_DATE

#define _SECURITY_FLAG_CERT_INVALID_DATE   0x04000000

Definition at line 475 of file internet.h.

◆ _SECURITY_FLAG_CERT_REV_FAILED

#define _SECURITY_FLAG_CERT_REV_FAILED   0x00800000

Definition at line 472 of file internet.h.

◆ HDR_COMMADELIMITED

#define HDR_COMMADELIMITED   0x0002

Definition at line 316 of file internet.h.

◆ HDR_ISREQUEST

#define HDR_ISREQUEST   0x0001

Definition at line 315 of file internet.h.

◆ HDR_SEMIDELIMITED

#define HDR_SEMIDELIMITED   0x0004

Definition at line 317 of file internet.h.

◆ INET_CALLBACKW

#define INET_CALLBACKW   0x0002

Definition at line 245 of file internet.h.

◆ INET_OPENURL

#define INET_OPENURL   0x0001

Definition at line 244 of file internet.h.

◆ INTERNET_HANDLE_IN_USE

#define INTERNET_HANDLE_IN_USE   1

Definition at line 270 of file internet.h.

◆ MAX_REPLY_LEN

#define MAX_REPLY_LEN   0x5B4

Definition at line 462 of file internet.h.

◆ READ_BUFFER_SIZE

#define READ_BUFFER_SIZE   8192

Definition at line 342 of file internet.h.

Typedef Documentation

◆ async_task_proc_t

typedef void(* async_task_proc_t) (task_header_t *)

Definition at line 386 of file internet.h.

◆ data_stream_vtbl_t

Definition at line 330 of file internet.h.

◆ LPHTTPHEADERW

◆ object_header_t

Definition at line 256 of file internet.h.

◆ task_header_t

Definition at line 385 of file internet.h.

Enumeration Type Documentation

◆ collect_type_t

Enumerator
COLLECT_TIMEOUT 
COLLECT_CONNECTIONS 
COLLECT_CLEANUP 

Definition at line 60 of file internet.h.

◆ WH_TYPE

Enumerator
WH_HINIT 
WH_HFTPSESSION 
WH_HGOPHERSESSION 
WH_HHTTPSESSION 
WH_HFILE 
WH_HFTPFINDNEXT 
WH_HHTTPREQ 

Definition at line 233 of file internet.h.

234 {
242 } WH_TYPE;
#define INTERNET_HANDLE_TYPE_CONNECT_GOPHER
Definition: wininet.h:804
WH_TYPE
Definition: internet.h:233
#define INTERNET_HANDLE_TYPE_FTP_FILE
Definition: wininet.h:808
#define INTERNET_HANDLE_TYPE_CONNECT_FTP
Definition: wininet.h:803
#define INTERNET_HANDLE_TYPE_HTTP_REQUEST
Definition: wininet.h:814
#define INTERNET_HANDLE_TYPE_INTERNET
Definition: wininet.h:802
#define INTERNET_HANDLE_TYPE_CONNECT_HTTP
Definition: wininet.h:805
#define INTERNET_HANDLE_TYPE_FTP_FIND
Definition: wininet.h:806

Function Documentation

◆ __WINE_ALLOC_SIZE()

static void* __WINE_ALLOC_SIZE ( )
inlinestatic

◆ alloc_async_task()

void* alloc_async_task ( object_header_t ,
async_task_proc_t  ,
size_t   
)

Definition at line 3780 of file internet.c.

3781 {
3782  task_header_t *task;
3783 
3784  task = heap_alloc(size);
3785  if(!task)
3786  return NULL;
3787 
3788  task->hdr = WININET_AddRef(hdr);
3789  task->proc = proc;
3790  return task;
3791 }
char hdr[14]
Definition: iptest.cpp:33
static HANDLE proc()
Definition: pdb.c:32
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
smooth NULL
Definition: ftsmooth.c:416
object_header_t * WININET_AddRef(object_header_t *info)
Definition: internet.c:178
GLsizeiptr size
Definition: glext.h:5919
object_header_t * hdr
Definition: internet.h:391
async_task_proc_t proc
Definition: internet.h:390

Referenced by async_read(), FtpCreateDirectoryW(), FtpDeleteFileW(), FTPFILE_QueryDataAvailable(), FtpFindFirstFileW(), FTPFINDNEXT_FindNextFileW(), FtpGetCurrentDirectoryW(), FtpGetFileW(), FtpOpenFileW(), FtpPutFileW(), FtpRemoveDirectoryW(), FtpRenameFileW(), FtpSetCurrentDirectoryW(), HttpEndRequestW(), HttpSendRequestExW(), HttpSendRequestW(), and InternetOpenUrlW().

◆ alloc_object()

void* alloc_object ( object_header_t ,
const object_vtbl_t ,
size_t   
)

Definition at line 112 of file internet.c.

113 {
114  UINT_PTR handle = 0, num;
116  object_header_t **p;
117  BOOL res = TRUE;
118 
119  ret = heap_alloc_zero(size);
120  if(!ret)
121  return NULL;
122 
123  list_init(&ret->children);
124 
126 
127  if(!handle_table_size) {
128  num = 16;
129  p = heap_alloc_zero(sizeof(handle_table[0]) * num);
130  if(p) {
131  handle_table = p;
133  next_handle = 1;
134  }else {
135  res = FALSE;
136  }
137  }else if(next_handle == handle_table_size) {
138  num = handle_table_size * 2;
139  p = heap_realloc_zero(handle_table, sizeof(handle_table[0]) * num);
140  if(p) {
141  handle_table = p;
143  }else {
144  res = FALSE;
145  }
146  }
147 
148  if(res) {
150  if(handle_table[handle])
151  ERR("handle isn't free but should be\n");
153  ret->valid_handle = TRUE;
154 
156  next_handle++;
157  }
158 
160 
161  if(!res) {
162  heap_free(ret);
163  return NULL;
164  }
165 
166  ret->vtbl = vtbl;
167  ret->refs = 1;
168  ret->hInternet = (HINTERNET)handle;
169 
170  if(parent) {
171  ret->lpfnStatusCB = parent->lpfnStatusCB;
172  ret->dwInternalFlags = parent->dwInternalFlags & INET_CALLBACKW;
173  }
174 
175  return ret;
176 }
LPVOID HINTERNET
Definition: winhttp.h:32
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define TRUE
Definition: types.h:120
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define INET_CALLBACKW
Definition: internet.h:245
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
static UINT_PTR next_handle
Definition: internet.c:89
GLsizeiptr size
Definition: glext.h:5919
r parent
Definition: btrfs.c:2897
static UINT_PTR handle_table_size
Definition: internet.c:90
static CRITICAL_SECTION WININET_cs
Definition: internet.c:79
GLuint GLuint num
Definition: glext.h:9618
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
int ret
#define ERR(fmt,...)
Definition: debug.h:109
GLuint res
Definition: glext.h:9613
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
GLfloat GLfloat p
Definition: glext.h:8902
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FTP_Connect(), FTP_FtpOpenFileW(), FTP_ReceiveFileList(), HTTP_Connect(), HTTP_HttpOpenRequestW(), and InternetOpenW().

◆ close_netconn()

void close_netconn ( netconn_t )

Definition at line 375 of file netconnection.c.

376 {
377  closesocket(netconn->socket);
378  netconn->socket = -1;
379 }
#define closesocket

Referenced by free_netconn(), and http_release_netconn().

◆ collect_connections()

BOOL collect_connections ( collect_type_t  )

Definition at line 313 of file http.c.

314 {
315  netconn_t *netconn, *netconn_safe;
316  server_t *server, *server_safe;
317  BOOL remaining = FALSE;
318  DWORD64 now;
319 
320 #ifdef __REACTOS__
321  now = GetTickCount();
322 #else
323  now = GetTickCount64();
324 #endif
325 
327  LIST_FOR_EACH_ENTRY_SAFE(netconn, netconn_safe, &server->conn_pool, netconn_t, pool_entry) {
328  if(collect_type > COLLECT_TIMEOUT || netconn->keep_until < now) {
329  TRACE("freeing %p\n", netconn);
330  list_remove(&netconn->pool_entry);
331  free_netconn(netconn);
332  }else {
333  remaining = TRUE;
334  }
335  }
336 
337  if(collect_type == COLLECT_CLEANUP) {
338  list_remove(&server->entry);
339  list_init(&server->entry);
341  }
342  }
343 
344  return remaining;
345 }
#define TRUE
Definition: types.h:120
static rfbScreenInfoPtr server
Definition: vnc.c:74
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
void server_release(server_t *server)
Definition: http.c:229
ULONGLONG WINAPI GetTickCount64(VOID)
Definition: GetTickCount64.c:9
unsigned int BOOL
Definition: ntddk_ex.h:94
struct list pool_entry
Definition: internet.h:87
time_t now
Definition: finger.c:65
void free_netconn(netconn_t *) DECLSPEC_HIDDEN
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
uint32_t entry
Definition: isohybrid.c:63
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
uint64_t DWORD64
Definition: typedefs.h:65
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
ULONGLONG keep_until
static struct list connection_pool
Definition: http.c:221

Referenced by collect_connections_proc(), DllMain(), and INET_SetOption().

◆ ConvertTimeString()

time_t ConvertTimeString ( LPCWSTR  asctime)

Definition at line 49 of file utility.c.

50 {
51  WCHAR tmpChar[TIME_STRING_LEN];
52  WCHAR *tmpChar2;
53  struct tm t;
54  int timelen = strlenW(asctime);
55 
56  if(!timelen)
57  return 0;
58 
59  /* FIXME: the atoiWs below rely on that tmpChar is \0 padded */
60  memset( tmpChar, 0, sizeof(tmpChar) );
62 
63  /* Assert that the string is the expected length */
64  if (strlenW(asctime) >= TIME_STRING_LEN) FIXME("\n");
65 
66  /* Convert a time such as 'Mon, 15 Nov 1999 16:09:35 GMT' into a SYSTEMTIME structure
67  * We assume the time is in this format
68  * and divide it into easy to swallow chunks
69  */
70  tmpChar[3]='\0';
71  tmpChar[7]='\0';
72  tmpChar[11]='\0';
73  tmpChar[16]='\0';
74  tmpChar[19]='\0';
75  tmpChar[22]='\0';
76  tmpChar[25]='\0';
77 
78  memset( &t, 0, sizeof(t) );
79  t.tm_year = atoiW(tmpChar+12) - 1900;
80  t.tm_mday = atoiW(tmpChar+5);
81  t.tm_hour = atoiW(tmpChar+17);
82  t.tm_min = atoiW(tmpChar+20);
83  t.tm_sec = atoiW(tmpChar+23);
84 
85  /* and month */
86  tmpChar2 = tmpChar + 8;
87  switch(tmpChar2[2])
88  {
89  case 'n':
90  if(tmpChar2[1]=='a')
91  t.tm_mon = 0;
92  else
93  t.tm_mon = 5;
94  break;
95  case 'b':
96  t.tm_mon = 1;
97  break;
98  case 'r':
99  if(tmpChar2[1]=='a')
100  t.tm_mon = 2;
101  else
102  t.tm_mon = 3;
103  break;
104  case 'y':
105  t.tm_mon = 4;
106  break;
107  case 'l':
108  t.tm_mon = 6;
109  break;
110  case 'g':
111  t.tm_mon = 7;
112  break;
113  case 'p':
114  t.tm_mon = 8;
115  break;
116  case 't':
117  t.tm_mon = 9;
118  break;
119  case 'v':
120  t.tm_mon = 10;
121  break;
122  case 'c':
123  t.tm_mon = 11;
124  break;
125  default:
126  FIXME("\n");
127  }
128 
129  return mktime(&t);
130 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
GLdouble GLdouble t
Definition: gl.h:2047
_Check_return_ _CRTIMP char *__cdecl asctime(_In_ const struct tm *_Tm)
#define lstrcpynW
Definition: compat.h:397
#define FIXME(fmt,...)
Definition: debug.h:110
#define TIME_STRING_LEN
Definition: utility.c:47
__wchar_t WCHAR
Definition: xmlstorage.h:180
Definition: time.h:76
_CRTIMP time_t __cdecl mktime(struct tm *_Tm)
Definition: time.h:426
#define memset(x, y, z)
Definition: compat.h:39
WINE_UNICODE_INLINE int atoiW(const WCHAR *str)
Definition: unicode.h:315

Referenced by HTTP_HttpQueryInfoW().

◆ create_netconn()

DWORD create_netconn ( BOOL  ,
server_t ,
DWORD  ,
BOOL  ,
DWORD  ,
netconn_t **   
)

Definition at line 343 of file netconnection.c.

344 {
345  netconn_t *netconn;
346  int result;
347 
348  netconn = heap_alloc_zero(sizeof(*netconn));
349  if(!netconn)
350  return ERROR_OUTOFMEMORY;
351 
352  netconn->socket = -1;
353  netconn->security_flags = security_flags | server->security_flags;
354  netconn->mask_errors = mask_errors;
355  list_init(&netconn->pool_entry);
356  SecInvalidateHandle(&netconn->ssl_ctx);
357 
359  if (result != ERROR_SUCCESS) {
360  heap_free(netconn);
361  return result;
362  }
363 
365  netconn->server = server;
366  *ret = netconn;
367  return result;
368 }
CtxtHandle ssl_ctx
static rfbScreenInfoPtr server
Definition: vnc.c:74
#define ERROR_SUCCESS
Definition: deptool.c:10
Definition: dhcpd.h:245
#define SecInvalidateHandle(x)
Definition: sspi.h:58
struct list pool_entry
Definition: internet.h:87
DWORD security_flags
Definition: internet.h:82
int ret
void server_addref(server_t *server)
Definition: http.c:224
BOOL mask_errors
Definition: internet.h:83
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
static DWORD create_netconn_socket(server_t *server, netconn_t *netconn, DWORD timeout)
GLuint64EXT * result
Definition: glext.h:11304
server_t * server
Definition: internet.h:75
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by open_http_connection().

◆ create_req_file()

DWORD create_req_file ( const WCHAR ,
req_file_t **   
)

Definition at line 3874 of file internet.c.

3875 {
3876  req_file_t *req_file;
3877 
3878  req_file = heap_alloc_zero(sizeof(*req_file));
3879  if(!req_file)
3880  return ERROR_NOT_ENOUGH_MEMORY;
3881 
3882  req_file->ref = 1;
3883 
3884  req_file->file_name = heap_strdupW(file_name);
3885  if(!req_file->file_name) {
3886  heap_free(req_file);
3887  return ERROR_NOT_ENOUGH_MEMORY;
3888  }
3889 
3892  if(req_file->file_handle == INVALID_HANDLE_VALUE) {
3893  req_file_release(req_file);
3894  return GetLastError();
3895  }
3896 
3897  *ret = req_file;
3898  return ERROR_SUCCESS;
3899 }
void req_file_release(req_file_t *req_file)
Definition: internet.c:3901
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG ref
Definition: internet.h:249
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_SHARE_READ
Definition: compat.h:125
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: propsheet.c:178
smooth NULL
Definition: ftsmooth.c:416
HANDLE file_handle
Definition: internet.h:250
#define OPEN_EXISTING
Definition: compat.h:426
int ret
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define GENERIC_READ
Definition: compat.h:124
static LPCWSTR file_name
Definition: protocol.c:146
#define CreateFileW
Definition: compat.h:400
WCHAR * file_name
Definition: internet.h:251
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by create_cache_entry().

◆ free_cookie()

void free_cookie ( void  )

Definition at line 1263 of file cookie.c.

1264 {
1266 
1268 
1270 }
static void free_cookie_domain_list(struct list *list)
Definition: cookie.c:683
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static CRITICAL_SECTION cookie_cs
Definition: cookie.c:87
static struct list domain_list
Definition: cookie.c:95
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

◆ free_netconn()

void free_netconn ( netconn_t )

Definition at line 381 of file netconnection.c.

382 {
383  server_release(netconn->server);
384 
385  if (netconn->secure) {
386  heap_free(netconn->peek_msg_mem);
387  netconn->peek_msg_mem = NULL;
388  netconn->peek_msg = NULL;
389  netconn->peek_len = 0;
390  heap_free(netconn->ssl_buf);
391  netconn->ssl_buf = NULL;
392  heap_free(netconn->extra_buf);
393  netconn->extra_buf = NULL;
394  netconn->extra_len = 0;
395  if (SecIsValidHandle(&netconn->ssl_ctx))
396  DeleteSecurityContext(&netconn->ssl_ctx);
397  }
398 
399  close_netconn(netconn);
400  heap_free(netconn);
401 }
void close_netconn(netconn_t *netconn)
#define SecIsValidHandle(x)
Definition: sspi.h:63
void server_release(server_t *server)
Definition: http.c:229
smooth NULL
Definition: ftsmooth.c:416
SECURITY_STATUS WINAPI DeleteSecurityContext(PCtxtHandle phContext)
Definition: wrapper.c:450
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by collect_connections(), and open_http_connection().

◆ free_urlcache()

void free_urlcache ( void  )

Definition at line 4054 of file urlcache.c.

4055 {
4061 
4063 }
#define CloseHandle
Definition: compat.h:398
static HANDLE dll_unload_event
Definition: urlcache.c:2251
static void cache_containers_free(void)
Definition: urlcache.c:836
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
smooth NULL
Definition: ftsmooth.c:416
static HANDLE free_cache_running
Definition: urlcache.c:2250
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseSemaphore(IN HANDLE hSemaphore, IN LONG lReleaseCount, IN LPLONG lpPreviousCount)
Definition: synch.c:542
#define INFINITE
Definition: serial.h:102

Referenced by DllMain().

◆ FTP_Connect()

HINTERNET FTP_Connect ( appinfo_t hIC,
LPCWSTR  lpszServerName,
INTERNET_PORT  nServerPort,
LPCWSTR  lpszUserName,
LPCWSTR  lpszPassword,
DWORD  dwFlags,
DWORD_PTR  dwContext,
DWORD  dwInternalFlags 
)

Definition at line 2425 of file ftp.c.

2429 {
2430  static const WCHAR szKey[] = {'S','o','f','t','w','a','r','e','\\',
2431  'M','i','c','r','o','s','o','f','t','\\',
2432  'W','i','n','d','o','w','s','\\',
2433  'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
2434  'I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s',0};
2435  static const WCHAR szValue[] = {'E','m','a','i','l','N','a','m','e',0};
2436  static const WCHAR szDefaultUsername[] = {'a','n','o','n','y','m','o','u','s','\0'};
2437  static const WCHAR szEmpty[] = {'\0'};
2438  struct sockaddr_in socketAddr;
2439  INT nsocket = -1;
2440  socklen_t sock_namelen;
2441  BOOL bSuccess = FALSE;
2442  ftp_session_t *lpwfs = NULL;
2443  char szaddr[INET6_ADDRSTRLEN];
2444 
2445  TRACE("%p Server(%s) Port(%d) User(%s) Paswd(%s)\n",
2446  hIC, debugstr_w(lpszServerName),
2447  nServerPort, debugstr_w(lpszUserName), debugstr_w(lpszPassword));
2448 
2449  assert( hIC->hdr.htype == WH_HINIT );
2450 
2451  if ((!lpszUserName || !*lpszUserName) && lpszPassword && *lpszPassword)
2452  {
2454  return NULL;
2455  }
2456 
2457  lpwfs = alloc_object(&hIC->hdr, &FTPSESSIONVtbl, sizeof(ftp_session_t));
2458  if (NULL == lpwfs)
2459  {
2461  return NULL;
2462  }
2463 
2464  if (nServerPort == INTERNET_INVALID_PORT_NUMBER)
2466  else
2467  lpwfs->serverport = nServerPort;
2468 
2469  lpwfs->hdr.htype = WH_HFTPSESSION;
2470  lpwfs->hdr.dwFlags = dwFlags;
2471  lpwfs->hdr.dwContext = dwContext;
2472  lpwfs->hdr.dwInternalFlags |= dwInternalFlags;
2473  lpwfs->download_in_progress = NULL;
2474  lpwfs->sndSocket = -1;
2475  lpwfs->lstnSocket = -1;
2476  lpwfs->pasvSocket = -1;
2477 
2478  WININET_AddRef( &hIC->hdr );
2479  lpwfs->lpAppInfo = hIC;
2480  list_add_head( &hIC->hdr.children, &lpwfs->hdr.entry );
2481 
2482  if(hIC->proxy && hIC->accessType == INTERNET_OPEN_TYPE_PROXY) {
2483  if(strchrW(hIC->proxy, ' '))
2484  FIXME("Several proxies not implemented.\n");
2485  if(hIC->proxyBypass)
2486  FIXME("Proxy bypass is ignored.\n");
2487  }
2488  if (!lpszUserName || !lpszUserName[0]) {
2489  HKEY key;
2490  WCHAR szPassword[MAX_PATH];
2491  DWORD len = sizeof(szPassword);
2492 
2493  lpwfs->lpszUserName = heap_strdupW(szDefaultUsername);
2494 
2495  RegOpenKeyW(HKEY_CURRENT_USER, szKey, &key);
2496  if (RegQueryValueExW(key, szValue, NULL, NULL, (LPBYTE)szPassword, &len)) {
2497  /* Nothing in the registry, get the username and use that as the password */
2498  if (!GetUserNameW(szPassword, &len)) {
2499  /* Should never get here, but use an empty password as failsafe */
2500  strcpyW(szPassword, szEmpty);
2501  }
2502  }
2503  RegCloseKey(key);
2504 
2505  TRACE("Password used for anonymous ftp : (%s)\n", debugstr_w(szPassword));
2506  lpwfs->lpszPassword = heap_strdupW(szPassword);
2507  }
2508  else {
2509  lpwfs->lpszUserName = heap_strdupW(lpszUserName);
2511  }
2512  lpwfs->servername = heap_strdupW(lpszServerName);
2513 
2514  /* Don't send a handle created callback if this handle was created with InternetOpenUrl */
2515  if (!(lpwfs->hdr.dwInternalFlags & INET_OPENURL))
2516  {
2518 
2519  iar.dwResult = (DWORD_PTR)lpwfs->hdr.hInternet;
2520  iar.dwError = ERROR_SUCCESS;
2521 
2522  INTERNET_SendCallback(&hIC->hdr, dwContext,
2524  sizeof(INTERNET_ASYNC_RESULT));
2525  }
2526 
2528  (LPWSTR) lpszServerName, (strlenW(lpszServerName)+1) * sizeof(WCHAR));
2529 
2530  sock_namelen = sizeof(socketAddr);
2531  if (!GetAddress(lpszServerName, lpwfs->serverport, (struct sockaddr *)&socketAddr, &sock_namelen, szaddr))
2532  {
2534  goto lerror;
2535  }
2536 
2537  if (socketAddr.sin_family != AF_INET)
2538  {
2539  WARN("unsupported address family %d\n", socketAddr.sin_family);
2541  goto lerror;
2542  }
2543 
2545  szaddr, strlen(szaddr)+1);
2546 
2547  init_winsock();
2548  nsocket = socket(AF_INET,SOCK_STREAM,0);
2549  if (nsocket == -1)
2550  {
2552  goto lerror;
2553  }
2554 
2556  szaddr, strlen(szaddr)+1);
2557 
2558  if (connect(nsocket, (struct sockaddr *)&socketAddr, sock_namelen) < 0)
2559  {
2560  ERR("Unable to connect (%d)\n", WSAGetLastError());
2562  closesocket(nsocket);
2563  }
2564  else
2565  {
2566  TRACE("Connected to server\n");
2567  lpwfs->sndSocket = nsocket;
2569  szaddr, strlen(szaddr)+1);
2570 
2571  sock_namelen = sizeof(lpwfs->socketAddress);
2572  getsockname(nsocket, (struct sockaddr *) &lpwfs->socketAddress, &sock_namelen);
2573 
2574  if (FTP_ConnectToHost(lpwfs))
2575  {
2576  TRACE("Successfully logged into server\n");
2577  bSuccess = TRUE;
2578  }
2579  }
2580 
2581 lerror:
2582  if (!bSuccess)
2583  {
2584  if(lpwfs)
2585  WININET_Release( &lpwfs->hdr );
2586  return NULL;
2587  }
2588 
2589  return lpwfs->hdr.hInternet;
2590 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
SOCKET WSAAPI socket(IN INT af, IN INT type, IN INT protocol)
Definition: socklife.c:143
static BOOL FTP_ConnectToHost(ftp_session_t *)
Definition: ftp.c:2603
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define ERROR_SUCCESS
Definition: deptool.c:10
void INTERNET_SetLastError(DWORD dwError)
Definition: internet.c:3723
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define closesocket
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
#define HKEY_CURRENT_USER
Definition: winreg.h:11
struct sockaddr_in socketAddress
Definition: ftp.c:77
LPWSTR lpszUserName
Definition: ftp.c:82
LPWSTR servername
Definition: ftp.c:79
#define WARN(fmt,...)
Definition: debug.h:111
#define INTERNET_STATUS_CONNECTING_TO_SERVER
Definition: wininet.h:885
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
struct list children
#define INTERNET_OPEN_TYPE_PROXY
Definition: wininet.h:523
#define assert(x)
Definition: debug.h:53
ftp_file_t * download_in_progress
Definition: ftp.c:76
_In_opt_ LPSTR _In_opt_ LPSTR lpszPassword
Definition: winbase.h:2658
#define INET6_ADDRSTRLEN
Definition: request.c:1491
INT WSAAPI connect(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: sockctrl.c:23
int32_t INT
Definition: typedefs.h:56
static BOOLEAN bSuccess
Definition: drive.cpp:417
VOID INTERNET_SendCallback(object_header_t *hdr, DWORD_PTR dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInfo, DWORD dwStatusInfoLength) DECLSPEC_HIDDEN
#define INTERNET_INVALID_PORT_NUMBER
Definition: wininet.h:36
DWORD_PTR dwContext
Definition: internet.h:279
#define ERROR_INTERNET_CANNOT_CONNECT
Definition: wininet.h:2018
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL GetAddress(const WCHAR *, INTERNET_PORT, SOCKADDR *, int *, char *) DECLSPEC_HIDDEN
Definition: utility.c:133
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: propsheet.c:178
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
#define debugstr_w
Definition: kernel32.h:32
DWORD accessType
Definition: internet.h:298
#define FIXME(fmt,...)
Definition: debug.h:110
static DWORD_PTR
Definition: ftp.c:44
smooth NULL
Definition: ftsmooth.c:416
object_header_t * WININET_AddRef(object_header_t *info)
Definition: internet.c:178
int pasvSocket
Definition: ftp.c:75
#define INTERNET_STATUS_NAME_RESOLVED
Definition: wininet.h:884
static const WCHAR szEmpty[]
Definition: provider.c:50
BOOL WINAPI GetUserNameW(LPWSTR lpszName, LPDWORD lpSize)
Definition: misc.c:291
#define TRACE(s)
Definition: solgame.cpp:4
INT WSAAPI WSAGetLastError(VOID)
Definition: dllmain.c:112
object_header_t hdr
Definition: ftp.c:71
INTERNET_PORT serverport
Definition: ftp.c:80
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPWSTR lpszPassword
Definition: ftp.c:81
struct list entry
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
int socklen_t
Definition: tcp.c:35
#define ERROR_INTERNET_NAME_NOT_RESOLVED
Definition: wininet.h:1996
#define INTERNET_DEFAULT_FTP_PORT
Definition: wininet.h:38
DWORD_PTR dwResult
Definition: wininet.h:155
LPWSTR proxy
Definition: internet.h:294
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
HKEY key
Definition: reg.c:42
void * alloc_object(object_header_t *parent, const object_vtbl_t *vtbl, size_t size)
Definition: internet.c:112
GLenum GLsizei len
Definition: glext.h:6722
#define INTERNET_STATUS_RESOLVING_NAME
Definition: wininet.h:883
HINTERNET hInternet
Definition: internet.h:276
int sndSocket
Definition: ftp.c:73
BOOL WININET_Release(object_header_t *info)
Definition: internet.c:220
#define ERR(fmt,...)
Definition: debug.h:109
object_header_t hdr
Definition: internet.h:292
DWORD dwInternalFlags
Definition: internet.h:282
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
int lstnSocket
Definition: ftp.c:74
#define INET_OPENURL
Definition: internet.h:244
static const object_vtbl_t FTPSESSIONVtbl
Definition: ftp.c:2393
#define INTERNET_STATUS_CONNECTED_TO_SERVER
Definition: wininet.h:886
#define AF_INET
Definition: tcpip.h:117
#define INTERNET_STATUS_HANDLE_CREATED
Definition: wininet.h:895
#define SOCK_STREAM
Definition: tcpip.h:118
WCHAR * LPWSTR
Definition: xmlstorage.h:184
appinfo_t * lpAppInfo
Definition: ftp.c:72
LPWSTR proxyBypass
Definition: internet.h:295
WH_TYPE htype
Definition: internet.h:274
INT WSAAPI getsockname(IN SOCKET s, OUT LPSOCKADDR name, IN OUT INT FAR *namelen)
Definition: sockctrl.c:213
void init_winsock(void) DECLSPEC_HIDDEN
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
Definition: path.c:42

Referenced by INTERNET_InternetOpenUrlW(), and InternetConnectW().

◆ get_cookie_header()

DWORD get_cookie_header ( const WCHAR ,
const WCHAR ,
WCHAR **   
)

Definition at line 640 of file cookie.c.

641 {
642  cookie_set_t cookie_set = {0};
643  DWORD res;
644 
645  static const WCHAR cookieW[] = {'C','o','o','k','i','e',':',' '};
646 
648 
650  if(res != ERROR_SUCCESS) {
652  return res;
653  }
654 
655  if(cookie_set.cnt) {
656  WCHAR *header, *ptr;
657 
658  ptr = header = heap_alloc(sizeof(cookieW) + (cookie_set.string_len + 3 /* crlf0 */) * sizeof(WCHAR));
659  if(header) {
660  memcpy(ptr, cookieW, sizeof(cookieW));
661  ptr += sizeof(cookieW)/sizeof(*cookieW);
662 
663  cookie_set_to_string(&cookie_set, ptr);
664  heap_free(cookie_set.cookies);
665  ptr += cookie_set.string_len;
666 
667  *ptr++ = '\r';
668  *ptr++ = '\n';
669  *ptr++ = 0;
670 
671  *ret = header;
672  }else {
674  }
675  }else {
676  *ret = NULL;
677  }
678 
680  return res;
681 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static substr_t substrz(const WCHAR *str)
Definition: internet.h:210
char * host
Definition: whois.c:55
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
static DWORD get_cookie(substr_t host, substr_t path, DWORD flags, cookie_set_t *res)
Definition: cookie.c:527
static void cookie_set_to_string(const cookie_set_t *cookie_set, WCHAR *str)
Definition: cookie.c:613
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
static CRITICAL_SECTION cookie_cs
Definition: cookie.c:87
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
cookie_t ** cookies
Definition: cookie.c:520
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: services.c:325
unsigned string_len
Definition: cookie.c:524
GLuint res
Definition: glext.h:9613
unsigned cnt
Definition: cookie.c:521
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define INTERNET_COOKIE_HTTPONLY
Definition: wininet.h:1828
struct CFHEADER header
Definition: fdi.c:101
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by HTTP_InsertCookies().

◆ get_handle_object()

object_header_t* get_handle_object ( HINTERNET  hinternet)

Definition at line 185 of file internet.c.

186 {
188  UINT_PTR handle = (UINT_PTR) hinternet;
189 
191 
194 
196 
197  TRACE("handle %ld -> %p\n", handle, info);
198 
199  return info;
200 }
unsigned __int3264 UINT_PTR
Definition: activex.cpp:275
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
struct _test_info info[]
Definition: SetCursorPos.c:19
__inline int valid_handle(HANDLE handle)
Definition: util.h:281
smooth NULL
Definition: ftsmooth.c:416
object_header_t * WININET_AddRef(object_header_t *info)
Definition: internet.c:178
#define TRACE(s)
Definition: solgame.cpp:4
static UINT_PTR handle_table_size
Definition: internet.c:90
static CRITICAL_SECTION WININET_cs
Definition: internet.c:79
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by FtpCommandW(), FtpCreateDirectoryW(), FtpDeleteFileW(), FtpFindFirstFileW(), FtpGetCurrentDirectoryW(), FtpGetFileW(), FtpOpenFileW(), FtpPutFileW(), FtpRemoveDirectoryW(), FtpRenameFileW(), FtpSetCurrentDirectoryW(), HttpAddRequestHeadersW(), HttpEndRequestW(), HttpOpenRequestW(), HttpQueryInfoW(), HttpSendRequestExW(), HttpSendRequestW(), InternetCloseHandle(), InternetConnectW(), InternetErrorDlg(), InternetFindNextFileW(), InternetLockRequestFile(), InternetOpenUrlW(), InternetQueryDataAvailable(), InternetQueryOptionA(), InternetQueryOptionW(), InternetReadFile(), InternetReadFileExA(), InternetReadFileExW(), InternetSetOptionW(), InternetSetStatusCallbackA(), InternetSetStatusCallbackW(), and InternetWriteFile().

◆ get_server()

server_t* get_server ( substr_t  ,
INTERNET_PORT  ,
BOOL  ,
BOOL   
)

Definition at line 276 of file http.c.

277 {
278  server_t *iter, *server = NULL;
279 
281 
283  if(iter->port == port && name.len == strlenW(iter->name) && !strncmpiW(iter->name, name.str, name.len)
284  && iter->is_https == is_https) {
285  server = iter;
287  break;
288  }
289  }
290 
291  if(!server && do_create) {
292  server = heap_alloc_zero(sizeof(*server));
293  if(server) {
294  server->ref = 2; /* list reference and return */
295  server->port = port;
296  server->is_https = is_https;
297  list_init(&server->conn_pool);
298  server->name = heap_strndupW(name.str, name.len);
299  if(server->name && process_host_port(server)) {
301  }else {
302  heap_free(server);
303  server = NULL;
304  }
305  }
306  }
307 
309 
310  return server;
311 }
static BOOL process_host_port(server_t *server)
Definition: http.c:249
BOOL is_https
Definition: internet.h:39
static LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
static rfbScreenInfoPtr server
Definition: vnc.c:74
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
#define strncmpiW(s1, s2, n)
Definition: unicode.h:40
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
INTERNET_PORT port
Definition: internet.h:38
smooth NULL
Definition: ftsmooth.c:416
static CRITICAL_SECTION connection_pool_cs
Definition: http.c:212
uint32_t entry
Definition: isohybrid.c:63
void server_addref(server_t *server)
Definition: http.c:224
WCHAR * name
Definition: internet.h:37
Definition: name.c:36
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
USHORT port
Definition: uri.c:227
static struct list connection_pool
Definition: http.c:221
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by HTTP_DealWithProxy(), HTTP_HandleRedirect(), and HTTP_HttpOpenRequestW().

◆ GetAddress()

BOOL GetAddress ( const WCHAR ,
INTERNET_PORT  ,
SOCKADDR ,
int ,
char  
)

Definition at line 133 of file utility.c.

134 {
135  ADDRINFOW *res, hints;
136  void *addr = NULL;
137  int ret;
138 
139  TRACE("%s\n", debugstr_w(name));
140 
141  memset( &hints, 0, sizeof(hints) );
142  /* Prefer IPv4 to IPv6 addresses, since some servers do not listen on
143  * their IPv6 addresses even though they have IPv6 addresses in the DNS.
144  */
145  hints.ai_family = AF_INET;
146 
147  ret = GetAddrInfoW(name, NULL, &hints, &res);
148  if (ret != 0)
149  {
150  TRACE("failed to get IPv4 address of %s, retrying with IPv6\n", debugstr_w(name));
151  hints.ai_family = AF_INET6;
152  ret = GetAddrInfoW(name, NULL, &hints, &res);
153  }
154  if (ret != 0)
155  {
156  TRACE("failed to get address of %s\n", debugstr_w(name));
157  return FALSE;
158  }
159  if (*sa_len < res->ai_addrlen)
160  {
161  WARN("address too small\n");
163  return FALSE;
164  }
165  *sa_len = res->ai_addrlen;
166  memcpy( psa, res->ai_addr, res->ai_addrlen );
167  /* Copy port */
168  switch (res->ai_family)
169  {
170  case AF_INET:
171  addr = &((struct sockaddr_in *)psa)->sin_addr;
172  ((struct sockaddr_in *)psa)->sin_port = htons(port);
173  break;
174  case AF_INET6:
175  addr = &((struct sockaddr_in6 *)psa)->sin6_addr;
176  ((struct sockaddr_in6 *)psa)->sin6_port = htons(port);
177  break;
178  }
179 
180  if(addr_str)
181  inet_ntop(res->ai_family, addr, addr_str, INET6_ADDRSTRLEN);
183  return TRUE;
184 }
namespace GUID const ADDRINFOEXW * hints
Definition: sock.c:80
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:111
#define INET6_ADDRSTRLEN
Definition: request.c:1491
INT WSAAPI GetAddrInfoW(IN PCWSTR pszNodeName, IN PCWSTR pszServiceName, IN const ADDRINFOW *ptHints, OUT PADDRINFOW *pptResult)
Definition: addrinfo.c:509
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define AF_INET6
Definition: winsock.h:369
#define TRACE(s)
Definition: solgame.cpp:4
int ret
GLenum const GLvoid * addr
Definition: glext.h:9621
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static SCRIPT_CACHE SCRIPT_ANALYSIS * psa
Definition: usp10.c:64
WINSOCK_API_LINKAGE VOID WSAAPI FreeAddrInfoW(_In_opt_ PADDRINFOW pAddrInfo)
Definition: name.c:36
GLuint res
Definition: glext.h:9613
#define AF_INET
Definition: tcpip.h:117
const char *WSAAPI inet_ntop(int af, const void *src, char *dst, size_t cnt)
Definition: unix_func.c:8
#define htons(x)
Definition: module.h:213
USHORT port
Definition: uri.c:227
#define memset(x, y, z)
Definition: compat.h:39

Referenced by FTP_Connect(), HTTP_ResolveName(), and InternetCheckConnectionW().

◆ heap_strdupA()

static char* heap_strdupA ( const char str)
inlinestatic

Definition at line 114 of file internet.h.

115 {
116  char *ret = NULL;
117 
118  if(str) {
119  DWORD size = strlen(str)+1;
120 
121  ret = heap_alloc(size);
122  if(ret)
123  memcpy(ret, str, size);
124  }
125 
126  return ret;
127 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

◆ heap_strdupAtoW()

static WCHAR* heap_strdupAtoW ( const char str)
inlinestatic

Definition at line 169 of file internet.h.

170 {
171  LPWSTR ret = NULL;
172 
173  if(str) {
174  DWORD len;
175 
176  len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
177  ret = heap_alloc(len*sizeof(WCHAR));
178  if(ret)
179  MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
180  }
181 
182  return ret;
183 }
#define CP_ACP
Definition: compat.h:99
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static void size_t len
Definition: internet.h:94

◆ heap_strdupW()

static LPWSTR heap_strdupW ( LPCWSTR  str)
inlinestatic

Definition at line 98 of file internet.h.

99 {
100  LPWSTR ret = NULL;
101 
102  if(str) {
103  DWORD size;
104 
105  size = (strlenW(str)+1)*sizeof(WCHAR);
106  ret = heap_alloc(size);
107  if(ret)
108  memcpy(ret, str, size);
109  }
110 
111  return ret;
112 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ heap_strdupWtoA()

static char* heap_strdupWtoA ( LPCWSTR  str)
inlinestatic

Definition at line 185 of file internet.h.

186 {
187  char *ret = NULL;
188 
189  if(str) {
191  ret = heap_alloc(size);
192  if(ret)
194  }
195 
196  return ret;
197 }
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret

◆ heap_strndupAtoW()

static WCHAR* heap_strndupAtoW ( const char str,
int  len_a,
DWORD len_w 
)
inlinestatic

Definition at line 150 of file internet.h.

151 {
152  WCHAR *ret = NULL;
153 
154  if(str) {
155  size_t len;
156  if(len_a < 0) len_a = strlen(str);
157  len = MultiByteToWideChar(CP_ACP, 0, str, len_a, NULL, 0);
158  ret = heap_alloc((len+1)*sizeof(WCHAR));
159  if(ret) {
160  MultiByteToWideChar(CP_ACP, 0, str, len_a, ret, len);
161  ret[len] = 0;
162  *len_w = len;
163  }
164  }
165 
166  return ret;
167 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define CP_ACP
Definition: compat.h:99
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
static void size_t len
Definition: internet.h:94

Referenced by HttpAddRequestHeadersA(), InternetCrackUrlA(), and InternetOpenUrlA().

◆ heap_strndupW()

static LPWSTR heap_strndupW ( LPCWSTR  str,
UINT  max_len 
)
inlinestatic

Definition at line 129 of file internet.h.

130 {
131  LPWSTR ret;
132  UINT len;
133 
134  if(!str)
135  return NULL;
136 
137  for(len=0; len<max_len; len++)
138  if(str[len] == '\0')
139  break;
140 
141  ret = heap_alloc(sizeof(WCHAR)*(len+1));
142  if(ret) {
143  memcpy(ret, str, sizeof(WCHAR)*len);
144  ret[len] = '\0';
145  }
146 
147  return ret;
148 }
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
unsigned int UINT
Definition: ndis.h:50
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static void size_t len
Definition: internet.h:94

◆ HTTP_Connect()

DWORD HTTP_Connect ( appinfo_t ,
LPCWSTR  ,
INTERNET_PORT  nServerPort,
LPCWSTR  lpszUserName,
LPCWSTR  lpszPassword,
DWORD  dwFlags,
DWORD_PTR  dwContext,
DWORD  dwInternalFlags,
HINTERNET  
)

Definition at line 5806 of file http.c.

5810 {
5811  http_session_t *session = NULL;
5812 
5813  TRACE("-->\n");
5814 
5815  if (!lpszServerName || !lpszServerName[0])
5816  return ERROR_INVALID_PARAMETER;
5817 
5818  assert( hIC->hdr.htype == WH_HINIT );
5819 
5820  session = alloc_object(&hIC->hdr, &HTTPSESSIONVtbl, sizeof(http_session_t));
5821  if (!session)
5822  return ERROR_OUTOFMEMORY;
5823 
5824  /*
5825  * According to my tests. The name is not resolved until a request is sent
5826  */
5827 
5828  session->hdr.htype = WH_HHTTPSESSION;
5829  session->hdr.dwFlags = dwFlags;
5830  session->hdr.dwContext = dwContext;
5831  session->hdr.dwInternalFlags |= dwInternalFlags;
5832  session->hdr.decoding = hIC->hdr.decoding;
5833 
5834  WININET_AddRef( &hIC->hdr );
5835  session->appInfo = hIC;
5836  list_add_head( &hIC->hdr.children, &session->hdr.entry );
5837 
5838  session->hostName = heap_strdupW(lpszServerName);
5839  if (lpszUserName && lpszUserName[0])
5840  session->userName = heap_strdupW(lpszUserName);
5841  if (lpszPassword && lpszPassword[0])
5842  session->password = heap_strdupW(lpszPassword);
5843  session->hostPort = serverPort;
5844  session->connect_timeout = hIC->connect_timeout;
5845  session->send_timeout = 0;
5846  session->receive_timeout = 0;
5847 
5848  /* Don't send a handle created callback if this handle was created with InternetOpenUrl */
5849  if (!(session->hdr.dwInternalFlags & INET_OPENURL))
5850  {
5851  INTERNET_SendCallback(&hIC->hdr, dwContext,
5853  sizeof(HINTERNET));
5854  }
5855 
5856 /*
5857  * an INTERNET_STATUS_REQUEST_COMPLETE is NOT sent here as per my tests on
5858  * windows
5859  */
5860 
5861  TRACE("%p --> %p\n", hIC, session);
5862 
5863  *ret = session->hdr.hInternet;
5864  return ERROR_SUCCESS;
5865 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define ERROR_SUCCESS
Definition: deptool.c:10
INTERNET_PORT hostPort
Definition: internet.h:309
DWORD connect_timeout
Definition: internet.h:310
LPWSTR userName
Definition: internet.h:307
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
#define assert(x)
Definition: debug.h:53
_In_opt_ LPSTR _In_opt_ LPSTR lpszPassword
Definition: winbase.h:2658
VOID INTERNET_SendCallback(object_header_t *hdr, DWORD_PTR dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInfo, DWORD dwStatusInfoLength) DECLSPEC_HIDDEN
DWORD_PTR dwContext
Definition: internet.h:279
LPWSTR hostName
Definition: internet.h:306
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: propsheet.c:178
DWORD receive_timeout
Definition: internet.h:312
appinfo_t * appInfo
Definition: internet.h:305
smooth NULL
Definition: ftsmooth.c:416
object_header_t * WININET_AddRef(object_header_t *info)
Definition: internet.c:178
#define TRACE(s)
Definition: solgame.cpp:4
DWORD send_timeout
Definition: internet.h:311
object_header_t hdr
Definition: internet.h:304
struct list entry
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
void * alloc_object(object_header_t *parent, const object_vtbl_t *vtbl, size_t size)
Definition: internet.c:112
HINTERNET hInternet
Definition: internet.h:276
static const object_vtbl_t HTTPSESSIONVtbl
Definition: http.c:5784
DWORD dwInternalFlags
Definition: internet.h:282
#define INET_OPENURL
Definition: internet.h:244
#define INTERNET_STATUS_HANDLE_CREATED
Definition: wininet.h:895
LPWSTR password
Definition: internet.h:308
WH_TYPE htype
Definition: internet.h:274
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by INTERNET_InternetOpenUrlW(), and InternetConnectW().

◆ INET_QueryOption()

DWORD INET_QueryOption ( object_header_t ,
DWORD  ,
void ,
DWORD ,
BOOL   
)

Definition at line 2533 of file internet.c.

2534 {
2535  switch(option) {
2537  if (!size)
2538  return ERROR_INVALID_PARAMETER;
2539 
2540  if (*size < sizeof(DWORD_PTR)) {
2541  *size = sizeof(DWORD_PTR);
2543  }
2544  if (!buffer)
2545  return ERROR_INVALID_PARAMETER;
2546 
2547  *(DWORD_PTR *)buffer = hdr->dwContext;
2548  *size = sizeof(DWORD_PTR);
2549  return ERROR_SUCCESS;
2550 
2552  WARN("INTERNET_OPTION_REQUEST_FLAGS\n");
2553  *size = sizeof(DWORD);
2555 
2558  WARN("Called on global option %u\n", option);
2560  }
2561 
2562  /* FIXME: we shouldn't call it here */
2563  return query_global_option(option, buffer, size, unicode);
2564 }
#define ERROR_INTERNET_INCORRECT_HANDLE_TYPE
Definition: wininet.h:2007
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
char hdr[14]
Definition: iptest.cpp:33
#define ERROR_SUCCESS
Definition: deptool.c:10
#define DWORD_PTR
Definition: treelist.c:76
#define INTERNET_OPTION_MAX_CONNS_PER_SERVER
Definition: wininet.h:763
#define WARN(fmt,...)
Definition: debug.h:111
GLuint buffer
Definition: glext.h:5915
static DWORD
Definition: internet.c:33
Definition: getopt.h:108
#define INTERNET_OPTION_REQUEST_FLAGS
Definition: wininet.h:718
GLsizeiptr size
Definition: glext.h:5919
#define INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER
Definition: wininet.h:764
static DWORD query_global_option(DWORD option, void *buffer, DWORD *size, BOOL unicode)
Definition: internet.c:2337
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define ERROR_INTERNET_INVALID_OPERATION
Definition: wininet.h:2005
#define INTERNET_OPTION_CONTEXT_VALUE
Definition: wininet.h:739
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by APPINFO_QueryOption(), FTPFILE_QueryOption(), FTPFINDNEXT_QueryOption(), FTPSESSION_QueryOption(), and HTTPSESSION_QueryOption().

◆ INET_SetOption()

DWORD INET_SetOption ( object_header_t ,
DWORD  ,
void ,
DWORD   
)

Definition at line 2632 of file internet.c.

2633 {
2634  switch(option) {
2636  FIXME("INTERNETOPTION_SETTINGS_CHANGED semi-stub\n");
2638  return ERROR_SUCCESS;
2640  WARN("Not settable option %u\n", option);
2644  WARN("Called on global option %u\n", option);
2648  }
2649 
2651 }
#define ERROR_INTERNET_INCORRECT_HANDLE_TYPE
Definition: wininet.h:2007
#define ERROR_SUCCESS
Definition: deptool.c:10
#define INTERNET_OPTION_MAX_CONNS_PER_SERVER
Definition: wininet.h:763
#define ERROR_INTERNET_OPTION_NOT_SETTABLE
Definition: wininet.h:2000
#define WARN(fmt,...)
Definition: debug.h:111
#define FIXME(fmt,...)
Definition: debug.h:110
Definition: getopt.h:108
#define INTERNET_OPTION_CALLBACK
Definition: wininet.h:700
#define INTERNET_OPTION_REFRESH
Definition: wininet.h:731
#define INTERNET_OPTION_SETTINGS_CHANGED
Definition: wininet.h:733
BOOL collect_connections(collect_type_t collect_type)
Definition: http.c:313
#define INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER
Definition: wininet.h:764
#define ERROR_INTERNET_INVALID_OPTION
Definition: wininet.h:1998
#define ERROR_INTERNET_INVALID_OPERATION
Definition: wininet.h:2005

Referenced by APPINFO_SetOption(), HTTPREQ_SetOption(), HTTPSESSION_SetOption(), and set_global_option().

◆ init_urlcache()

BOOL init_urlcache ( void  )

Definition at line 4036 of file urlcache.c.

4037 {
4039  if(!dll_unload_event)
4040  return FALSE;
4041 
4043  if(!free_cache_running) {
4045  return FALSE;
4046  }
4047 
4048 #ifndef __REACTOS__
4050 #endif
4051  return TRUE;
4052 }
static void cache_containers_init(void)
Definition: urlcache.c:752
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreW(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:444
static HANDLE dll_unload_event
Definition: urlcache.c:2251
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
smooth NULL
Definition: ftsmooth.c:416
static HANDLE free_cache_running
Definition: urlcache.c:2250

Referenced by DllMain().

◆ init_winsock()

void init_winsock ( void  )

Definition at line 277 of file netconnection.c.

278 {
279  static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT;
281 }
static BOOL WINAPI winsock_startup(INIT_ONCE *once, void *param, void **context)
#define INIT_ONCE_STATIC_INIT
Definition: winbase.h:593
smooth NULL
Definition: ftsmooth.c:416
BOOL NTAPI InitOnceExecuteOnce(INIT_ONCE *once, PINIT_ONCE_FN func, void *param, void **context)

Referenced by create_netconn_socket(), FTP_Connect(), FTP_InitListenSocket(), InternetCheckConnectionW(), and InternetOpenW().

◆ INTERNET_AsyncCall()

DWORD INTERNET_AsyncCall ( task_header_t )

Definition at line 3801 of file internet.c.

3802 {
3803  BOOL bSuccess;
3804 
3805  TRACE("\n");
3806 
3808  if (!bSuccess)
3809  {
3810  heap_free(task);
3812  }
3813  return ERROR_SUCCESS;
3814 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static DWORD CALLBACK INTERNET_WorkerThreadFunc(LPVOID lpvParam)
Definition: internet.c:3762
static BOOLEAN bSuccess
Definition: drive.cpp:417
#define ERROR_INTERNET_ASYNC_THREAD_FAILED
Definition: wininet.h:2035
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WT_EXECUTELONGFUNCTION
Definition: winnt_old.h:1076
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI QueueUserWorkItem(IN LPTHREAD_START_ROUTINE Function, IN PVOID Context, IN ULONG Flags)
Definition: thread.c:1064
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by async_read(), FtpCreateDirectoryW(), FtpDeleteFileW(), FTPFILE_QueryDataAvailable(), FtpFindFirstFileW(), FTPFINDNEXT_FindNextFileW(), FtpGetCurrentDirectoryW(), FtpGetFileW(), FtpOpenFileW(), FtpPutFileW(), FtpRemoveDirectoryW(), FtpRenameFileW(), FtpSetCurrentDirectoryW(), HttpEndRequestW(), HttpSendRequestExW(), HttpSendRequestW(), and InternetOpenUrlW().

◆ INTERNET_FindProxyForProtocol()

WCHAR* INTERNET_FindProxyForProtocol ( LPCWSTR  szProxy,
LPCWSTR  proto 
)

Definition at line 393 of file internet.c.

394 {
395  WCHAR *ret = NULL;
396  const WCHAR *ptr;
397 
398  TRACE("(%s, %s)\n", debugstr_w(szProxy), debugstr_w(proto));
399 
400  /* First, look for the specified protocol (proto=scheme://host:port) */
401  for (ptr = szProxy; ptr && *ptr; )
402  {
403  LPCWSTR end, equal;
404 
405  if (!(end = strchrW(ptr, ' ')))
406  end = ptr + strlenW(ptr);
407  if ((equal = strchrW(ptr, '=')) && equal < end &&
408  equal - ptr == strlenW(proto) &&
410  {
411  ret = heap_strndupW(equal + 1, end - equal - 1);
412  TRACE("found proxy for %s: %s\n", debugstr_w(proto), debugstr_w(ret));
413  return ret;
414  }
415  if (*end == ' ')
416  ptr = end + 1;
417  else
418  ptr = end;
419  }
420 
421  /* It wasn't found: look for no protocol */
422  for (ptr = szProxy; ptr && *ptr; )
423  {
424  LPCWSTR end;
425 
426  if (!(end = strchrW(ptr, ' ')))
427  end = ptr + strlenW(ptr);
428  if (!strchrW(ptr, '='))
429  {
430  ret = heap_strndupW(ptr, end - ptr);
431  TRACE("found proxy for %s: %s\n", debugstr_w(proto), debugstr_w(ret));
432  return ret;
433  }
434  if (*end == ' ')
435  ptr = end + 1;
436  else
437  ptr = end;
438  }
439 
440  return NULL;
441 }
static LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
#define equal(x, y)
Definition: reader.cc:56
GLuint GLuint end
Definition: gl.h:1545
#define strncmpiW(s1, s2, n)
Definition: unicode.h:40
#define debugstr_w
Definition: kernel32.h:32
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret

Referenced by HTTP_DealWithProxy().

◆ INTERNET_GetLastError()

DWORD INTERNET_GetLastError ( void  )

Definition at line 3744 of file internet.c.

3745 {
3747  if (!lpwite) return 0;
3748  /* TlsGetValue clears last error, so set it again here */
3749  SetLastError(lpwite->dwError);
3750  return lpwite->dwError;
3751 }
DWORD dwError
Definition: internet.c:72
#define SetLastError(x)
Definition: compat.h:409
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1228
static DWORD g_dwTlsErrIndex
Definition: internet.c:76

Referenced by FTP_FtpCreateDirectoryW(), FTP_FtpDeleteFileW(), FTP_FtpFindFirstFileW(), FTP_FtpGetFileW(), FTP_FtpOpenFileW(), FTP_FtpPutFileW(), FTP_FtpRemoveDirectoryW(), FTP_FtpRenameFileW(), FTP_ReceiveRequestData(), HTTP_HandleRedirect(), and InternetConnectW().

◆ INTERNET_GetResponseBuffer()

LPSTR INTERNET_GetResponseBuffer ( void  )

Definition at line 3823 of file internet.c.

3824 {
3826  if (!lpwite)
3827  lpwite = INTERNET_AllocThreadError();
3828  TRACE("\n");
3829  return lpwite->response;
3830 }
CHAR response[MAX_REPLY_LEN]
Definition: internet.c:73
#define TRACE(s)
Definition: solgame.cpp:4
static LPWITHREADERROR INTERNET_AllocThreadError(void)
Definition: internet.c:3696
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1228
static DWORD g_dwTlsErrIndex
Definition: internet.c:76

Referenced by FTP_DoPassive(), FTP_FtpGetCurrentDirectoryW(), FTP_GetNextLine(), and FTP_ReceiveResponse().

◆ INTERNET_SendCallback()

◆ INTERNET_SetLastError()

void INTERNET_SetLastError ( DWORD  dwError)

Definition at line 3723 of file internet.c.

3724 {
3726 
3727  if (!lpwite)
3728  lpwite = INTERNET_AllocThreadError();
3729 
3730  SetLastError(dwError);
3731  if(lpwite)
3732  lpwite->dwError = dwError;
3733 }
DWORD dwError
Definition: internet.c:72
static LPWITHREADERROR INTERNET_AllocThreadError(void)
Definition: internet.c:3696
#define SetLastError(x)
Definition: compat.h:409
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1228
static DWORD g_dwTlsErrIndex
Definition: internet.c:76

Referenced by calc_url_length(), FTP_Connect(), FTP_FtpCreateDirectoryW(), FTP_FtpDeleteFileW(), FTP_FtpFindFirstFileW(), FTP_FtpGetCurrentDirectoryW(), FTP_FtpGetFileW(), FTP_FtpOpenFileW(), FTP_FtpPutFileW(), FTP_FtpRemoveDirectoryW(), FTP_FtpRenameFileW(), FTP_FtpSetCurrentDirectoryW(), FTP_GetNextLine(), FTP_ParseDirectory(), FTP_RetrieveFileData(), FTP_SendCommandA(), FTP_SetResponseError(), FtpCommandA(), FtpCommandW(), FtpCreateDirectoryW(), FtpDeleteFileW(), FtpFindFirstFileW(), FtpGetCurrentDirectoryA(), FtpGetCurrentDirectoryW(), FtpGetFileW(), FtpOpenFileW(), FtpPutFileW(), FtpRemoveDirectoryW(), FtpRenameFileW(), FtpSetCurrentDirectoryW(), GetUrlCacheConfigInfoA(), GetUrlCacheConfigInfoW(), INTERNET_InternetOpenUrlW(), InternetCheckConnectionW(), InternetCreateUrlW(), InternetOpenW(), InternetReadFile(), InternetReadFileExA(), InternetReadFileExW(), and res_to_le().

◆ is_valid_netconn()

◆ NETCON_GetCert()

LPCVOID NETCON_GetCert ( netconn_t connection)

Definition at line 883 of file netconnection.c.

884 {
885  const CERT_CONTEXT *ret;
887 
889  return res == SEC_E_OK ? ret : NULL;
890 }
CtxtHandle ssl_ctx
#define SECPKG_ATTR_REMOTE_CERT_CONTEXT
Definition: schannel.h:69
smooth NULL
Definition: ftsmooth.c:416
LONG SECURITY_STATUS
Definition: sspi.h:34
int ret
#define SEC_E_OK
Definition: winerror.h:2356
SECURITY_STATUS WINAPI QueryContextAttributesW(PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer)
Definition: wrapper.c:535
GLuint res
Definition: glext.h:9613

Referenced by HTTPREQ_QueryOption().

◆ NETCON_GetCipherStrength()

int NETCON_GetCipherStrength ( netconn_t )

Definition at line 892 of file netconnection.c.

893 {
896 
897  if (!connection->secure)
898  return 0;
899 
900  res = QueryContextAttributesW(&connection->ssl_ctx, SECPKG_ATTR_CONNECTION_INFO, (void*)&conn_info);
901  if(res != SEC_E_OK)
902  WARN("QueryContextAttributesW failed: %08x\n", res);
903  return res == SEC_E_OK ? conn_info.dwCipherStrength : 0;
904 }
#define WARN(fmt,...)
Definition: debug.h:111
LONG SECURITY_STATUS
Definition: sspi.h:34
#define SECPKG_ATTR_CONNECTION_INFO
Definition: schannel.h:76
#define SEC_E_OK
Definition: winerror.h:2356
SECURITY_STATUS WINAPI QueryContextAttributesW(PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer)
Definition: wrapper.c:535
GLuint res
Definition: glext.h:9613

Referenced by HTTPREQ_QueryOption(), and netcon_secure_connect_setup().

◆ NETCON_is_alive()

BOOL NETCON_is_alive ( netconn_t )

Definition at line 872 of file netconnection.c.

873 {
874  int len;
875  char b;
876 
877  set_socket_blocking(netconn, FALSE);
878  len = sock_recv(netconn->socket, &b, 1, MSG_PEEK);
879 
880  return len == 1 || (len == -1 && WSAGetLastError() == WSAEWOULDBLOCK);
881 }
int sock_recv(int fd, void *msg, size_t len, int flags)
#define WSAEWOULDBLOCK
Definition: winerror.h:1948
#define b
Definition: ke_i.h:79
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
INT WSAAPI WSAGetLastError(VOID)
Definition: dllmain.c:112
GLenum GLsizei len
Definition: glext.h:6722
static void set_socket_blocking(netconn_t *conn, BOOL is_blocking)
#define MSG_PEEK
Definition: winsock.h:222

Referenced by open_http_connection().

◆ NETCON_recv()

DWORD NETCON_recv ( netconn_t ,
void ,
size_t  ,
BOOL  ,
int  
)

Definition at line 820 of file netconnection.c.

821 {
822  *recvd = 0;
823  if (!len)
824  return ERROR_SUCCESS;
825 
826  if (!connection->secure)
827  {
828  set_socket_blocking(connection, blocking);
829  *recvd = sock_recv(connection->socket, buf, len, 0);
830  return *recvd == -1 ? WSAGetLastError() : ERROR_SUCCESS;
831  }
832  else
833  {
834  SIZE_T size = 0;
835  BOOL eof;
836  DWORD res;
837 
838  if(connection->peek_msg) {
839  size = min(len, connection->peek_len);
840  memcpy(buf, connection->peek_msg, size);
841  connection->peek_len -= size;
842  connection->peek_msg += size;
843 
844  if(!connection->peek_len) {
845  heap_free(connection->peek_msg_mem);
846  connection->peek_msg_mem = connection->peek_msg = NULL;
847  }
848 
849  *recvd = size;
850  return ERROR_SUCCESS;
851  }
852 
853  do {
854  res = read_ssl_chunk(connection, (BYTE*)buf, len, blocking, &size, &eof);
855  if(res != ERROR_SUCCESS) {
856  if(res == WSAEWOULDBLOCK) {
857  if(size)
858  res = ERROR_SUCCESS;
859  }else {
860  WARN("read_ssl_chunk failed\n");
861  }
862  break;
863  }
864  }while(!size && !eof);
865 
866  TRACE("received %ld bytes\n", size);
867  *recvd = size;
868  return res;
869  }
870 }
static BOOL read_ssl_chunk(netconn_t *conn, void *buf, SIZE_T buf_size, BOOL blocking, SIZE_T *ret_size, BOOL *eof)
#define ERROR_SUCCESS
Definition: deptool.c:10
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define WARN(fmt,...)
Definition: debug.h:111
int sock_recv(int fd, void *msg, size_t len, int flags)
#define WSAEWOULDBLOCK
Definition: winerror.h:1948
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
INT WSAAPI WSAGetLastError(VOID)
Definition: dllmain.c:112
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
_Check_return_ _CRTIMP int __cdecl __cdecl eof(_In_ int _FileHandle)
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define min(a, b)
Definition: monoChain.cc:55
static void set_socket_blocking(netconn_t *conn, BOOL is_blocking)
GLuint res
Definition: glext.h:9613
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by chunked_read(), netconn_drain_content(), netconn_read(), and read_more_data().

◆ NETCON_secure_connect()

DWORD NETCON_secure_connect ( netconn_t ,
server_t  
)

Definition at line 600 of file netconnection.c.

601 {
602  DWORD res;
603 
604  /* can't connect if we are already connected */
605  if(connection->secure) {
606  ERR("already connected\n");
608  }
609 
610  if(server != connection->server) {
611  server_release(connection->server);
613  connection->server = server;
614  }
615 
616  /* connect with given TLS options */
617  res = netcon_secure_connect_setup(connection, FALSE);
618  if (res == ERROR_SUCCESS)
619  return res;
620 
621  /* FIXME: when got version alert and FIN from server */
622  /* fallback to connect without TLSv1.1/TLSv1.2 */
624  {
625  closesocket(connection->socket);
626  res = create_netconn_socket(connection->server, connection, 500);
627  if (res != ERROR_SUCCESS)
628  return res;
629  res = netcon_secure_connect_setup(connection, TRUE);
630  }
631  return res;
632 }
#define TRUE
Definition: types.h:120
static rfbScreenInfoPtr server
Definition: vnc.c:74
#define ERROR_SUCCESS
Definition: deptool.c:10
#define closesocket
void server_release(server_t *server)
Definition: http.c:229
#define ERROR_INTERNET_CANNOT_CONNECT
Definition: wininet.h:2018
static DWORD netcon_secure_connect_setup(netconn_t *connection, BOOL compat_mode)
unsigned long DWORD
Definition: ntddk_ex.h:95
void server_addref(server_t *server)
Definition: http.c:224
#define ERR(fmt,...)
Definition: debug.h:109
#define ERROR_INTERNET_SECURITY_CHANNEL_ERROR
Definition: wininet.h:2068
GLuint res
Definition: glext.h:9613
static DWORD create_netconn_socket(server_t *server, netconn_t *netconn, DWORD timeout)
static BOOL have_compat_cred_handle

Referenced by HTTP_HttpSendRequestW().

◆ NETCON_send()

DWORD NETCON_send ( netconn_t connection,
const void msg,
size_t  len,
int  flags,
int sent 
)

Definition at line 665 of file netconnection.c.

667 {
668  /* send is always blocking. */
669  set_socket_blocking(connection, TRUE);
670 
671  if(!connection->secure)
672  {
673  *sent = sock_send(connection->socket, msg, len, flags);
674  return *sent == -1 ? WSAGetLastError() : ERROR_SUCCESS;
675  }
676  else
677  {
678  const BYTE *ptr = msg;
679  size_t chunk_size;
680 
681  *sent = 0;
682 
683  while(len) {
684  chunk_size = min(len, connection->ssl_sizes.cbMaximumMessage);
685  if(!send_ssl_chunk(connection, ptr, chunk_size))
687 
688  *sent += chunk_size;
689  ptr += chunk_size;
690  len -= chunk_size;
691  }
692 
693  return ERROR_SUCCESS;
694  }
695 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
static PVOID ptr
Definition: dispmode.c:27
int sock_send(int fd, const void *msg, size_t len, int flags)
INT WSAAPI WSAGetLastError(VOID)
Definition: dllmain.c:112
GLbitfield flags
Definition: glext.h:7161
Definition: msg.h:34
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
static BOOL send_ssl_chunk(netconn_t *conn, const void *msg, size_t size)
#define ERROR_INTERNET_SECURITY_CHANNEL_ERROR
Definition: wininet.h:2068
#define min(a, b)
Definition: monoChain.cc:55
static void set_socket_blocking(netconn_t *conn, BOOL is_blocking)
#define msg(x)
Definition: auth_time.c:54
SecPkgContext_StreamSizes ssl_sizes

Referenced by HTTP_HttpSendRequestW(), and HTTPREQ_WriteFile().

◆ NETCON_set_timeout()

DWORD NETCON_set_timeout ( netconn_t connection,
BOOL  send,
DWORD  value 
)

Definition at line 906 of file netconnection.c.

907 {
908  int result;
909 
910  result = setsockopt(connection->socket, SOL_SOCKET,
911  send ? SO_SNDTIMEO : SO_RCVTIMEO, (void*)&value,
912  sizeof(value));
913  if (result == -1)
914  {
915  WARN("setsockopt failed\n");
916  return WSAGetLastError();
917  }
918  return ERROR_SUCCESS;
919 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WARN(fmt,...)
Definition: debug.h:111
#define SOL_SOCKET
Definition: winsock.h:398
INT WSAAPI setsockopt(IN SOCKET s, IN INT level, IN INT optname, IN CONST CHAR FAR *optval, IN INT optlen)
Definition: sockctrl.c:421
#define SO_RCVTIMEO
Definition: winsock.h:193
INT WSAAPI WSAGetLastError(VOID)
Definition: dllmain.c:112
INT WSAAPI send(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags)
Definition: send.c:23
#define SO_SNDTIMEO
Definition: winsock.h:192
GLuint64EXT * result
Definition: glext.h:11304

Referenced by HTTP_GetResponseHeaders(), and HTTP_HttpSendRequestW().

◆ NETCON_unload()

void NETCON_unload ( void  )

Definition at line 403 of file netconnection.c.

404 {
410  if(winsock_loaded)
411  WSACleanup();
412 }
INT WSAAPI WSACleanup(VOID)
Definition: startup.c:60
static SecHandle cred_handle
SECURITY_STATUS WINAPI FreeCredentialsHandle(PCredHandle phCredential)
Definition: wrapper.c:151
static BOOL winsock_loaded
static BOOL cred_handle_initialized
static CRITICAL_SECTION init_sechandle_cs
static SecHandle compat_cred_handle
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
static BOOL have_compat_cred_handle

Referenced by DllMain().

◆ req_file_addref()

static req_file_t* req_file_addref ( req_file_t req_file)
inlinestatic

Definition at line 450 of file internet.h.

451 {
452  InterlockedIncrement(&req_file->ref);
453  return req_file;
454 }
LONG ref
Definition: internet.h:249
#define InterlockedIncrement
Definition: armddk.h:53

Referenced by HTTPREQ_LockRequestFile().

◆ req_file_release()

void req_file_release ( req_file_t )

Definition at line 3901 of file internet.c.

3902 {
3903  if(InterlockedDecrement(&req_file->ref))
3904  return;
3905 
3906  if(!req_file->is_committed)
3907  DeleteFileW(req_file->file_name);
3908  if(req_file->file_handle && req_file->file_handle != INVALID_HANDLE_VALUE)
3909  CloseHandle(req_file->file_handle);
3910  heap_free(req_file->file_name);
3911  heap_free(req_file->url);
3912  heap_free(req_file);
3913 }
#define CloseHandle
Definition: compat.h:398
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
#define InterlockedDecrement
Definition: armddk.h:52
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by create_cache_entry(), create_req_file(), HTTPREQ_Destroy(), and InternetUnlockRequestFile().

◆ server_addref()

void server_addref ( server_t )

Definition at line 224 of file http.c.

225 {
227 }
static rfbScreenInfoPtr server
Definition: vnc.c:74
#define InterlockedIncrement
Definition: armddk.h:53

Referenced by create_netconn(), get_server(), and NETCON_secure_connect().

◆ server_release()

void server_release ( server_t )

Definition at line 229 of file http.c.

230 {
231  if(InterlockedDecrement(&server->ref))
232  return;
233 
234 #ifdef __REACTOS__
236 #endif
237  list_remove(&server->entry);
238 #ifdef __REACTOS__
240 #endif
241 
242  if(server->cert_chain)
243  CertFreeCertificateChain(server->cert_chain);
244  heap_free(server->name);
245  heap_free(server->scheme_host_port);
246  heap_free(server);
247 }
static rfbScreenInfoPtr server
Definition: vnc.c:74
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
VOID WINAPI CertFreeCertificateChain(PCCERT_CHAIN_CONTEXT pChainContext)
Definition: chain.c:2960
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
static CRITICAL_SECTION connection_pool_cs
Definition: http.c:212
#define InterlockedDecrement
Definition: armddk.h:52
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by collect_connections(), free_netconn(), HTTP_HandleRedirect(), HTTPREQ_Destroy(), InternetGetSecurityInfoByURLW(), and NETCON_secure_connect().

◆ set_cookie()

DWORD set_cookie ( substr_t  ,
substr_t  ,
substr_t  ,
substr_t  ,
DWORD   
)

Definition at line 906 of file cookie.c.

907 {
909  cookie_t *thisCookie;
910  substr_t value;
911  const WCHAR *end_ptr;
912  FILETIME expiry, create;
913  BOOL expired = FALSE, update_persistent = FALSE;
914  DWORD cookie_flags = 0, len;
915 
916  TRACE("%s %s %s=%s %x\n", debugstr_wn(domain.str, domain.len), debugstr_wn(path.str, path.len),
917  debugstr_wn(name.str, name.len), debugstr_wn(data.str, data.len), flags);
918 
919  memset(&expiry,0,sizeof(expiry));
921 
922  /* lots of information can be parsed out of the cookie value */
923 
924  if(!(end_ptr = memchrW(data.str, ';', data.len)))
925  end_ptr = data.str + data.len;
926  value = substr(data.str, end_ptr-data.str);
927  data.str += value.len;
928  data.len -= value.len;
929 
930  for(;;) {
931  static const WCHAR szDomain[] = {'d','o','m','a','i','n','='};
932  static const WCHAR szPath[] = {'p','a','t','h','='};
933  static const WCHAR szExpires[] = {'e','x','p','i','r','e','s','='};
934  static const WCHAR szSecure[] = {'s','e','c','u','r','e'};
935  static const WCHAR szHttpOnly[] = {'h','t','t','p','o','n','l','y'};
936  static const WCHAR szVersion[] = {'v','e','r','s','i','o','n','='};
937  static const WCHAR max_ageW[] = {'m','a','x','-','a','g','e','='};
938 
939  /* Skip ';' */
940  if(data.len)
941  substr_skip(&data, 1);
942 
943  while(data.len && *data.str == ' ')
944  substr_skip(&data, 1);
945 
946  if(!data.len)
947  break;
948 
949  if(!(end_ptr = memchrW(data.str, ';', data.len)))
950  end_ptr = data.str + data.len;
951 
952  if(data.len >= (len = sizeof(szDomain)/sizeof(WCHAR)) && !strncmpiW(data.str, szDomain, len)) {
953  substr_skip(&data, len);
954 
955  if(data.len && *data.str == '.')
956  substr_skip(&data, 1);
957 
958  if(!is_domain_legal_for_cookie(substr(data.str, end_ptr-data.str), domain))
959  return COOKIE_STATE_UNKNOWN;
960 
961  domain = substr(data.str, end_ptr-data.str);
962  TRACE("Parsing new domain %s\n", debugstr_wn(domain.str, domain.len));
963  }else if(data.len >= (len = sizeof(szPath)/sizeof(WCHAR)) && !strncmpiW(data.str, szPath, len)) {
964  substr_skip(&data, len);
965  path = substr(data.str, end_ptr - data.str);
966  TRACE("Parsing new path %s\n", debugstr_wn(path.str, path.len));
967  }else if(data.len >= (len = sizeof(szExpires)/sizeof(WCHAR)) && !strncmpiW(data.str, szExpires, len)) {
968  SYSTEMTIME st;
969  WCHAR buf[128];
970 
971  substr_skip(&data, len);
972 
973  if(end_ptr - data.str < sizeof(buf)/sizeof(WCHAR)-1) {
974  memcpy(buf, data.str, data.len*sizeof(WCHAR));
975  buf[data.len] = 0;
976 
977  if (InternetTimeToSystemTimeW(data.str, &st, 0)) {
978  SystemTimeToFileTime(&st, &expiry);
979 
980  if (CompareFileTime(&create,&expiry) > 0) {
981  TRACE("Cookie already expired.\n");
982  expired = TRUE;
983  }
984  }
985  }
986  }else if(data.len >= (len = sizeof(szSecure)/sizeof(WCHAR)) && !strncmpiW(data.str, szSecure, len)) {
987  substr_skip(&data, len);
988  FIXME("secure not handled\n");
989  }else if(data.len >= (len = sizeof(szHttpOnly)/sizeof(WCHAR)) && !strncmpiW(data.str, szHttpOnly, len)) {
990  substr_skip(&data, len);
991 
993  WARN("HTTP only cookie added without INTERNET_COOKIE_HTTPONLY flag\n");
995  return COOKIE_STATE_REJECT;
996  }
997 
998  cookie_flags |= INTERNET_COOKIE_HTTPONLY;
999  }else if(data.len >= (len = sizeof(szVersion)/sizeof(WCHAR)) && !strncmpiW(data.str, szVersion, len)) {
1000  substr_skip(&data, len);
1001 
1002  FIXME("version not handled (%s)\n",debugstr_wn(data.str, data.len));
1003  }else if(data.len >= (len = sizeof(max_ageW)/sizeof(WCHAR)) && !strncmpiW(data.str, max_ageW, len)) {
1004  /* Native doesn't support Max-Age attribute. */
1005  WARN("Max-Age ignored\n");
1006  }else if(data.len) {
1007  FIXME("Unknown additional option %s\n", debugstr_wn(data.str, data.len));
1008  }
1009 
1010  substr_skip(&data, end_ptr - data.str);
1011  }
1012 
1014 
1015  load_persistent_cookie(domain, path);
1016 
1017  container = get_cookie_container(domain, path, !expired);
1018  if(!container) {
1020  return COOKIE_STATE_ACCEPT;
1021  }
1022 
1023  if(!expiry.dwLowDateTime && !expiry.dwHighDateTime)
1024  cookie_flags |= INTERNET_COOKIE_IS_SESSION;
1025  else
1026  update_persistent = TRUE;
1027 
1028  if ((thisCookie = find_cookie(container, name))) {
1029  if ((thisCookie->flags & INTERNET_COOKIE_HTTPONLY) && !(flags & INTERNET_COOKIE_HTTPONLY)) {
1030  WARN("An attempt to override httponly cookie\n");
1033  return COOKIE_STATE_REJECT;
1034  }
1035 
1036  if (!(thisCookie->flags & INTERNET_COOKIE_IS_SESSION))
1037  update_persistent = TRUE;
1038  delete_cookie(thisCookie);
1039  }
1040 
1041  TRACE("setting cookie %s=%s for domain %s path %s\n", debugstr_wn(name.str, name.len),
1042  debugstr_wn(value.str, value.len), debugstr_w(container->domain->domain),
1043  debugstr_wn(container->path.str, container->path.len));
1044 
1045  if (!expired) {
1046  cookie_t *new_cookie;
1047 
1048  new_cookie = alloc_cookie(name, value, expiry, create, cookie_flags);
1049  if(!new_cookie) {
1051  return COOKIE_STATE_UNKNOWN;
1052  }
1053 
1054  add_cookie(container, new_cookie);
1055  }
1056 
1057  if (!update_persistent || save_persistent_cookie(container))
1058  {
1060  return COOKIE_STATE_ACCEPT;
1061  }
1063  return COOKIE_STATE_UNKNOWN;
1064 }
static cookie_container_t * get_cookie_container(substr_t domain, substr_t path, BOOL create)
Definition: cookie.c:184
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
Definition: time.c:128
#define TRUE
Definition: types.h:120
#define INTERNET_COOKIE_IS_SESSION
Definition: wininet.h:1819
static BOOL is_domain_legal_for_cookie(substr_t domain, substr_t full_domain)
Definition: cookie.c:863
static void substr_skip(substr_t *str, size_t len)
Definition: cookie.c:899
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define WARN(fmt,...)
Definition: debug.h:111
#define strncmpiW(s1, s2, n)
Definition: unicode.h:40
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
struct container container
DWORD dwHighDateTime
Definition: mapidefs.h:66
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
static BOOL save_persistent_cookie(cookie_container_t *container)
Definition: cookie.c:386
static void delete_cookie(cookie_t *cookie)
Definition: cookie.c:228
static CRITICAL_SECTION cookie_cs
Definition: cookie.c:87
static cookie_t * find_cookie(cookie_container_t *container, substr_t name)
Definition: cookie.c:260
#define TRACE(s)
Definition: solgame.cpp:4
LONG WINAPI CompareFileTime(IN CONST FILETIME *lpFileTime1, IN CONST FILETIME *lpFileTime2)
Definition: time.c:106
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161
static LPCWSTR szVersion
Definition: asmcache.c:748
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
GLsizei const GLfloat * value
Definition: glext.h:6069
#define debugstr_wn
Definition: kernel32.h:33
static void add_cookie(cookie_container_t *container, cookie_t *new_cookie)
Definition: cookie.c:272
static const WCHAR szExpires[]
Definition: http.c:103
BOOL WINAPI SystemTimeToFileTime(IN CONST SYSTEMTIME *lpSystemTime, OUT LPFILETIME lpFileTime)
Definition: time.c:148
LPCWSTR szPath
Definition: env.c:35
Definition: services.c:325
#define ERROR_INVALID_OPERATION
Definition: winerror.h:1261
static BOOL load_persistent_cookie(substr_t domain, substr_t path)
Definition: cookie.c:297
Definition: name.c:36
static substr_t substr(const WCHAR *str, size_t len)
Definition: internet.h:204
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define INTERNET_COOKIE_HTTPONLY
Definition: wininet.h:1828
WINE_UNICODE_INLINE WCHAR * memchrW(const WCHAR *ptr, WCHAR ch, size_t n)
Definition: unicode.h:295
BOOL WINAPI InternetTimeToSystemTimeW(LPCWSTR string, SYSTEMTIME *time, DWORD reserved)
Definition: internet.c:3259
#define memset(x, y, z)
Definition: compat.h:39
static const struct access_res create[16]
Definition: package.c:7720
static cookie_t * alloc_cookie(substr_t name, substr_t data, FILETIME expiry, FILETIME create_time, DWORD flags)
Definition: cookie.c:237
DWORD dwLowDateTime
Definition: mapidefs.h:65

Referenced by HTTP_ProcessCookies(), InternetSetCookieExW(), and record_cookies().

◆ sock_recv()

int sock_recv ( int  fd,
void msg,
size_t  len,
int  flags 
)

Definition at line 425 of file netconnection.c.

426 {
427  int ret;
428  do
429  {
430  ret = recv(fd, msg, len, flags);
431  }
432  while(ret == -1 && WSAGetLastError() == WSAEINTR);
433  return ret;
434 }
static int fd
Definition: io.c:51
INT WSAAPI WSAGetLastError(VOID)
Definition: dllmain.c:112
GLbitfield flags
Definition: glext.h:7161
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define msg(x)
Definition: auth_time.c:54
INT WSAAPI recv(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags)
Definition: recv.c:23
#define WSAEINTR
Definition: winerror.h:1942

Referenced by NETCON_is_alive(), NETCON_recv(), netcon_secure_connect_setup(), and read_ssl_chunk().

◆ sock_send()

int sock_send ( int  fd,
const void msg,
size_t  len,
int  flags 
)

Definition at line 414 of file netconnection.c.

415 {
416  int ret;
417  do
418  {
419  ret = send(fd, msg, len, flags);
420  }
421  while(ret == -1 && WSAGetLastError() == WSAEINTR);
422  return ret;
423 }
static int fd
Definition: io.c:51
INT WSAAPI WSAGetLastError(VOID)
Definition: dllmain.c:112
INT WSAAPI send(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags)
Definition: send.c:23
GLbitfield flags
Definition: glext.h:7161
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define msg(x)
Definition: auth_time.c:54
#define WSAEINTR
Definition: winerror.h:1942

Referenced by netcon_secure_connect_setup(), NETCON_send(), and send_ssl_chunk().

◆ substr()

static substr_t substr ( const WCHAR str,
size_t  len 
)
inlinestatic

Definition at line 204 of file internet.h.

205 {
206  substr_t r = {str, len};
207  return r;
208 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
const WCHAR * str
GLenum GLsizei len
Definition: glext.h:6722

Referenced by cookie_parse_url(), get_cookie(), HTTP_DealWithProxy(), HTTP_HandleRedirect(), HTTP_ProcessCookies(), HTTP_ShouldBypassProxy(), InternetGetSecurityInfoByURLW(), InternetSetCookieExW(), load_persistent_cookie(), pbuf_strstr(), set_cookie(), and substrz().

◆ substrz()

static substr_t substrz ( const WCHAR str)
inlinestatic

Definition at line 210 of file internet.h.

211 {
212  return substr(str, strlenW(str));
213 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
const WCHAR * str
static substr_t substr(const WCHAR *str, size_t len)
Definition: internet.h:204

Referenced by get_cookie_container(), get_cookie_header(), HTTP_HttpOpenRequestW(), HTTP_ProcessCookies(), InternetSetCookieExW(), IsDomainLegalCookieDomainW(), and replace_cookie().

◆ WININET_AddRef()

object_header_t* WININET_AddRef ( object_header_t info)

Definition at line 178 of file internet.c.

179 {
180  ULONG refs = InterlockedIncrement(&info->refs);
181  TRACE("%p -> refcount = %d\n", info, refs );
182  return info;
183 }
struct _test_info info[]
Definition: SetCursorPos.c:19
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

Referenced by alloc_async_task(), FTP_Connect(), FTP_FtpOpenFileW(), FTP_ReceiveFileList(), get_handle_object(), HTTP_Connect(), and HTTP_HttpOpenRequestW().

◆ WININET_find_data_WtoA()

static void WININET_find_data_WtoA ( LPWIN32_FIND_DATAW  dataW,
LPWIN32_FIND_DATAA  dataA 
)
inlinestatic

Definition at line 215 of file internet.h.

216 {
217  dataA->dwFileAttributes = dataW->dwFileAttributes;
218  dataA->ftCreationTime = dataW->ftCreationTime;
219  dataA->ftLastAccessTime = dataW->ftLastAccessTime;
220  dataA->ftLastWriteTime = dataW->ftLastWriteTime;
221  dataA->nFileSizeHigh = dataW->nFileSizeHigh;
222  dataA->nFileSizeLow = dataW->nFileSizeLow;
223  dataA->dwReserved0 = dataW->dwReserved0;
224  dataA->dwReserved1 = dataW->dwReserved1;
225  WideCharToMultiByte(CP_ACP, 0, dataW->cFileName, -1,
226  dataA->cFileName, sizeof(dataA->cFileName),
227  NULL, NULL);
229  dataA->cAlternateFileName, sizeof(dataA->cAlternateFileName),
230  NULL, NULL);
231 }
DWORD nFileSizeHigh
Definition: winbase.h:915
DWORD dwReserved1
Definition: winbase.h:906
CHAR cFileName[MAX_PATH]
Definition: winbase.h:907
#define WideCharToMultiByte
Definition: compat.h:101
FILETIME ftLastAccessTime
Definition: winbase.h:901
#define CP_ACP
Definition: compat.h:99
WCHAR cAlternateFileName[14]
Definition: winbase.h:920
DWORD dwReserved0
Definition: winbase.h:905
DWORD nFileSizeLow
Definition: winbase.h:904
FILETIME ftCreationTime
Definition: winbase.h:900
DWORD nFileSizeLow
Definition: winbase.h:916
smooth NULL
Definition: ftsmooth.c:416
FILETIME ftLastWriteTime
Definition: winbase.h:902
WCHAR cFileName[MAX_PATH]
Definition: winbase.h:919
FILETIME ftLastWriteTime
Definition: winbase.h:914
DWORD dwFileAttributes
Definition: winbase.h:899
FILETIME ftLastAccessTime
Definition: winbase.h:913
DWORD dwReserved0
Definition: winbase.h:917
DWORD dwReserved1
Definition: winbase.h:918
DWORD dwFileAttributes
Definition: winbase.h:911
DWORD nFileSizeHigh
Definition: winbase.h:903
FILETIME ftCreationTime
Definition: winbase.h:912
CHAR cAlternateFileName[14]
Definition: winbase.h:908

Referenced by FtpFindFirstFileA(), and InternetFindNextFileA().

◆ WININET_Release()

BOOL WININET_Release ( object_header_t info)

Definition at line 220 of file internet.c.

221 {
222  ULONG refs = InterlockedDecrement(&info->refs);
223  TRACE( "object %p refcount = %d\n", info, refs );
224  if( !refs )
225  {
227  if ( info->vtbl->CloseConnection )
228  {
229  TRACE( "closing connection %p\n", info);
230  info->vtbl->CloseConnection( info );
231  }
232  /* Don't send a callback if this is a session handle created with InternetOpenUrl */
233  if ((info->htype != WH_HHTTPSESSION && info->htype != WH_HFTPSESSION)
234  || !(info->dwInternalFlags & INET_OPENURL))
235  {
236  INTERNET_SendCallback(info, info->dwContext,
238  sizeof(HINTERNET));
239  }
240  TRACE( "destroying object %p\n", info);
241  if ( info->htype != WH_HINIT )
242  list_remove( &info->entry );
243  info->vtbl->Destroy( info );
244 
245  if(info->hInternet) {
246  UINT_PTR handle = (UINT_PTR)info->hInternet;
247 
249 
251  if(next_handle > handle)
253 
255  }
256 
257  heap_free(info);
258  }
259  return TRUE;
260 }
unsigned __int3264 UINT_PTR
Definition: activex.cpp:275
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define TRUE
Definition: types.h:120
#define INTERNET_STATUS_HANDLE_CLOSING
Definition: wininet.h:896
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
VOID INTERNET_SendCallback(object_header_t *hdr, DWORD_PTR dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInfo, DWORD dwStatusInfoLength) DECLSPEC_HIDDEN
static void invalidate_handle(object_header_t *info)
Definition: internet.c:202
smooth NULL
Definition: ftsmooth.c:416
static UINT_PTR next_handle
Definition: internet.c:89
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
static CRITICAL_SECTION WININET_cs
Definition: internet.c:79
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define InterlockedDecrement
Definition: armddk.h:52
#define INET_OPENURL
Definition: internet.h:244
unsigned int ULONG
Definition: retypes.h:1
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by FTP_Connect(), FtpCommandW(), FtpCreateDirectoryW(), FtpDeleteFileW(), FTPFILE_Destroy(), FtpFindFirstFileW(), FTPFINDNEXT_Destroy(), FtpGetCurrentDirectoryW(), FtpGetFileW(), FtpOpenFileW(), FtpPutFileW(), FtpRemoveDirectoryW(), FtpRenameFileW(), FTPSESSION_Destroy(), FtpSetCurrentDirectoryW(), HTTP_HttpOpenRequestW(), HttpAddRequestHeadersW(), HttpEndRequestW(), HttpOpenRequestW(), HttpQueryInfoW(), HTTPREQ_Destroy(), HttpSendRequestExW(), HttpSendRequestW(), HTTPSESSION_Destroy(), INTERNET_WorkerThreadFunc(), InternetCloseHandle(), InternetConnectW(), InternetErrorDlg(), InternetFindNextFileW(), InternetLockRequestFile(), InternetOpenUrlW(), InternetQueryDataAvailable(), InternetQueryOptionA(), InternetQueryOptionW(), InternetReadFile(), InternetReadFileExA(), InternetReadFileExW(), InternetSetOptionW(), InternetSetStatusCallbackA(), InternetSetStatusCallbackW(), InternetWriteFile(), and invalidate_handle().

Variable Documentation

◆ DECLSPEC_HIDDEN

HMODULE WININET_hModule DECLSPEC_HIDDEN

Definition at line 155 of file crypt32_private.h.

◆ len

Initial value:
{
#define GetProcessHeap()
Definition: compat.h:395
GLenum GLsizei len
Definition: glext.h:6722
#define HeapReAlloc
Definition: compat.h:393
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
Definition: mem.c:156

Definition at line 94 of file internet.h.

Referenced by heap_strdupAtoW(), heap_strndupAtoW(), and heap_strndupW().