ReactOS 0.4.16-dev-401-g45b008d
winhttp_private.h
Go to the documentation of this file.
1/*
2 * Copyright 2008 Hans Leidekker for CodeWeavers
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19#ifndef _WINE_WINHTTP_PRIVATE_H_
20#define _WINE_WINHTTP_PRIVATE_H_
21
22#ifndef __WINE_CONFIG_H
23# error You must include config.h to use this header
24#endif
25
26#include "wine/heap.h"
27#include "wine/list.h"
28#include "wine/unicode.h"
29
30#include "ole2.h"
31#include "sspi.h"
32#include "wincrypt.h"
33
34static const WCHAR getW[] = {'G','E','T',0};
35static const WCHAR postW[] = {'P','O','S','T',0};
36static const WCHAR headW[] = {'H','E','A','D',0};
37static const WCHAR slashW[] = {'/',0};
38static const WCHAR http1_0[] = {'H','T','T','P','/','1','.','0',0};
39static const WCHAR http1_1[] = {'H','T','T','P','/','1','.','1',0};
40static const WCHAR chunkedW[] = {'c','h','u','n','k','e','d',0};
41
42struct object_header;
44{
45 void (*destroy)( struct object_header * );
46 BOOL (*query_option)( struct object_header *, DWORD, void *, DWORD * );
47 BOOL (*set_option)( struct object_header *, DWORD, void *, DWORD );
48};
49
51{
54 const struct object_vtbl *vtbl;
64 struct list entry;
65 struct list children;
66};
67
69{
70 struct list entry;
76};
77
78struct session
79{
97};
98
99struct connect
100{
103 WCHAR *hostname; /* final destination of the request */
104 WCHAR *servername; /* name of the server we directly connect to */
111};
112
114{
115 struct list entry;
118 BOOL secure; /* SSL active on connection? */
119 struct hostdata *host;
123 char *ssl_buf;
125 size_t extra_len;
126 char *peek_msg;
128 size_t peek_len;
129};
130
131struct header
132{
135 BOOL is_request; /* part of request headers? */
136};
137
139{
145
147{
156
157struct authinfo
158{
163 ULONG attr;
165 char *data;
166 unsigned int data_len;
167 BOOL finished; /* finished authenticating */
168};
169
170struct request
171{
178 void *optional;
193 DWORD content_length; /* total number of bytes to be read */
194 DWORD content_read; /* bytes read so far */
195 BOOL read_chunked; /* are we reading in chunked mode? */
196 BOOL read_chunked_eof; /* end of stream in chunked mode */
197 BOOL read_chunked_size; /* chunk size remaining */
198 DWORD read_pos; /* current read position in read_buf */
199 DWORD read_size; /* valid data size in read_buf */
200 char read_buf[8192]; /* buffer for already read but not returned data */
207#ifdef __REACTOS__
208 HANDLE task_thread;
209#else
211#endif
214 struct
215 {
219};
220
222{
223 struct list entry;
225 void (*proc)( struct task_header * );
226};
227
229{
233 void *optional;
237};
238
240{
242};
243
245{
248};
249
251{
253 void *buffer;
256};
257
259{
261 const void *buffer;
264};
265
271
274
275void netconn_close( struct netconn * ) DECLSPEC_HIDDEN;
276struct netconn *netconn_create( struct hostdata *, const struct sockaddr_storage *, int ) DECLSPEC_HIDDEN;
279BOOL netconn_recv( struct netconn *, void *, size_t, int, int * ) DECLSPEC_HIDDEN;
282BOOL netconn_send( struct netconn *, const void *, size_t, int * ) DECLSPEC_HIDDEN;
285const void *netconn_get_certificate( struct netconn * ) DECLSPEC_HIDDEN;
287
288BOOL set_cookies( struct request *, const WCHAR * ) DECLSPEC_HIDDEN;
294
295void release_host( struct hostdata * ) DECLSPEC_HIDDEN;
296BOOL process_header( struct request *, const WCHAR *, const WCHAR *, DWORD, BOOL ) DECLSPEC_HIDDEN;
297
300
301static inline void* __WINE_ALLOC_SIZE(2) heap_realloc_zero( LPVOID mem, SIZE_T size )
302{
304}
305
306static inline WCHAR *strdupW( const WCHAR *src )
307{
308 WCHAR *dst;
309
310 if (!src) return NULL;
311 dst = heap_alloc( (strlenW( src ) + 1) * sizeof(WCHAR) );
312 if (dst) strcpyW( dst, src );
313 return dst;
314}
315
316static inline WCHAR *strdupAW( const char *src )
317{
318 WCHAR *dst = NULL;
319 if (src)
320 {
321 DWORD len = MultiByteToWideChar( CP_ACP, 0, src, -1, NULL, 0 );
322 if ((dst = heap_alloc( len * sizeof(WCHAR) )))
323 MultiByteToWideChar( CP_ACP, 0, src, -1, dst, len );
324 }
325 return dst;
326}
327
328static inline char *strdupWA( const WCHAR *src )
329{
330 char *dst = NULL;
331 if (src)
332 {
333 int len = WideCharToMultiByte( CP_ACP, 0, src, -1, NULL, 0, NULL, NULL );
334 if ((dst = heap_alloc( len )))
336 }
337 return dst;
338}
339
340static inline char *strdupWA_sized( const WCHAR *src, DWORD size )
341{
342 char *dst = NULL;
343 if (src)
344 {
345 int len = WideCharToMultiByte( CP_ACP, 0, src, size, NULL, 0, NULL, NULL ) + 1;
346 if ((dst = heap_alloc( len )))
347 {
349 dst[len - 1] = 0;
350 }
351 }
352 return dst;
353}
354
356
357#endif /* _WINE_WINHTTP_PRIVATE_H_ */
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
Definition: list.h:37
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define HeapReAlloc
Definition: compat.h:734
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
HINSTANCE winhttp_instance
Definition: main.c:34
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizeiptr size
Definition: glext.h:5919
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
GLenum GLsizei len
Definition: glext.h:6722
static void close_connection(void)
Definition: http.c:5576
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
long LONG
Definition: pedump.c:60
#define strlenW(s)
Definition: unicode.h:34
#define strcpyW(d, s)
Definition: unicode.h:35
enum auth_scheme scheme
char * data
CredHandle cred
CtxtHandle ctx
TimeStamp exp
unsigned int data_len
ULONG max_token
WCHAR * hostname
struct session * session
WCHAR * password
WCHAR * servername
INTERNET_PORT hostport
WCHAR * username
INTERNET_PORT serverport
struct object_header hdr
WCHAR * field
BOOL is_request
WCHAR * value
INTERNET_PORT port
struct list connections
struct list entry
WCHAR * hostname
Definition: mem.c:349
SecPkgContext_StreamSizes ssl_sizes
char * peek_msg
struct hostdata * host
struct list entry
char * extra_buf
char * peek_msg_mem
CtxtHandle ssl_ctx
char * ssl_buf
ULONGLONG keep_until
size_t extra_len
size_t peek_len
WINHTTP_STATUS_CALLBACK callback
struct list children
DWORD_PTR context
HINTERNET handle
const struct object_vtbl * vtbl
struct list entry
BOOL(* set_option)(struct object_header *, DWORD, void *, DWORD)
void(* destroy)(struct object_header *)
BOOL(* query_option)(struct object_header *, DWORD, void *, DWORD *)
struct task_header hdr
DWORD * available
DWORD * read
struct task_header hdr
struct task_header hdr
Definition: tftpd.h:86
HANDLE task_cancel
DWORD content_read
DWORD read_size
HANDLE task_wait
BOOL task_proc_running
DWORD optional_len
const CERT_CONTEXT * server_cert
struct list task_queue
WCHAR * version
const CERT_CONTEXT * client_cert
int send_timeout
struct header * headers
struct object_header hdr
struct request::@604 creds[TARGET_MAX][SCHEME_MAX]
WCHAR * verb
DWORD security_flags
struct authinfo * authinfo
DWORD num_headers
CredHandle cred_handle
WCHAR * path
WCHAR * password
WCHAR * status_text
void * optional
int receive_timeout
BOOL check_revocation
WCHAR * username
int connect_timeout
int resolve_timeout
WCHAR * raw_headers
CRITICAL_SECTION task_cs
struct connect * connect
DWORD read_pos
char read_buf[8192]
BOOL read_chunked
int receive_response_timeout
BOOL read_chunked_size
BOOL cred_handle_initialized
struct netconn * netconn
DWORD content_length
struct authinfo * proxy_authinfo
BOOL read_chunked_eof
struct task_header hdr
DWORD_PTR context
int resolve_timeout
WCHAR * proxy_password
DWORD passport_flags
WCHAR * proxy_bypass
int receive_response_timeout
CRITICAL_SECTION cs
int receive_timeout
DWORD access
HANDLE unload_event
DWORD secure_protocols
WCHAR * agent
WCHAR * proxy_server
struct object_header hdr
int send_timeout
WCHAR * proxy_username
int connect_timeout
struct list cookie_cache
struct request * request
struct list entry
void(* proc)(struct task_header *)
const void * buffer
DWORD * written
struct task_header hdr
uint32_t DWORD_PTR
Definition: typedefs.h:65
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
WORD INTERNET_PORT
Definition: winhttp.h:38
VOID(CALLBACK * WINHTTP_STATUS_CALLBACK)(_In_ HINTERNET, _In_ DWORD_PTR, _In_ DWORD, _In_ LPVOID, _In_ DWORD)
Definition: winhttp.h:520
BOOL add_cookie_headers(struct request *) DECLSPEC_HIDDEN
Definition: cookie.c:324
BOOL process_header(struct request *, const WCHAR *, const WCHAR *, DWORD, BOOL) DECLSPEC_HIDDEN
Definition: request.c:430
BOOL add_request_headers(struct request *, const WCHAR *, DWORD, DWORD) DECLSPEC_HIDDEN
Definition: request.c:495
static const WCHAR http1_1[]
HINSTANCE winhttp_instance DECLSPEC_HIDDEN
BOOL netconn_recv(struct netconn *, void *, size_t, int, int *) DECLSPEC_HIDDEN
Definition: net.c:539
void send_callback(struct object_header *, DWORD, LPVOID, DWORD) DECLSPEC_HIDDEN
static char * strdupWA(const WCHAR *src)
BOOL set_server_for_hostname(struct connect *, const WCHAR *, INTERNET_PORT) DECLSPEC_HIDDEN
Definition: session.c:476
BOOL netconn_is_alive(struct netconn *) DECLSPEC_HIDDEN
Definition: net.c:608
static char * strdupWA_sized(const WCHAR *src, DWORD size)
const void * netconn_get_certificate(struct netconn *) DECLSPEC_HIDDEN
Definition: net.c:758
static const WCHAR postW[]
BOOL netconn_resolve(WCHAR *, INTERNET_PORT, struct sockaddr_storage *, int) DECLSPEC_HIDDEN
Definition: net.c:725
ULONG netconn_query_data_available(struct netconn *) DECLSPEC_HIDDEN
Definition: net.c:591
auth_target
@ TARGET_MAX
@ TARGET_INVALID
@ TARGET_SERVER
@ TARGET_PROXY
static const WCHAR getW[]
BOOL free_handle(HINTERNET) DECLSPEC_HIDDEN
Definition: handle.c:123
struct netconn * netconn_create(struct hostdata *, const struct sockaddr_storage *, int) DECLSPEC_HIDDEN
Definition: net.c:186
int netconn_get_cipher_strength(struct netconn *) DECLSPEC_HIDDEN
Definition: net.c:768
struct object_header * addref_object(struct object_header *) DECLSPEC_HIDDEN
Definition: handle.c:49
void netconn_unload(void) DECLSPEC_HIDDEN
Definition: net.c:156
static WCHAR * strdupAW(const char *src)
BOOL netconn_secure_connect(struct netconn *, WCHAR *, DWORD, CredHandle *, BOOL) DECLSPEC_HIDDEN
Definition: net.c:264
static const WCHAR slashW[]
void release_object(struct object_header *) DECLSPEC_HIDDEN
Definition: handle.c:72
void release_host(struct hostdata *) DECLSPEC_HIDDEN
Definition: request.c:1494
static const WCHAR http1_0[]
auth_scheme
@ SCHEME_BASIC
@ SCHEME_PASSPORT
@ SCHEME_DIGEST
@ SCHEME_INVALID
@ SCHEME_NTLM
@ SCHEME_NEGOTIATE
@ SCHEME_MAX
void destroy_cookies(struct session *) DECLSPEC_HIDDEN
Definition: cookie.c:120
void release_typelib(void) DECLSPEC_HIDDEN
Definition: apps.c:159
static const WCHAR headW[]
BOOL set_cookies(struct request *, const WCHAR *) DECLSPEC_HIDDEN
Definition: cookie.c:263
DWORD netconn_set_timeout(struct netconn *, BOOL, int) DECLSPEC_HIDDEN
Definition: net.c:596
struct object_header * grab_object(HINTERNET) DECLSPEC_HIDDEN
Definition: handle.c:56
static WCHAR * strdupW(const WCHAR *src)
void destroy_authinfo(struct authinfo *) DECLSPEC_HIDDEN
Definition: request.c:1138
HRESULT WinHttpRequest_create(void **) DECLSPEC_HIDDEN
Definition: request.c:4782
HINTERNET alloc_handle(struct object_header *) DECLSPEC_HIDDEN
Definition: handle.c:88
static const WCHAR chunkedW[]
BOOL netconn_send(struct netconn *, const void *, size_t, int *) DECLSPEC_HIDDEN
Definition: net.c:424
void netconn_close(struct netconn *) DECLSPEC_HIDDEN
Definition: net.c:250
#define __WINE_ALLOC_SIZE(x)
Definition: winnt_old.h:84
__wchar_t WCHAR
Definition: xmlstorage.h:180