2 * Copyright (C) 2007 Francois Gouget
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.
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.
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
19 #ifndef __WINE_WINHTTP_H
20 #define __WINE_WINHTTP_H
23 #define BOOLAPI WINHTTPAPI BOOL WINAPI
26 typedef LPVOID HINTERNET
;
27 typedef HINTERNET
*LPHINTERNET
;
29 #define INTERNET_DEFAULT_PORT 0
30 #define INTERNET_DEFAULT_HTTP_PORT 80
31 #define INTERNET_DEFAULT_HTTPS_PORT 443
32 typedef WORD INTERNET_PORT
;
33 typedef INTERNET_PORT
*LPINTERNET_PORT
;
35 #define INTERNET_SCHEME_HTTP 1
36 #define INTERNET_SCHEME_HTTPS 2
37 typedef int INTERNET_SCHEME
, *LPINTERNET_SCHEME
;
39 /* flags for WinHttpOpen */
40 #define WINHTTP_FLAG_ASYNC 0x10000000
42 /* flags for WinHttpOpenRequest */
43 #define WINHTTP_FLAG_ESCAPE_PERCENT 0x00000004
44 #define WINHTTP_FLAG_NULL_CODEPAGE 0x00000008
45 #define WINHTTP_FLAG_ESCAPE_DISABLE 0x00000040
46 #define WINHTTP_FLAG_ESCAPE_DISABLE_QUERY 0x00000080
47 #define WINHTTP_FLAG_BYPASS_PROXY_CACHE 0x00000100
48 #define WINHTTP_FLAG_REFRESH WINHTTP_FLAG_BYPASS_PROXY_CACHE
49 #define WINHTTP_FLAG_SECURE 0x00800000
51 #define WINHTTP_ACCESS_TYPE_DEFAULT_PROXY 0
52 #define WINHTTP_ACCESS_TYPE_NO_PROXY 1
53 #define WINHTTP_ACCESS_TYPE_NAMED_PROXY 3
55 #define WINHTTP_NO_PROXY_NAME NULL
56 #define WINHTTP_NO_PROXY_BYPASS NULL
58 #define WINHTTP_NO_REFERER NULL
59 #define WINHTTP_DEFAULT_ACCEPT_TYPES NULL
61 /* flags for WinHttp{Set/Query}Options */
62 #define WINHTTP_FIRST_OPTION WINHTTP_OPTION_CALLBACK
63 #define WINHTTP_OPTION_CALLBACK 1
64 #define WINHTTP_OPTION_RESOLVE_TIMEOUT 2
65 #define WINHTTP_OPTION_CONNECT_TIMEOUT 3
66 #define WINHTTP_OPTION_CONNECT_RETRIES 4
67 #define WINHTTP_OPTION_SEND_TIMEOUT 5
68 #define WINHTTP_OPTION_RECEIVE_TIMEOUT 6
69 #define WINHTTP_OPTION_RECEIVE_RESPONSE_TIMEOUT 7
70 #define WINHTTP_OPTION_HANDLE_TYPE 9
71 #define WINHTTP_OPTION_READ_BUFFER_SIZE 12
72 #define WINHTTP_OPTION_WRITE_BUFFER_SIZE 13
73 #define WINHTTP_OPTION_PARENT_HANDLE 21
74 #define WINHTTP_OPTION_EXTENDED_ERROR 24
75 #define WINHTTP_OPTION_SECURITY_FLAGS 31
76 #define WINHTTP_OPTION_SECURITY_CERTIFICATE_STRUCT 32
77 #define WINHTTP_OPTION_URL 34
78 #define WINHTTP_OPTION_SECURITY_KEY_BITNESS 36
79 #define WINHTTP_OPTION_PROXY 38
80 #define WINHTTP_OPTION_USER_AGENT 41
81 #define WINHTTP_OPTION_CONTEXT_VALUE 45
82 #define WINHTTP_OPTION_CLIENT_CERT_CONTEXT 47
83 #define WINHTTP_OPTION_REQUEST_PRIORITY 58
84 #define WINHTTP_OPTION_HTTP_VERSION 59
85 #define WINHTTP_OPTION_DISABLE_FEATURE 63
86 #define WINHTTP_OPTION_CODEPAGE 68
87 #define WINHTTP_OPTION_MAX_CONNS_PER_SERVER 73
88 #define WINHTTP_OPTION_MAX_CONNS_PER_1_0_SERVER 74
89 #define WINHTTP_OPTION_AUTOLOGON_POLICY 77
90 #define WINHTTP_OPTION_SERVER_CERT_CONTEXT 78
91 #define WINHTTP_OPTION_ENABLE_FEATURE 79
92 #define WINHTTP_OPTION_WORKER_THREAD_COUNT 80
93 #define WINHTTP_OPTION_PASSPORT_COBRANDING_TEXT 81
94 #define WINHTTP_OPTION_PASSPORT_COBRANDING_URL 82
95 #define WINHTTP_OPTION_CONFIGURE_PASSPORT_AUTH 83
96 #define WINHTTP_OPTION_SECURE_PROTOCOLS 84
97 #define WINHTTP_OPTION_ENABLETRACING 85
98 #define WINHTTP_OPTION_PASSPORT_SIGN_OUT 86
99 #define WINHTTP_OPTION_PASSPORT_RETURN_URL 87
100 #define WINHTTP_OPTION_REDIRECT_POLICY 88
101 #define WINHTTP_OPTION_MAX_HTTP_AUTOMATIC_REDIRECTS 89
102 #define WINHTTP_OPTION_MAX_HTTP_STATUS_CONTINUE 90
103 #define WINHTTP_OPTION_MAX_RESPONSE_HEADER_SIZE 91
104 #define WINHTTP_OPTION_MAX_RESPONSE_DRAIN_SIZE 92
105 #define WINHTTP_OPTION_CONNECTION_INFO 93
106 #define WINHTTP_OPTION_CLIENT_CERT_ISSUER_LIST 94
107 #define WINHTTP_OPTION_SPN 96
108 #define WINHTTP_OPTION_GLOBAL_PROXY_CREDS 97
109 #define WINHTTP_OPTION_GLOBAL_SERVER_CREDS 98
110 #define WINHTTP_OPTION_UNLOAD_NOTIFY_EVENT 99
111 #define WINHTTP_OPTION_REJECT_USERPWD_IN_URL 100
112 #define WINHTTP_OPTION_USE_GLOBAL_SERVER_CREDENTIALS 101
113 #define WINHTTP_LAST_OPTION WINHTTP_OPTION_USE_GLOBAL_SERVER_CREDENTIALS
114 #define WINHTTP_OPTION_USERNAME 0x1000
115 #define WINHTTP_OPTION_PASSWORD 0x1001
116 #define WINHTTP_OPTION_PROXY_USERNAME 0x1002
117 #define WINHTTP_OPTION_PROXY_PASSWORD 0x1003
119 /* Options for WinHttpOpenRequest */
120 #define WINHTTP_NO_REFERER NULL
121 #define WINHTTP_DEFAULT_ACCEPT_TYPES NULL
123 /* Options for WinHttpSendRequest */
124 #define WINHTTP_NO_ADDITIONAL_HEADERS NULL
125 #define WINHTTP_NO_REQUEST_DATA NULL
127 /* WinHTTP error codes */
128 #define WINHTTP_ERROR_BASE 12000
129 #define ERROR_WINHTTP_OUT_OF_HANDLES (WINHTTP_ERROR_BASE + 1)
130 #define ERROR_WINHTTP_TIMEOUT (WINHTTP_ERROR_BASE + 2)
131 #define ERROR_WINHTTP_INTERNAL_ERROR (WINHTTP_ERROR_BASE + 4)
132 #define ERROR_WINHTTP_INVALID_URL (WINHTTP_ERROR_BASE + 5)
133 #define ERROR_WINHTTP_UNRECOGNIZED_SCHEME (WINHTTP_ERROR_BASE + 6)
134 #define ERROR_WINHTTP_NAME_NOT_RESOLVED (WINHTTP_ERROR_BASE + 7)
135 #define ERROR_WINHTTP_INVALID_OPTION (WINHTTP_ERROR_BASE + 9)
136 #define ERROR_WINHTTP_OPTION_NOT_SETTABLE (WINHTTP_ERROR_BASE + 11)
137 #define ERROR_WINHTTP_SHUTDOWN (WINHTTP_ERROR_BASE + 12)
138 #define ERROR_WINHTTP_LOGIN_FAILURE (WINHTTP_ERROR_BASE + 15)
139 #define ERROR_WINHTTP_OPERATION_CANCELLED (WINHTTP_ERROR_BASE + 17)
140 #define ERROR_WINHTTP_INCORRECT_HANDLE_TYPE (WINHTTP_ERROR_BASE + 18)
141 #define ERROR_WINHTTP_INCORRECT_HANDLE_STATE (WINHTTP_ERROR_BASE + 19)
142 #define ERROR_WINHTTP_CANNOT_CONNECT (WINHTTP_ERROR_BASE + 29)
143 #define ERROR_WINHTTP_CONNECTION_ERROR (WINHTTP_ERROR_BASE + 30)
144 #define ERROR_WINHTTP_RESEND_REQUEST (WINHTTP_ERROR_BASE + 32)
145 #define ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED (WINHTTP_ERROR_BASE + 44)
146 #define ERROR_WINHTTP_CANNOT_CALL_BEFORE_OPEN (WINHTTP_ERROR_BASE + 100)
147 #define ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND (WINHTTP_ERROR_BASE + 101)
148 #define ERROR_WINHTTP_CANNOT_CALL_AFTER_SEND (WINHTTP_ERROR_BASE + 102)
149 #define ERROR_WINHTTP_CANNOT_CALL_AFTER_OPEN (WINHTTP_ERROR_BASE + 103)
150 #define ERROR_WINHTTP_HEADER_NOT_FOUND (WINHTTP_ERROR_BASE + 150)
151 #define ERROR_WINHTTP_INVALID_SERVER_RESPONSE (WINHTTP_ERROR_BASE + 152)
152 #define ERROR_WINHTTP_INVALID_HEADER (WINHTTP_ERROR_BASE + 153)
153 #define ERROR_WINHTTP_INVALID_QUERY_REQUEST (WINHTTP_ERROR_BASE + 154)
154 #define ERROR_WINHTTP_HEADER_ALREADY_EXISTS (WINHTTP_ERROR_BASE + 155)
155 #define ERROR_WINHTTP_REDIRECT_FAILED (WINHTTP_ERROR_BASE + 156)
156 #define ERROR_WINHTTP_BAD_AUTO_PROXY_SCRIPT (WINHTTP_ERROR_BASE + 166)
157 #define ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT (WINHTTP_ERROR_BASE + 167)
158 #define ERROR_WINHTTP_NOT_INITIALIZED (WINHTTP_ERROR_BASE + 172)
159 #define ERROR_WINHTTP_SECURE_FAILURE (WINHTTP_ERROR_BASE + 175)
160 #define ERROR_WINHTTP_AUTO_PROXY_SERVICE_ERROR (WINHTTP_ERROR_BASE + 178)
161 #define ERROR_WINHTTP_AUTODETECTION_FAILED (WINHTTP_ERROR_BASE + 180)
163 /* WinHttp status codes */
164 #define HTTP_STATUS_CONTINUE 100
165 #define HTTP_STATUS_SWITCH_PROTOCOLS 101
166 #define HTTP_STATUS_OK 200
167 #define HTTP_STATUS_CREATED 201
168 #define HTTP_STATUS_ACCEPTED 202
169 #define HTTP_STATUS_PARTIAL 203
170 #define HTTP_STATUS_NO_CONTENT 204
171 #define HTTP_STATUS_RESET_CONTENT 205
172 #define HTTP_STATUS_PARTIAL_CONTENT 206
173 #define HTTP_STATUS_WEBDAV_MULTI_STATUS 207
174 #define HTTP_STATUS_AMBIGUOUS 300
175 #define HTTP_STATUS_MOVED 301
176 #define HTTP_STATUS_REDIRECT 302
177 #define HTTP_STATUS_REDIRECT_METHOD 303
178 #define HTTP_STATUS_NOT_MODIFIED 304
179 #define HTTP_STATUS_USE_PROXY 305
180 #define HTTP_STATUS_REDIRECT_KEEP_VERB 307
181 #define HTTP_STATUS_BAD_REQUEST 400
182 #define HTTP_STATUS_DENIED 401
183 #define HTTP_STATUS_PAYMENT_REQ 402
184 #define HTTP_STATUS_FORBIDDEN 403
185 #define HTTP_STATUS_NOT_FOUND 404
186 #define HTTP_STATUS_BAD_METHOD 405
187 #define HTTP_STATUS_NONE_ACCEPTABLE 406
188 #define HTTP_STATUS_PROXY_AUTH_REQ 407
189 #define HTTP_STATUS_REQUEST_TIMEOUT 408
190 #define HTTP_STATUS_CONFLICT 409
191 #define HTTP_STATUS_GONE 410
192 #define HTTP_STATUS_LENGTH_REQUIRED 411
193 #define HTTP_STATUS_PRECOND_FAILED 412
194 #define HTTP_STATUS_REQUEST_TOO_LARGE 413
195 #define HTTP_STATUS_URI_TOO_LONG 414
196 #define HTTP_STATUS_UNSUPPORTED_MEDIA 415
197 #define HTTP_STATUS_RETRY_WITH 449
198 #define HTTP_STATUS_SERVER_ERROR 500
199 #define HTTP_STATUS_NOT_SUPPORTED 501
200 #define HTTP_STATUS_BAD_GATEWAY 502
201 #define HTTP_STATUS_SERVICE_UNAVAIL 503
202 #define HTTP_STATUS_GATEWAY_TIMEOUT 504
203 #define HTTP_STATUS_VERSION_NOT_SUP 505
204 #define HTTP_STATUS_FIRST HTTP_STATUS_CONTINUE
205 #define HTTP_STATUS_LAST HTTP_STATUS_VERSION_NOT_SUP
211 DWORD dwSchemeLength
;
212 INTERNET_SCHEME nScheme
;
214 DWORD dwHostNameLength
;
217 DWORD dwUserNameLength
;
219 DWORD dwPasswordLength
;
221 DWORD dwUrlPathLength
;
222 LPWSTR lpszExtraInfo
;
223 DWORD dwExtraInfoLength
;
224 } URL_COMPONENTS
, *LPURL_COMPONENTS
;
225 typedef URL_COMPONENTS URL_COMPONENTSW
;
226 typedef LPURL_COMPONENTS LPURL_COMPONENTSW
;
232 } WINHTTP_ASYNC_RESULT
, *LPWINHTTP_ASYNC_RESULT
;
238 LPWSTR lpszSubjectInfo
;
239 LPWSTR lpszIssuerInfo
;
240 LPWSTR lpszProtocolName
;
241 LPWSTR lpszSignatureAlgName
;
242 LPWSTR lpszEncryptionAlgName
;
244 } WINHTTP_CERTIFICATE_INFO
;
250 LPCWSTR lpszProxyBypass
;
251 } WINHTTP_PROXY_INFO
, *LPWINHTTP_PROXY_INFO
;
252 typedef WINHTTP_PROXY_INFO WINHTTP_PROXY_INFOW
;
253 typedef LPWINHTTP_PROXY_INFO LPWINHTTP_PROXY_INFOW
;
258 LPWSTR lpszAutoConfigUrl
;
260 LPWSTR lpszProxyBypass
;
261 } WINHTTP_CURRENT_USER_IE_PROXY_CONFIG
;
263 typedef VOID (CALLBACK
*WINHTTP_STATUS_CALLBACK
)(HINTERNET
,DWORD_PTR
,DWORD
,LPVOID
,DWORD
);
268 DWORD dwAutoDetectFlags
;
269 LPCWSTR lpszAutoConfigUrl
;
272 BOOL fAutoLogonIfChallenged
;
273 } WINHTTP_AUTOPROXY_OPTIONS
;
277 DWORD dwMajorVersion
;
278 DWORD dwMinorVersion
;
279 } HTTP_VERSION_INFO
, *LPHTTP_VERSION_INFO
;
286 BOOL WINAPI
WinHttpAddRequestHeaders(HINTERNET
,LPCWSTR
,DWORD
,DWORD
);
287 BOOL WINAPI
WinHttpDetectAutoProxyConfigUrl(DWORD
,LPWSTR
*);
288 BOOL WINAPI
WinHttpCheckPlatform(void);
289 BOOL WINAPI
WinHttpCloseHandle(HINTERNET
);
290 HINTERNET WINAPI
WinHttpConnect(HINTERNET
,LPCWSTR
,INTERNET_PORT
,DWORD
);
291 BOOL WINAPI
WinHttpCrackUrl(LPCWSTR
,DWORD
,DWORD
,LPURL_COMPONENTS
);
292 BOOL WINAPI
WinHttpCreateUrl(LPURL_COMPONENTS
,DWORD
,LPWSTR
,LPDWORD
);
293 BOOL WINAPI
WinHttpGetDefaultProxyConfiguration(WINHTTP_PROXY_INFO
*);
294 BOOL WINAPI
WinHttpGetIEProxyConfigForCurrentUser(WINHTTP_CURRENT_USER_IE_PROXY_CONFIG
* config
);
295 BOOL WINAPI
WinHttpGetProxyForUrl(HINTERNET
,LPCWSTR
,WINHTTP_AUTOPROXY_OPTIONS
*,WINHTTP_PROXY_INFO
*);
296 HINTERNET WINAPI
WinHttpOpen(LPCWSTR
,DWORD
,LPCWSTR
,LPCWSTR
,DWORD
);
297 HINTERNET WINAPI
WinHttpOpenRequest(HINTERNET
,LPCWSTR
,LPCWSTR
,LPCWSTR
,LPCWSTR
,LPCWSTR
*,DWORD
);
298 BOOL WINAPI
WinHttpQueryAuthParams(HINTERNET
,DWORD
,LPVOID
*);
299 BOOL WINAPI
WinHttpQueryAuthSchemes(HINTERNET
,LPDWORD
,LPDWORD
,LPDWORD
);
300 BOOL WINAPI
WinHttpQueryDataAvailable(HINTERNET
,LPDWORD
);
301 BOOL WINAPI
WinHttpQueryHeaders(HINTERNET
,DWORD
,LPCWSTR
,LPVOID
,LPDWORD
,LPDWORD
);
302 BOOL WINAPI
WinHttpReadData(HINTERNET
,LPVOID
,DWORD
,LPDWORD
);
303 BOOL WINAPI
WinHttpReceiveResponse(HINTERNET
,LPVOID
);
304 BOOL WINAPI
WinHttpSendRequest(HINTERNET
,LPCWSTR
,DWORD
,LPVOID
,DWORD
,DWORD
,DWORD_PTR
);
305 BOOL WINAPI
WinHttpSetDefaultProxyConfiguration(WINHTTP_PROXY_INFO
*);
306 BOOL WINAPI
WinHttpSetCredentials(HINTERNET
,DWORD
,DWORD
,LPCWSTR
,LPCWSTR
,LPVOID
);
307 BOOL WINAPI
WinHttpSetOption(HINTERNET
,DWORD
,LPVOID
,DWORD
);
308 WINHTTP_STATUS_CALLBACK WINAPI
WinHttpSetStatusCallback(HINTERNET
,WINHTTP_STATUS_CALLBACK
,DWORD
,DWORD_PTR
);
309 BOOL WINAPI
WinHttpSetTimeouts(HINTERNET
,int,int,int,int);
310 BOOL WINAPI
WinHttpTimeFromSystemTime(CONST SYSTEMTIME
*,LPWSTR
);
311 BOOL WINAPI
WinHttpTimeToSystemTime(LPCWSTR
,SYSTEMTIME
*);
312 BOOL WINAPI
WinHttpWriteData(HINTERNET
,LPCVOID
,DWORD
,LPDWORD
);
318 #endif /* __WINE_WINHTTP_H */