1 /** 2 * Windows API header module 3 * 4 * Translated from Windows SDK Headers 5 * 6 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) 7 * Source: $(DRUNTIMESRC core/sys/windows/_winhttp.d) 8 */ 9 module core.sys.windows.winhttp; 10 version (Windows): 11 pragma(lib, "winhttp"); 12 // FIXME: Grouping of constants. Windows SDK doesn't make this entirely clear 13 // FIXME: Verify WINHTTP_STATUS_CALLBACK function declaration works correctly 14 15 import core.sys.windows.w32api; 16 import core.sys.windows.winbase; 17 import core.sys.windows.windef; 18 import core.sys.windows.winsock2; // Selective Imports BUG (: SOCKADDR_STORAGE;) 19 20 alias HINTERNET = void*; 21 alias LPHINTERNET = HINTERNET*; 22 alias INTERNET_PORT = WORD; 23 alias LPINTERNET_PORT = INTERNET_PORT*; 24 alias INTERNET_SCHEME = int; 25 alias LPINTERNET_SCHEME = INTERNET_SCHEME*; 26 27 // Protocol 'Manifests' 28 enum : DWORD { 29 INTERNET_DEFAULT_PORT = 0, 30 INTERNET_DEFAULT_HTTP_PORT = 80, 31 INTERNET_DEFAULT_HTTPS_PORT = 443 32 } 33 34 // WinHttpOpen() Flags: 35 enum DWORD WINHTTP_FLAG_ASYNC = 0x10000000; 36 37 // WinHttpOpenRequest() Flags: 38 enum : DWORD { 39 WINHTTP_FLAG_SECURE = 0x00800000, 40 WINHTTP_FLAG_ESCAPE_PERCENT = 0x00000004, 41 WINHTTP_FLAG_NULL_CODEPAGE = 0x00000008, 42 WINHTTP_FLAG_BYPASS_PROXY_CACHE = 0x00000100, 43 WINHTTP_FLAG_REFRESH = WINHTTP_FLAG_BYPASS_PROXY_CACHE, 44 WINHTTP_FLAG_ESCAPE_DISABLE = 0x00000040, 45 WINHTTP_FLAG_ESCAPE_DISABLE_QUERY = 0x00000080, 46 47 SECURITY_FLAG_IGNORE_UNKNOWN_CA = 0x00000100, 48 SECURITY_FLAG_IGNORE_CERT_DATE_INVALID = 0x00002000, 49 SECURITY_FLAG_IGNORE_CERT_CN_INVALID = 0x00001000, 50 SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE = 0x00000200 51 } 52 53 struct WINHTTP_ASYNC_RESULT { 54 DWORD_PTR dwResult; 55 DWORD dwError; 56 } 57 alias LPWINHTTP_ASYNC_RESULT = WINHTTP_ASYNC_RESULT*; 58 59 struct HTTP_VERSION_INFO { 60 DWORD dwMajorVersion; 61 DWORD dwMinorVersion; 62 } 63 alias LPHTTP_VERSION_INFO = HTTP_VERSION_INFO*; 64 65 // URL Scheme 66 enum : DWORD { 67 INTERNET_SCHEME_HTTP = 1, 68 INTERNET_SCHEME_HTTPS = 2, 69 INTERNET_SCHEME_FTP = 3, 70 INTERNET_SCHEME_SOCKS = 4 71 } 72 73 struct URL_COMPONENTS { 74 DWORD dwStructSize; 75 LPWSTR lpszScheme; 76 DWORD dwSchemeLength; 77 INTERNET_SCHEME nScheme; 78 LPWSTR lpszHostName; 79 DWORD dwHostNameLength; 80 INTERNET_PORT nPort; 81 LPWSTR lpszUserName; 82 DWORD dwUserNameLength; 83 LPWSTR lpszPassword; 84 DWORD dwPasswordLength; 85 LPWSTR lpszUrlPath; 86 DWORD dwUrlPathLength; 87 LPWSTR lpszExtraInfo; 88 DWORD dwExtraInfoLength; 89 } 90 alias LPURL_COMPONENTS = URL_COMPONENTS*; 91 alias URL_COMPONENTSW = URL_COMPONENTS; 92 alias LPURL_COMPONENTSW = URL_COMPONENTS*; 93 94 struct WINHTTP_PROXY_INFO { 95 DWORD dwAccessType; 96 LPWSTR lpszProxy; 97 LPWSTR lpszProxyBypass; 98 } 99 alias LPWINHTTP_PROXY_INFO = WINHTTP_PROXY_INFO*; 100 alias WINHTTP_PROXY_INFOW = WINHTTP_PROXY_INFO; 101 alias LPWINHTTP_PROXY_INFOW = WINHTTP_PROXY_INFO*; 102 103 struct WINHTTP_AUTOPROXY_OPTIONS { 104 DWORD dwFlags; 105 DWORD dwAutoDetectFlags; 106 LPCWSTR lpszAutoConfigUrl; 107 LPVOID lpvReserved; 108 DWORD dwReserved; 109 BOOL fAutoLogonIfChallenged; 110 } 111 112 enum : DWORD { 113 WINHTTP_AUTOPROXY_AUTO_DETECT = 0x00000001, 114 WINHTTP_AUTOPROXY_CONFIG_URL = 0x00000002, 115 WINHTTP_AUTOPROXY_HOST_KEEPCASE = 0x00000004, 116 WINHTTP_AUTOPROXY_HOST_LOWERCASE = 0x00000008, 117 WINHTTP_AUTOPROXY_RUN_INPROCESS = 0x00010000, 118 WINHTTP_AUTOPROXY_RUN_OUTPROCESS_ONLY = 0x00020000, 119 WINHTTP_AUTOPROXY_NO_DIRECTACCESS = 0x00040000, 120 WINHTTP_AUTOPROXY_NO_CACHE_CLIENT = 0x00080000, 121 WINHTTP_AUTOPROXY_NO_CACHE_SVC = 0x00100000, 122 123 WINHTTP_AUTOPROXY_SORT_RESULTS = 0x00400000 124 } 125 126 // dwAutoDetectFlags 127 enum : DWORD { 128 WINHTTP_AUTO_DETECT_TYPE_DHCP = 0x00000001, 129 WINHTTP_AUTO_DETECT_TYPE_DNS_A = 0x00000002 130 } 131 132 struct WINHTTP_CERTIFICATE_INFO { 133 FILETIME ftExpiry; 134 FILETIME ftStart; 135 LPWSTR lpszSubjectInfo; 136 LPWSTR lpszIssuerInfo; 137 LPWSTR lpszProtocolName; 138 LPWSTR lpszSignatureAlgName; 139 LPWSTR lpszEncryptionAlgName; 140 DWORD dwKeySize; 141 } 142 143 // This structure is only defined #if _WS2DEF_ defined (from <ws2def.h>) - per Windows SDK 144 align(4) 145 struct WINHTTP_CONNECTION_INFO { 146 align(4): 147 DWORD cbSize; 148 version (Win64) 149 DWORD _padding; // cheap trick without the alignment switch over this file 150 SOCKADDR_STORAGE LocalAddress; 151 SOCKADDR_STORAGE RemoteAddress; 152 } 153 154 // WinHttpTimeFromSystemTime 155 enum DWORD WINHTTP_TIME_FORMAT_BUFSIZE = 62; 156 157 // CrackUrl, CombineUrl 158 enum : DWORD { 159 ICU_NO_ENCODE = 0x20000000, 160 ICU_DECODE = 0x10000000, 161 ICU_NO_META = 0x08000000, 162 ICU_ENCODE_SPACES_ONLY = 0x04000000, 163 ICU_BROWSER_MODE = 0x02000000, 164 ICU_ENCODE_PERCENT = 0x00001000 165 } 166 // WinHttpCrackUrl, WinHttpCreateUrl 167 enum : DWORD { 168 ICU_ESCAPE = 0x80000000, 169 ICU_ESCAPE_AUTHORITY = 0x00002000, 170 ICU_REJECT_USERPWD = 0x00004000 171 } 172 enum : DWORD { 173 WINHTTP_ACCESS_TYPE_DEFAULT_PROXY = 0, 174 WINHTTP_ACCESS_TYPE_NO_PROXY = 1, 175 WINHTTP_ACCESS_TYPE_NAMED_PROXY = 3, 176 WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY = 4 177 } 178 // WinHttpOpen 'prettifiers' 179 enum LPCWSTR WINHTTP_NO_PROXY_NAME = null; 180 enum LPCWSTR WINHTTP_NO_PROXY_BYPASS = null; 181 182 enum LPVOID WINHTTP_NO_CLIENT_CERT_CONTEXT = null; 183 184 // WinHttp{Query|Set}Option 185 enum : DWORD { 186 WINHTTP_FIRST_OPTION = WINHTTP_OPTION_CALLBACK, 187 188 WINHTTP_OPTION_CALLBACK = 1, 189 WINHTTP_OPTION_RESOLVE_TIMEOUT = 2, 190 WINHTTP_OPTION_CONNECT_TIMEOUT = 3, 191 WINHTTP_OPTION_CONNECT_RETRIES = 4, 192 WINHTTP_OPTION_SEND_TIMEOUT = 5, 193 WINHTTP_OPTION_RECEIVE_TIMEOUT = 6, 194 WINHTTP_OPTION_RECEIVE_RESPONSE_TIMEOUT = 7, 195 WINHTTP_OPTION_HANDLE_TYPE = 9, 196 WINHTTP_OPTION_READ_BUFFER_SIZE = 12, 197 WINHTTP_OPTION_WRITE_BUFFER_SIZE = 13, 198 WINHTTP_OPTION_PARENT_HANDLE = 21, 199 WINHTTP_OPTION_EXTENDED_ERROR = 24, 200 WINHTTP_OPTION_SECURITY_FLAGS = 31, 201 WINHTTP_OPTION_SECURITY_CERTIFICATE_STRUCT = 32, 202 WINHTTP_OPTION_URL = 34, 203 WINHTTP_OPTION_SECURITY_KEY_BITNESS = 36, 204 WINHTTP_OPTION_PROXY = 38, 205 WINHTTP_OPTION_PROXY_RESULT_ENTRY = 39, 206 207 WINHTTP_OPTION_USER_AGENT = 41, 208 WINHTTP_OPTION_CONTEXT_VALUE = 45, 209 WINHTTP_OPTION_CLIENT_CERT_CONTEXT = 47, 210 WINHTTP_OPTION_REQUEST_PRIORITY = 58, 211 WINHTTP_OPTION_HTTP_VERSION = 59, 212 WINHTTP_OPTION_DISABLE_FEATURE = 63, 213 214 WINHTTP_OPTION_CODEPAGE = 68, 215 WINHTTP_OPTION_MAX_CONNS_PER_SERVER = 73, 216 WINHTTP_OPTION_MAX_CONNS_PER_1_0_SERVER = 74, 217 WINHTTP_OPTION_AUTOLOGON_POLICY = 77, 218 WINHTTP_OPTION_SERVER_CERT_CONTEXT = 78, 219 WINHTTP_OPTION_ENABLE_FEATURE = 79, 220 WINHTTP_OPTION_WORKER_THREAD_COUNT = 80, 221 WINHTTP_OPTION_PASSPORT_COBRANDING_TEXT = 81, 222 WINHTTP_OPTION_PASSPORT_COBRANDING_URL = 82, 223 WINHTTP_OPTION_CONFIGURE_PASSPORT_AUTH = 83, 224 WINHTTP_OPTION_SECURE_PROTOCOLS = 84, 225 WINHTTP_OPTION_ENABLETRACING = 85, 226 WINHTTP_OPTION_PASSPORT_SIGN_OUT = 86, 227 WINHTTP_OPTION_PASSPORT_RETURN_URL = 87, 228 WINHTTP_OPTION_REDIRECT_POLICY = 88, 229 WINHTTP_OPTION_MAX_HTTP_AUTOMATIC_REDIRECTS = 89, 230 WINHTTP_OPTION_MAX_HTTP_STATUS_CONTINUE = 90, 231 WINHTTP_OPTION_MAX_RESPONSE_HEADER_SIZE = 91, 232 WINHTTP_OPTION_MAX_RESPONSE_DRAIN_SIZE = 92, 233 WINHTTP_OPTION_CONNECTION_INFO = 93, 234 WINHTTP_OPTION_CLIENT_CERT_ISSUER_LIST = 94, 235 WINHTTP_OPTION_SPN = 96, 236 237 WINHTTP_OPTION_GLOBAL_PROXY_CREDS = 97, 238 WINHTTP_OPTION_GLOBAL_SERVER_CREDS = 98, 239 240 WINHTTP_OPTION_UNLOAD_NOTIFY_EVENT = 99, 241 WINHTTP_OPTION_REJECT_USERPWD_IN_URL = 100, 242 WINHTTP_OPTION_USE_GLOBAL_SERVER_CREDENTIALS = 101, 243 244 WINHTTP_OPTION_RECEIVE_PROXY_CONNECT_RESPONSE = 103, 245 WINHTTP_OPTION_IS_PROXY_CONNECT_RESPONSE = 104, 246 247 WINHTTP_OPTION_SERVER_SPN_USED = 106, 248 WINHTTP_OPTION_PROXY_SPN_USED = 107, 249 250 WINHTTP_OPTION_SERVER_CBT = 108, 251 252 WINHTTP_OPTION_UNSAFE_HEADER_PARSING = 110, 253 WINHTTP_OPTION_ASSURED_NON_BLOCKING_CALLBACKS = 111, 254 255 WINHTTP_OPTION_UPGRADE_TO_WEB_SOCKET = 114, 256 WINHTTP_OPTION_WEB_SOCKET_CLOSE_TIMEOUT = 115, 257 WINHTTP_OPTION_WEB_SOCKET_KEEPALIVE_INTERVAL = 116, 258 259 WINHTTP_OPTION_DECOMPRESSION = 118, 260 261 WINHTTP_OPTION_WEB_SOCKET_RECEIVE_BUFFER_SIZE = 122, 262 WINHTTP_OPTION_WEB_SOCKET_SEND_BUFFER_SIZE = 123, 263 264 //WINHTTP_LAST_OPTION => Moved outside of enum - static if () constraints within enums 265 266 WINHTTP_OPTION_USERNAME = 0x1000, 267 WINHTTP_OPTION_PASSWORD = 0x1001, 268 WINHTTP_OPTION_PROXY_USERNAME = 0x1002, 269 WINHTTP_OPTION_PROXY_PASSWORD = 0x1003, 270 271 WINHTTP_CONNS_PER_SERVER_UNLIMITED = 0xFFFFFFFF, 272 273 WINHTTP_AUTOLOGON_SECURITY_LEVEL_MEDIUM = 0, 274 WINHTTP_AUTOLOGON_SECURITY_LEVEL_LOW = 1, 275 WINHTTP_AUTOLOGON_SECURITY_LEVEL_HIGH = 2, 276 277 WINHTTP_AUTOLOGON_SECURITY_LEVEL_DEFAULT = WINHTTP_AUTOLOGON_SECURITY_LEVEL_MEDIUM, 278 279 WINHTTP_OPTION_REDIRECT_POLICY_NEVER = 0, 280 WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP = 1, 281 WINHTTP_OPTION_REDIRECT_POLICY_ALWAYS = 2, 282 283 WINHTTP_OPTION_REDIRECT_POLICY_LAST = WINHTTP_OPTION_REDIRECT_POLICY_ALWAYS, 284 WINHTTP_OPTION_REDIRECT_POLICY_DEFAULT = WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP, 285 286 WINHTTP_DISABLE_PASSPORT_AUTH = 0x00000000, 287 WINHTTP_ENABLE_PASSPORT_AUTH = 0x10000000, 288 WINHTTP_DISABLE_PASSPORT_KEYRING = 0x20000000, 289 WINHTTP_ENABLE_PASSPORT_KEYRING = 0x40000000, 290 291 WINHTTP_DISABLE_COOKIES = 0x00000001, 292 WINHTTP_DISABLE_REDIRECTS = 0x00000002, 293 WINHTTP_DISABLE_AUTHENTICATION = 0x00000004, 294 WINHTTP_DISABLE_KEEP_ALIVE = 0x00000008, 295 296 WINHTTP_ENABLE_SSL_REVOCATION = 0x00000001, 297 WINHTTP_ENABLE_SSL_REVERT_IMPERSONATION = 0x00000002, 298 299 WINHTTP_DISABLE_SPN_SERVER_PORT = 0x00000000, 300 WINHTTP_ENABLE_SPN_SERVER_PORT = 0x00000001, 301 WINHTTP_OPTION_SPN_MASK = WINHTTP_ENABLE_SPN_SERVER_PORT 302 } 303 304 // Windows 8.1 SDK: 305 static if (_WIN32_WINNT >= 0x602) { 306 enum DWORD WINHTTP_LAST_OPTION = WINHTTP_OPTION_WEB_SOCKET_SEND_BUFFER_SIZE; 307 } else { // Windows 7.0A SDK: 308 enum DWORD WINHTTP_LAST_OPTION = WINHTTP_OPTION_SERVER_CBT; 309 } 310 311 enum : DWORD { 312 WINHTTP_DECOMPRESSION_FLAG_GZIP = 0x00000001, 313 WINHTTP_DECOMPRESSION_FLAG_DEFLATE = 0x00000002, 314 WINHTTP_DECOMPRESSION_FLAG_ALL = (WINHTTP_DECOMPRESSION_FLAG_GZIP | WINHTTP_DECOMPRESSION_FLAG_DEFLATE) 315 } 316 317 struct WINHTTP_CREDS { 318 LPSTR lpszUserName; 319 LPSTR lpszPassword; 320 LPSTR lpszRealm; 321 DWORD dwAuthScheme; 322 LPSTR lpszHostName; 323 DWORD dwPort; 324 } 325 alias PWINHTTP_CREDS = WINHTTP_CREDS*; 326 327 struct WINHTTP_CREDS_EX { 328 LPSTR lpszUserName; 329 LPSTR lpszPassword; 330 LPSTR lpszRealm; 331 DWORD dwAuthScheme; 332 LPSTR lpszHostName; 333 DWORD dwPort; 334 LPSTR lpszUrl; 335 } 336 alias PWINHTTP_CREDS_EX = WINHTTP_CREDS_EX*; 337 338 enum : DWORD { 339 WINHTTP_HANDLE_TYPE_SESSION = 1, 340 WINHTTP_HANDLE_TYPE_CONNECT = 2, 341 WINHTTP_HANDLE_TYPE_REQUEST = 3, 342 343 WINHTTP_AUTH_SCHEME_BASIC = 0x00000001, 344 WINHTTP_AUTH_SCHEME_NTLM = 0x00000002, 345 WINHTTP_AUTH_SCHEME_PASSPORT = 0x00000004, 346 WINHTTP_AUTH_SCHEME_DIGEST = 0x00000008, 347 WINHTTP_AUTH_SCHEME_NEGOTIATE = 0x00000010, 348 349 WINHTTP_AUTH_TARGET_SERVER = 0x00000000, 350 WINHTTP_AUTH_TARGET_PROXY = 0x00000001, 351 352 SECURITY_FLAG_SECURE = 0x00000001, 353 SECURITY_FLAG_STRENGTH_WEAK = 0x10000000, 354 SECURITY_FLAG_STRENGTH_MEDIUM = 0x40000000, 355 SECURITY_FLAG_STRENGTH_STRONG = 0x20000000, 356 357 WINHTTP_CALLBACK_STATUS_FLAG_CERT_REV_FAILED = 0x00000001, 358 WINHTTP_CALLBACK_STATUS_FLAG_INVALID_CERT = 0x00000002, 359 WINHTTP_CALLBACK_STATUS_FLAG_CERT_REVOKED = 0x00000004, 360 WINHTTP_CALLBACK_STATUS_FLAG_INVALID_CA = 0x00000008, 361 WINHTTP_CALLBACK_STATUS_FLAG_CERT_CN_INVALID = 0x00000010, 362 WINHTTP_CALLBACK_STATUS_FLAG_CERT_DATE_INVALID = 0x00000020, 363 WINHTTP_CALLBACK_STATUS_FLAG_CERT_WRONG_USAGE = 0x00000040, 364 WINHTTP_CALLBACK_STATUS_FLAG_SECURITY_CHANNEL_ERROR = 0x80000000, 365 366 WINHTTP_FLAG_SECURE_PROTOCOL_SSL2 = 0x00000008, 367 WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 = 0x00000020, 368 WINHTTP_FLAG_SECURE_PROTOCOL_TLS1 = 0x00000080, 369 WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1 = 0x00000200, 370 WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2 = 0x00000800, 371 WINHTTP_FLAG_SECURE_PROTOCOL_ALL = (WINHTTP_FLAG_SECURE_PROTOCOL_SSL2 | 372 WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 | 373 WINHTTP_FLAG_SECURE_PROTOCOL_TLS1) 374 } 375 376 alias extern(Windows) int fnWINHTTP_STATUS_CALLBACK(HINTERNET hInternet, DWORD_PTR dwContext, 377 DWORD dwInternetStatus, LPVOID lpvStatusInformation,DWORD dwStatusInformationLength); 378 alias WINHTTP_STATUS_CALLBACK = fnWINHTTP_STATUS_CALLBACK*; 379 alias LPWINHTTP_STATUS_CALLBACK = WINHTTP_STATUS_CALLBACK*; 380 381 enum : DWORD { 382 WINHTTP_CALLBACK_STATUS_RESOLVING_NAME = 0x00000001, 383 WINHTTP_CALLBACK_STATUS_NAME_RESOLVED = 0x00000002, 384 WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER = 0x00000004, 385 WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER = 0x00000008, 386 WINHTTP_CALLBACK_STATUS_SENDING_REQUEST = 0x00000010, 387 WINHTTP_CALLBACK_STATUS_REQUEST_SENT = 0x00000020, 388 WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE = 0x00000040, 389 WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED = 0x00000080, 390 WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION = 0x00000100, 391 WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED = 0x00000200, 392 WINHTTP_CALLBACK_STATUS_HANDLE_CREATED = 0x00000400, 393 WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING = 0x00000800, 394 WINHTTP_CALLBACK_STATUS_DETECTING_PROXY = 0x00001000, 395 WINHTTP_CALLBACK_STATUS_REDIRECT = 0x00004000, 396 WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE = 0x00008000, 397 WINHTTP_CALLBACK_STATUS_SECURE_FAILURE = 0x00010000, 398 WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE = 0x00020000, 399 WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE = 0x00040000, 400 WINHTTP_CALLBACK_STATUS_READ_COMPLETE = 0x00080000, 401 WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE = 0x00100000, 402 WINHTTP_CALLBACK_STATUS_REQUEST_ERROR = 0x00200000, 403 WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE = 0x00400000 404 } 405 406 enum : DWORD { 407 WINHTTP_CALLBACK_STATUS_GETPROXYFORURL_COMPLETE = 0x01000000, 408 WINHTTP_CALLBACK_STATUS_CLOSE_COMPLETE = 0x02000000, 409 WINHTTP_CALLBACK_STATUS_SHUTDOWN_COMPLETE = 0x04000000 410 } 411 412 enum : DWORD { 413 API_RECEIVE_RESPONSE = 1, 414 API_QUERY_DATA_AVAILABLE = 2, 415 API_READ_DATA = 3, 416 API_WRITE_DATA = 4, 417 API_SEND_REQUEST = 5 418 } 419 420 enum : DWORD { 421 WINHTTP_CALLBACK_FLAG_RESOLVE_NAME = (WINHTTP_CALLBACK_STATUS_RESOLVING_NAME | WINHTTP_CALLBACK_STATUS_NAME_RESOLVED), 422 WINHTTP_CALLBACK_FLAG_CONNECT_TO_SERVER = (WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER | WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER), 423 WINHTTP_CALLBACK_FLAG_SEND_REQUEST = (WINHTTP_CALLBACK_STATUS_SENDING_REQUEST | WINHTTP_CALLBACK_STATUS_REQUEST_SENT), 424 WINHTTP_CALLBACK_FLAG_RECEIVE_RESPONSE = (WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE | WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED), 425 WINHTTP_CALLBACK_FLAG_CLOSE_CONNECTION = (WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION | WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED), 426 WINHTTP_CALLBACK_FLAG_HANDLES = (WINHTTP_CALLBACK_STATUS_HANDLE_CREATED | WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING), 427 WINHTTP_CALLBACK_FLAG_DETECTING_PROXY = WINHTTP_CALLBACK_STATUS_DETECTING_PROXY, 428 WINHTTP_CALLBACK_FLAG_REDIRECT = WINHTTP_CALLBACK_STATUS_REDIRECT, 429 WINHTTP_CALLBACK_FLAG_INTERMEDIATE_RESPONSE = WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE, 430 WINHTTP_CALLBACK_FLAG_SECURE_FAILURE = WINHTTP_CALLBACK_STATUS_SECURE_FAILURE, 431 WINHTTP_CALLBACK_FLAG_SENDREQUEST_COMPLETE = WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE, 432 WINHTTP_CALLBACK_FLAG_HEADERS_AVAILABLE = WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE, 433 WINHTTP_CALLBACK_FLAG_DATA_AVAILABLE = WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE, 434 WINHTTP_CALLBACK_FLAG_READ_COMPLETE = WINHTTP_CALLBACK_STATUS_READ_COMPLETE, 435 WINHTTP_CALLBACK_FLAG_WRITE_COMPLETE = WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE, 436 WINHTTP_CALLBACK_FLAG_REQUEST_ERROR = WINHTTP_CALLBACK_STATUS_REQUEST_ERROR 437 } 438 439 enum DWORD WINHTTP_CALLBACK_FLAG_GETPROXYFORURL_COMPLETE = WINHTTP_CALLBACK_STATUS_GETPROXYFORURL_COMPLETE; 440 441 // Windows 8+/2012+ 442 static if (_WIN32_WINNT >= 0x602) { 443 enum DWORD WINHTTP_CALLBACK_FLAG_ALL_COMPLETIONS = (WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE 444 | WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE 445 | WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE 446 | WINHTTP_CALLBACK_STATUS_READ_COMPLETE 447 | WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE 448 | WINHTTP_CALLBACK_STATUS_REQUEST_ERROR); 449 } else { 450 enum DWORD WINHTTP_CALLBACK_FLAG_ALL_COMPLETIONS = (WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE 451 | WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE 452 | WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE 453 | WINHTTP_CALLBACK_STATUS_READ_COMPLETE 454 | WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE 455 | WINHTTP_CALLBACK_STATUS_REQUEST_ERROR 456 | WINHTTP_CALLBACK_STATUS_GETPROXYFORURL_COMPLETE); 457 } 458 459 enum DWORD WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS = 0xffffffff; 460 461 enum WINHTTP_INVALID_STATUS_CALLBACK = (cast(WINHTTP_STATUS_CALLBACK)(-1L)); 462 463 enum : DWORD { 464 WINHTTP_QUERY_MIME_VERSION = 0, 465 WINHTTP_QUERY_CONTENT_TYPE = 1, 466 WINHTTP_QUERY_CONTENT_TRANSFER_ENCODING = 2, 467 WINHTTP_QUERY_CONTENT_ID = 3, 468 WINHTTP_QUERY_CONTENT_DESCRIPTION = 4, 469 WINHTTP_QUERY_CONTENT_LENGTH = 5, 470 WINHTTP_QUERY_CONTENT_LANGUAGE = 6, 471 WINHTTP_QUERY_ALLOW = 7, 472 WINHTTP_QUERY_PUBLIC = 8, 473 WINHTTP_QUERY_DATE = 9, 474 WINHTTP_QUERY_EXPIRES = 10, 475 WINHTTP_QUERY_LAST_MODIFIED = 11, 476 WINHTTP_QUERY_MESSAGE_ID = 12, 477 WINHTTP_QUERY_URI = 13, 478 WINHTTP_QUERY_DERIVED_FROM = 14, 479 WINHTTP_QUERY_COST = 15, 480 WINHTTP_QUERY_LINK = 16, 481 WINHTTP_QUERY_PRAGMA = 17, 482 WINHTTP_QUERY_VERSION = 18, 483 WINHTTP_QUERY_STATUS_CODE = 19, 484 WINHTTP_QUERY_STATUS_TEXT = 20, 485 WINHTTP_QUERY_RAW_HEADERS = 21, 486 WINHTTP_QUERY_RAW_HEADERS_CRLF = 22, 487 WINHTTP_QUERY_CONNECTION = 23, 488 WINHTTP_QUERY_ACCEPT = 24, 489 WINHTTP_QUERY_ACCEPT_CHARSET = 25, 490 WINHTTP_QUERY_ACCEPT_ENCODING = 26, 491 WINHTTP_QUERY_ACCEPT_LANGUAGE = 27, 492 WINHTTP_QUERY_AUTHORIZATION = 28, 493 WINHTTP_QUERY_CONTENT_ENCODING = 29, 494 WINHTTP_QUERY_FORWARDED = 30, 495 WINHTTP_QUERY_FROM = 31, 496 WINHTTP_QUERY_IF_MODIFIED_SINCE = 32, 497 WINHTTP_QUERY_LOCATION = 33, 498 WINHTTP_QUERY_ORIG_URI = 34, 499 WINHTTP_QUERY_REFERER = 35, 500 WINHTTP_QUERY_RETRY_AFTER = 36, 501 WINHTTP_QUERY_SERVER = 37, 502 WINHTTP_QUERY_TITLE = 38, 503 WINHTTP_QUERY_USER_AGENT = 39, 504 WINHTTP_QUERY_WWW_AUTHENTICATE = 40, 505 WINHTTP_QUERY_PROXY_AUTHENTICATE = 41, 506 WINHTTP_QUERY_ACCEPT_RANGES = 42, 507 WINHTTP_QUERY_SET_COOKIE = 43, 508 WINHTTP_QUERY_COOKIE = 44, 509 WINHTTP_QUERY_REQUEST_METHOD = 45, 510 WINHTTP_QUERY_REFRESH = 46, 511 WINHTTP_QUERY_CONTENT_DISPOSITION = 47, 512 513 // HTTP 1.1 defined headers 514 515 WINHTTP_QUERY_AGE = 48, 516 WINHTTP_QUERY_CACHE_CONTROL = 49, 517 WINHTTP_QUERY_CONTENT_BASE = 50, 518 WINHTTP_QUERY_CONTENT_LOCATION = 51, 519 WINHTTP_QUERY_CONTENT_MD5 = 52, 520 WINHTTP_QUERY_CONTENT_RANGE = 53, 521 WINHTTP_QUERY_ETAG = 54, 522 WINHTTP_QUERY_HOST = 55, 523 WINHTTP_QUERY_IF_MATCH = 56, 524 WINHTTP_QUERY_IF_NONE_MATCH = 57, 525 WINHTTP_QUERY_IF_RANGE = 58, 526 WINHTTP_QUERY_IF_UNMODIFIED_SINCE = 59, 527 WINHTTP_QUERY_MAX_FORWARDS = 60, 528 WINHTTP_QUERY_PROXY_AUTHORIZATION = 61, 529 WINHTTP_QUERY_RANGE = 62, 530 WINHTTP_QUERY_TRANSFER_ENCODING = 63, 531 WINHTTP_QUERY_UPGRADE = 64, 532 WINHTTP_QUERY_VARY = 65, 533 WINHTTP_QUERY_VIA = 66, 534 WINHTTP_QUERY_WARNING = 67, 535 WINHTTP_QUERY_EXPECT = 68, 536 WINHTTP_QUERY_PROXY_CONNECTION = 69, 537 WINHTTP_QUERY_UNLESS_MODIFIED_SINCE = 70, 538 539 WINHTTP_QUERY_PROXY_SUPPORT = 75, 540 WINHTTP_QUERY_AUTHENTICATION_INFO = 76, 541 WINHTTP_QUERY_PASSPORT_URLS = 77, 542 WINHTTP_QUERY_PASSPORT_CONFIG = 78, 543 544 WINHTTP_QUERY_MAX = 78, 545 546 WINHTTP_QUERY_CUSTOM = 65535, 547 548 WINHTTP_QUERY_FLAG_REQUEST_HEADERS = 0x80000000, 549 550 WINHTTP_QUERY_FLAG_SYSTEMTIME = 0x40000000, 551 552 WINHTTP_QUERY_FLAG_NUMBER = 0x20000000 553 } 554 555 enum : DWORD { 556 HTTP_STATUS_CONTINUE = 100, 557 HTTP_STATUS_SWITCH_PROTOCOLS = 101, 558 559 HTTP_STATUS_OK = 200, 560 HTTP_STATUS_CREATED = 201, 561 HTTP_STATUS_ACCEPTED = 202, 562 HTTP_STATUS_PARTIAL = 203, 563 HTTP_STATUS_NO_CONTENT = 204, 564 HTTP_STATUS_RESET_CONTENT = 205, 565 HTTP_STATUS_PARTIAL_CONTENT = 206, 566 HTTP_STATUS_WEBDAV_MULTI_STATUS = 207, 567 568 HTTP_STATUS_AMBIGUOUS = 300, 569 HTTP_STATUS_MOVED = 301, 570 HTTP_STATUS_REDIRECT = 302, 571 HTTP_STATUS_REDIRECT_METHOD = 303, 572 HTTP_STATUS_NOT_MODIFIED = 304, 573 HTTP_STATUS_USE_PROXY = 305, 574 HTTP_STATUS_REDIRECT_KEEP_VERB = 307, 575 576 HTTP_STATUS_BAD_REQUEST = 400, 577 HTTP_STATUS_DENIED = 401, 578 HTTP_STATUS_PAYMENT_REQ = 402, 579 HTTP_STATUS_FORBIDDEN = 403, 580 HTTP_STATUS_NOT_FOUND = 404, 581 HTTP_STATUS_BAD_METHOD = 405, 582 HTTP_STATUS_NONE_ACCEPTABLE = 406, 583 HTTP_STATUS_PROXY_AUTH_REQ = 407, 584 HTTP_STATUS_REQUEST_TIMEOUT = 408, 585 HTTP_STATUS_CONFLICT = 409, 586 HTTP_STATUS_GONE = 410, 587 HTTP_STATUS_LENGTH_REQUIRED = 411, 588 HTTP_STATUS_PRECOND_FAILED = 412, 589 HTTP_STATUS_REQUEST_TOO_LARGE = 413, 590 HTTP_STATUS_URI_TOO_LONG = 414, 591 HTTP_STATUS_UNSUPPORTED_MEDIA = 415, 592 HTTP_STATUS_RETRY_WITH = 449, 593 594 HTTP_STATUS_SERVER_ERROR = 500, 595 HTTP_STATUS_NOT_SUPPORTED = 501, 596 HTTP_STATUS_BAD_GATEWAY = 502, 597 HTTP_STATUS_SERVICE_UNAVAIL = 503, 598 HTTP_STATUS_GATEWAY_TIMEOUT = 504, 599 HTTP_STATUS_VERSION_NOT_SUP = 505, 600 601 HTTP_STATUS_FIRST = HTTP_STATUS_CONTINUE, 602 HTTP_STATUS_LAST = HTTP_STATUS_VERSION_NOT_SUP 603 } 604 605 enum LPCWSTR WINHTTP_NO_REFERER = null; 606 enum LPCWSTR * WINHTTP_DEFAULT_ACCEPT_TYPES = null; 607 608 enum : DWORD { 609 WINHTTP_ADDREQ_INDEX_MASK = 0x0000FFFF, 610 WINHTTP_ADDREQ_FLAGS_MASK = 0xFFFF0000, 611 612 WINHTTP_ADDREQ_FLAG_ADD_IF_NEW = 0x10000000, 613 614 WINHTTP_ADDREQ_FLAG_ADD = 0x20000000, 615 616 WINHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA = 0x40000000, 617 WINHTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON = 0x01000000, 618 WINHTTP_ADDREQ_FLAG_COALESCE = WINHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA, 619 620 WINHTTP_ADDREQ_FLAG_REPLACE = 0x80000000, 621 622 WINHTTP_IGNORE_REQUEST_TOTAL_LENGTH = 0 623 } 624 625 enum LPCWSTR WINHTTP_NO_ADDITIONAL_HEADERS = null; 626 enum LPVOID WINHTTP_NO_REQUEST_DATA = null; 627 628 enum LPCWSTR WINHTTP_HEADER_NAME_BY_INDEX = null; 629 enum LPVOID WINHTTP_NO_OUTPUT_BUFFER = null; 630 enum LPDWORD WINHTTP_NO_HEADER_INDEX = null; 631 632 struct WINHTTP_CURRENT_USER_IE_PROXY_CONFIG { 633 BOOL fAutoDetect; 634 LPWSTR lpszAutoConfigUrl; 635 LPWSTR lpszProxy; 636 LPWSTR lpszProxyBypass; 637 } 638 639 // WinHttp API error returns 640 enum : DWORD { 641 WINHTTP_ERROR_BASE = 12000, 642 643 ERROR_WINHTTP_OUT_OF_HANDLES = (WINHTTP_ERROR_BASE + 1), 644 ERROR_WINHTTP_TIMEOUT = (WINHTTP_ERROR_BASE + 2), 645 ERROR_WINHTTP_INTERNAL_ERROR = (WINHTTP_ERROR_BASE + 4), 646 ERROR_WINHTTP_INVALID_URL = (WINHTTP_ERROR_BASE + 5), 647 ERROR_WINHTTP_UNRECOGNIZED_SCHEME = (WINHTTP_ERROR_BASE + 6), 648 ERROR_WINHTTP_NAME_NOT_RESOLVED = (WINHTTP_ERROR_BASE + 7), 649 ERROR_WINHTTP_INVALID_OPTION = (WINHTTP_ERROR_BASE + 9), 650 ERROR_WINHTTP_OPTION_NOT_SETTABLE = (WINHTTP_ERROR_BASE + 11), 651 ERROR_WINHTTP_SHUTDOWN = (WINHTTP_ERROR_BASE + 12), 652 653 ERROR_WINHTTP_LOGIN_FAILURE = (WINHTTP_ERROR_BASE + 15), 654 ERROR_WINHTTP_OPERATION_CANCELLED = (WINHTTP_ERROR_BASE + 17), 655 ERROR_WINHTTP_INCORRECT_HANDLE_TYPE = (WINHTTP_ERROR_BASE + 18), 656 ERROR_WINHTTP_INCORRECT_HANDLE_STATE = (WINHTTP_ERROR_BASE + 19), 657 ERROR_WINHTTP_CANNOT_CONNECT = (WINHTTP_ERROR_BASE + 29), 658 ERROR_WINHTTP_CONNECTION_ERROR = (WINHTTP_ERROR_BASE + 30), 659 ERROR_WINHTTP_RESEND_REQUEST = (WINHTTP_ERROR_BASE + 32), 660 661 ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED = (WINHTTP_ERROR_BASE + 44), 662 663 ERROR_WINHTTP_CANNOT_CALL_BEFORE_OPEN = (WINHTTP_ERROR_BASE + 100), 664 ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND = (WINHTTP_ERROR_BASE + 101), 665 ERROR_WINHTTP_CANNOT_CALL_AFTER_SEND = (WINHTTP_ERROR_BASE + 102), 666 ERROR_WINHTTP_CANNOT_CALL_AFTER_OPEN = (WINHTTP_ERROR_BASE + 103), 667 668 ERROR_WINHTTP_HEADER_NOT_FOUND = (WINHTTP_ERROR_BASE + 150), 669 ERROR_WINHTTP_INVALID_SERVER_RESPONSE = (WINHTTP_ERROR_BASE + 152), 670 ERROR_WINHTTP_INVALID_HEADER = (WINHTTP_ERROR_BASE + 153), 671 ERROR_WINHTTP_INVALID_QUERY_REQUEST = (WINHTTP_ERROR_BASE + 154), 672 ERROR_WINHTTP_HEADER_ALREADY_EXISTS = (WINHTTP_ERROR_BASE + 155), 673 ERROR_WINHTTP_REDIRECT_FAILED = (WINHTTP_ERROR_BASE + 156), 674 675 ERROR_WINHTTP_AUTO_PROXY_SERVICE_ERROR = (WINHTTP_ERROR_BASE + 178), 676 ERROR_WINHTTP_BAD_AUTO_PROXY_SCRIPT = (WINHTTP_ERROR_BASE + 166), 677 ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT = (WINHTTP_ERROR_BASE + 167), 678 ERROR_WINHTTP_UNHANDLED_SCRIPT_TYPE = (WINHTTP_ERROR_BASE + 176), 679 ERROR_WINHTTP_SCRIPT_EXECUTION_ERROR = (WINHTTP_ERROR_BASE + 177), 680 681 ERROR_WINHTTP_NOT_INITIALIZED = (WINHTTP_ERROR_BASE + 172), 682 ERROR_WINHTTP_SECURE_FAILURE = (WINHTTP_ERROR_BASE + 175), 683 684 ERROR_WINHTTP_SECURE_CERT_DATE_INVALID = (WINHTTP_ERROR_BASE + 37), 685 ERROR_WINHTTP_SECURE_CERT_CN_INVALID = (WINHTTP_ERROR_BASE + 38), 686 ERROR_WINHTTP_SECURE_INVALID_CA = (WINHTTP_ERROR_BASE + 45), 687 ERROR_WINHTTP_SECURE_CERT_REV_FAILED = (WINHTTP_ERROR_BASE + 57), 688 ERROR_WINHTTP_SECURE_CHANNEL_ERROR = (WINHTTP_ERROR_BASE + 157), 689 ERROR_WINHTTP_SECURE_INVALID_CERT = (WINHTTP_ERROR_BASE + 169), 690 ERROR_WINHTTP_SECURE_CERT_REVOKED = (WINHTTP_ERROR_BASE + 170), 691 ERROR_WINHTTP_SECURE_CERT_WRONG_USAGE = (WINHTTP_ERROR_BASE + 179), 692 693 ERROR_WINHTTP_AUTODETECTION_FAILED = (WINHTTP_ERROR_BASE + 180), 694 ERROR_WINHTTP_HEADER_COUNT_EXCEEDED = (WINHTTP_ERROR_BASE + 181), 695 ERROR_WINHTTP_HEADER_SIZE_OVERFLOW = (WINHTTP_ERROR_BASE + 182), 696 ERROR_WINHTTP_CHUNKED_ENCODING_HEADER_SIZE_OVERFLOW = (WINHTTP_ERROR_BASE + 183), 697 ERROR_WINHTTP_RESPONSE_DRAIN_OVERFLOW = (WINHTTP_ERROR_BASE + 184), 698 ERROR_WINHTTP_CLIENT_CERT_NO_PRIVATE_KEY = (WINHTTP_ERROR_BASE + 185), 699 ERROR_WINHTTP_CLIENT_CERT_NO_ACCESS_PRIVATE_KEY = (WINHTTP_ERROR_BASE + 186), 700 701 WINHTTP_ERROR_LAST = (WINHTTP_ERROR_BASE + 186) 702 } 703 704 enum : DWORD { 705 WINHTTP_RESET_STATE = 0x00000001, 706 WINHTTP_RESET_SWPAD_CURRENT_NETWORK = 0x00000002, 707 WINHTTP_RESET_SWPAD_ALL = 0x00000004, 708 WINHTTP_RESET_SCRIPT_CACHE = 0x00000008, 709 WINHTTP_RESET_ALL = 0x0000FFFF, 710 WINHTTP_RESET_NOTIFY_NETWORK_CHANGED = 0x00010000, 711 WINHTTP_RESET_OUT_OF_PROC = 0x00020000 712 } 713 714 enum : DWORD { 715 WINHTTP_WEB_SOCKET_MAX_CLOSE_REASON_LENGTH = 123, 716 WINHTTP_WEB_SOCKET_MIN_KEEPALIVE_VALUE = 15000 717 } 718 719 // Version(Windows8) || Version(Windows2012): 720 static if (_WIN32_WINNT >= 0x602) 721 { 722 enum WINHTTP_WEB_SOCKET_OPERATION : DWORD 723 { 724 WINHTTP_WEB_SOCKET_SEND_OPERATION = 0, 725 WINHTTP_WEB_SOCKET_RECEIVE_OPERATION = 1, 726 WINHTTP_WEB_SOCKET_CLOSE_OPERATION = 2, 727 WINHTTP_WEB_SOCKET_SHUTDOWN_OPERATION = 3 728 } 729 enum WINHTTP_WEB_SOCKET_BUFFER_TYPE : DWORD 730 { 731 WINHTTP_WEB_SOCKET_BINARY_MESSAGE_BUFFER_TYPE = 0, 732 WINHTTP_WEB_SOCKET_BINARY_FRAGMENT_BUFFER_TYPE = 1, 733 WINHTTP_WEB_SOCKET_UTF8_MESSAGE_BUFFER_TYPE = 2, 734 WINHTTP_WEB_SOCKET_UTF8_FRAGMENT_BUFFER_TYPE = 3, 735 WINHTTP_WEB_SOCKET_CLOSE_BUFFER_TYPE = 4 736 } 737 enum WINHTTP_WEB_SOCKET_CLOSE_STATUS : DWORD 738 { 739 WINHTTP_WEB_SOCKET_SUCCESS_CLOSE_STATUS = 1000, 740 WINHTTP_WEB_SOCKET_ENDPOINT_TERMINATED_CLOSE_STATUS = 1001, 741 WINHTTP_WEB_SOCKET_PROTOCOL_ERROR_CLOSE_STATUS = 1002, 742 WINHTTP_WEB_SOCKET_INVALID_DATA_TYPE_CLOSE_STATUS = 1003, 743 WINHTTP_WEB_SOCKET_EMPTY_CLOSE_STATUS = 1005, 744 WINHTTP_WEB_SOCKET_ABORTED_CLOSE_STATUS = 1006, 745 WINHTTP_WEB_SOCKET_INVALID_PAYLOAD_CLOSE_STATUS = 1007, 746 WINHTTP_WEB_SOCKET_POLICY_VIOLATION_CLOSE_STATUS = 1008, 747 WINHTTP_WEB_SOCKET_MESSAGE_TOO_BIG_CLOSE_STATUS = 1009, 748 WINHTTP_WEB_SOCKET_UNSUPPORTED_EXTENSIONS_CLOSE_STATUS = 1010, 749 WINHTTP_WEB_SOCKET_SERVER_ERROR_CLOSE_STATUS = 1011, 750 WINHTTP_WEB_SOCKET_SECURE_HANDSHAKE_ERROR_CLOSE_STATUS = 1015 751 } 752 struct WINHTTP_PROXY_RESULT_ENTRY { 753 BOOL fProxy; 754 BOOL fBypass; 755 INTERNET_SCHEME ProxyScheme; 756 PWSTR pwszProxy; 757 INTERNET_PORT ProxyPort; 758 } 759 struct WINHTTP_PROXY_RESULT { 760 DWORD cEntries; 761 WINHTTP_PROXY_RESULT_ENTRY *pEntries; 762 } 763 struct WINHTTP_WEB_SOCKET_ASYNC_RESULT { 764 WINHTTP_ASYNC_RESULT AsyncResult; 765 WINHTTP_WEB_SOCKET_OPERATION Operation; 766 } 767 struct WINHTTP_WEB_SOCKET_STATUS { 768 DWORD dwBytesTransferred; 769 WINHTTP_WEB_SOCKET_BUFFER_TYPE eBufferType; 770 } 771 } 772 773 774 extern (Windows) { 775 BOOL WinHttpAddRequestHeaders(HINTERNET hRequest, LPCWSTR pwszHeaders, DWORD dwHeadersLength, DWORD dwModifiers); 776 777 BOOL WinHttpCheckPlatform(); 778 779 BOOL WinHttpCloseHandle(HINTERNET hInternet); 780 781 HINTERNET WinHttpConnect(HINTERNET hSession, LPCWSTR pswzServerName, INTERNET_PORT nServerPort, DWORD dwReserved); 782 783 BOOL WinHttpCrackUrl(LPCWSTR pwszUrl, DWORD dwUrlLength, DWORD dwFlags, LPURL_COMPONENTS lpUrlComponents); 784 785 BOOL WinHttpCreateUrl(LPURL_COMPONENTS lpUrlComponents, DWORD dwFlags, LPWSTR pwszUrl, LPDWORD lpdwUrlLength); 786 BOOL WinHttpDetectAutoProxyConfigUrl(DWORD dwAutoDetectFlags, LPWSTR *ppwszAutoConfigUrl); 787 788 BOOL WinHttpGetDefaultProxyConfiguration(WINHTTP_PROXY_INFO *pProxyInfo); 789 BOOL WinHttpGetIEProxyConfigForCurrentUser(WINHTTP_CURRENT_USER_IE_PROXY_CONFIG *pProxyConfig); 790 BOOL WinHttpGetProxyForUrl(HINTERNET hSession, LPCWSTR lpcwszUrl, 791 WINHTTP_AUTOPROXY_OPTIONS *pAutoProxyOptions, WINHTTP_PROXY_INFO *pProxyInfo); 792 793 HINTERNET WinHttpOpen(LPCWSTR pwszUserAgent, DWORD dwAccessType, LPCWSTR pwszProxyName, 794 LPCWSTR pwszProxyBypass, DWORD dwFlags); 795 HINTERNET WinHttpOpenRequest(HINTERNET hConnect, LPCWSTR pwszVerb, LPCWSTR pwszObjectName, 796 LPCWSTR pwszVersion, LPCWSTR pwszReferrer, 797 LPCWSTR *ppwszAcceptTypes, DWORD dwFlags); 798 799 BOOL WinHttpQueryAuthSchemes(HINTERNET hRequest, LPDWORD lpdwSupportedSchemes, 800 LPDWORD lpdwFirstScheme, LPDWORD pdwAuthTarget); 801 BOOL WinHttpQueryDataAvailable(HINTERNET hRequest, LPDWORD lpdwNumberOfBytesAvailable); 802 BOOL WinHttpQueryHeaders(HINTERNET hRequest, DWORD dwInfoLevel, LPCWSTR pwszName, 803 LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex); 804 BOOL WinHttpQueryOption(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, 805 LPDWORD lpdwBufferLength); 806 807 BOOL WinHttpReadData(HINTERNET hRequest, LPVOID lpBuffer, DWORD dwNumberOfBytesToRead, 808 LPDWORD lpdwNumberOfBytesRead); 809 BOOL WinHttpReceiveResponse(HINTERNET hRequest, LPVOID lpReserved); 810 811 BOOL WinHttpSendRequest(HINTERNET hRequest, LPCWSTR pwszHeaders, DWORD dwHeadersLength, 812 LPVOID lpOptional, DWORD dwOptionalLength, DWORD dwTotalLength, DWORD_PTR dwContext); 813 814 BOOL WinHttpSetCredentials(HINTERNET hRequest, DWORD AuthTargets, DWORD AuthScheme, 815 LPCWSTR pwszUserName, LPCWSTR pwszPassword, LPVOID pAuthParams); 816 BOOL WinHttpSetDefaultProxyConfiguration(WINHTTP_PROXY_INFO *pProxyInfo); 817 BOOL WinHttpSetOption(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength); 818 WINHTTP_STATUS_CALLBACK WinHttpSetStatusCallback(HINTERNET hInternet, 819 WINHTTP_STATUS_CALLBACK lpfnInternetCallback, 820 DWORD dwNotificationFlags, DWORD_PTR dwReserved); 821 BOOL WinHttpSetTimeouts(HINTERNET hInternet, int dwResolveTimeout, int dwConnectTimeout, 822 int dwSendTimeout, int dwReceiveTimeout); 823 824 BOOL WinHttpTimeFromSystemTime(const SYSTEMTIME *pst, LPWSTR pwszTime); 825 BOOL WinHttpTimeToSystemTime(LPCWSTR pwszTime, SYSTEMTIME *pst); 826 827 BOOL WinHttpWriteData(HINTERNET hRequest, LPCVOID lpBuffer, DWORD dwNumberOfBytesToWrite, 828 LPDWORD lpdwNumberOfBytesWritten); 829 830 // Version(Windows8) || Version(Windows2012): 831 static if (_WIN32_WINNT >= 0x602) { 832 DWORD WinHttpCreateProxyResolver(HINTERNET hSession, HINTERNET *phResolver); 833 void WinHttpFreeProxyResult(WINHTTP_PROXY_RESULT *pProxyResult); 834 DWORD WinHttpGetProxyForUrlEx(HINTERNET hResolver, PCWSTR pcwszUrl, 835 WINHTTP_AUTOPROXY_OPTIONS *pAutoProxyOptions, DWORD_PTR pContext); 836 DWORD WinHttpGetProxyResult(HINTERNET hResolver, WINHTTP_PROXY_RESULT *pProxyResult); 837 DWORD WinHttpResetAutoProxy(HINTERNET hSession, DWORD dwFlags); 838 DWORD WinHttpWebSocketClose(HINTERNET hWebSocket, USHORT usStatus, PVOID pvReason, DWORD dwReasonLength); 839 HINTERNET WinHttpWebSocketCompleteUpgrade(HINTERNET hRequest, DWORD_PTR pContext); 840 DWORD WinHttpWebSocketQueryCloseStatus(HINTERNET hWebSocket, USHORT *pusStatus, PVOID pvReason, 841 DWORD dwReasonLength, DWORD *pdwReasonLengthConsumed); 842 DWORD WinHttpWebSocketReceive(HINTERNET hWebSocket, PVOID pvBuffer, DWORD dwBufferLength, 843 DWORD *pdwBytesRead, WINHTTP_WEB_SOCKET_BUFFER_TYPE *peBufferType); 844 DWORD WinHttpWebSocketSend(HINTERNET hWebSocket, WINHTTP_WEB_SOCKET_BUFFER_TYPE eBufferType, 845 PVOID pvBuffer, DWORD dwBufferLength); 846 DWORD WinHttpWebSocketShutdown(HINTERNET hWebSocket, USHORT usStatus, PVOID pvReason, DWORD dwReasonLength); 847 } 848 }