├── FuncLib.pas ├── WinHttp.pas ├── CookieMgr_u.pas ├── README.md ├── LICENSE └── WinHttp_h.pas /FuncLib.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yryz/winhttp/HEAD/FuncLib.pas -------------------------------------------------------------------------------- /WinHttp.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yryz/winhttp/HEAD/WinHttp.pas -------------------------------------------------------------------------------- /CookieMgr_u.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yryz/winhttp/HEAD/CookieMgr_u.pas -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | winhttp 2 | ======= 3 | 4 | 基于WinHTTP核心封装的HTTP库 5 | 6 | 基于WinHTTP封装的DELPHI HTTP库,小巧、高效,已经在项目中使用很久,共享出来,算是为Delphi贡献一点东西吧。 7 | 8 | ###Demo: 9 | 10 | var 11 | Http: THTTP; 12 | LData: TUrlEncodedData; 13 | sData: string; 14 | begin 15 | Http := THTTP.Create; 16 | LData := TUrlEncodedData.Create(True, False); 17 | try 18 | LData.Put('_input_charset', 'utf-8'); 19 | LData.Put('suffix', 'csv'); 20 | 21 | Http.Referer := 'https://github.com/yryz/winhttp'; 22 | sData := Http.Get('http://yryz.net?' + LData.ToString); 23 | //sData := Http.Post('http://yryz.net', LData.ToString); 24 | 25 | // 网络问题, 忽略 26 | if Http.RawHeader = '' then 27 | begin 28 | OutLog('网络连接异常!'); 29 | Exit; 30 | end; 31 | 32 | OutLogFmt('检测耗时:%dms', [Http.GetUseTime]); 33 | 34 | // DO.... 35 | finally 36 | LData.Free; 37 | Http.Free; 38 | end; 39 | end; 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /WinHttp_h.pas: -------------------------------------------------------------------------------- 1 | unit WinHttp_h; 2 | 3 | interface 4 | 5 | uses 6 | Windows; 7 | 8 | {* 9 | * Set up Structure Packing to be 4 bytes for all winhttp structures 10 | *} 11 | {$ALIGN 4} 12 | 13 | // 14 | // types 15 | // 16 | type 17 | HINTERNET = Pointer; 18 | PHINTERNET = ^HINTERNET; 19 | LPHINTERNET = PHINTERNET; 20 | 21 | INTERNET_PORT = WORD; 22 | PINTERNET_PORT = ^INTERNET_PORT; 23 | LPINTERNET_PORT = PINTERNET_PORT; 24 | 25 | // 26 | // manifests 27 | // 28 | const 29 | 30 | INTERNET_DEFAULT_PORT = 0; // use the protocol-specific default 31 | INTERNET_DEFAULT_HTTP_PORT = 80; // " " HTTP " 32 | INTERNET_DEFAULT_HTTPS_PORT = 443; // " " HTTPS " 33 | 34 | // flags for WinHttpOpen(): 35 | WINHTTP_FLAG_ASYNC = $10000000; // this session is asynchronous (where supported) 36 | 37 | // flags for WinHttpOpenRequest(): 38 | WINHTTP_FLAG_SECURE = $00800000; // use SSL if applicable (HTTPS) 39 | WINHTTP_FLAG_ESCAPE_PERCENT = $00000004; // if escaping enabled, escape percent as well 40 | WINHTTP_FLAG_NULL_CODEPAGE = $00000008; // assume all symbols are ASCII, use fast convertion 41 | WINHTTP_FLAG_BYPASS_PROXY_CACHE = $00000100; // add "pragma: no-cache" request header 42 | WINHTTP_FLAG_REFRESH = WINHTTP_FLAG_BYPASS_PROXY_CACHE; 43 | WINHTTP_FLAG_ESCAPE_DISABLE = $00000040; // disable escaping 44 | WINHTTP_FLAG_ESCAPE_DISABLE_QUERY = $00000080; // if escaping enabled escape path part, but do not escape query 45 | 46 | 47 | SECURITY_FLAG_IGNORE_UNKNOWN_CA = $00000100; 48 | SECURITY_FLAG_IGNORE_CERT_DATE_INVALID = $00002000; // expired X509 Cert. 49 | SECURITY_FLAG_IGNORE_CERT_CN_INVALID = $00001000; // bad common name in X509 Cert. 50 | SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE = $00000200; 51 | 52 | 53 | // 54 | // WINHTTP_ASYNC_RESULT - this structure is returned to the application via 55 | // the callback with WINHTTP_CALLBACK_STATUS_REQUEST_COMPLETE. It is not sufficient to 56 | // just return the result of the async operation. If the API failed then the 57 | // app cannot call GetLastError() because the thread context will be incorrect. 58 | // Both the value returned by the async API and any resultant error code are 59 | // made available. The app need not check dwError if dwResult indicates that 60 | // the API succeeded (in this case dwError will be ERROR_SUCCESS) 61 | // 62 | 63 | type 64 | PWinHttpAsyncResult = ^TWinHttpAsyncResult; 65 | WINHTTP_ASYNC_RESULT = record 66 | dwResult: DWORD_PTR; // indicates which async API has encountered an error 67 | dwError: DWORD; // the error code if the API failed 68 | end; 69 | TWinHttpAsyncResult = WINHTTP_ASYNC_RESULT; 70 | 71 | // 72 | // HTTP_VERSION_INFO - query or set global HTTP version (1.0 or 1.1) 73 | // 74 | 75 | PHttpVersionInfo = ^THttpVersionInfo; 76 | HTTP_VERSION_INFO = record 77 | dwMajorVersion: DWORD; 78 | dwMinorVersion: DWORD; 79 | end; 80 | THttpVersionInfo = HTTP_VERSION_INFO; 81 | 82 | // 83 | // INTERNET_SCHEME - URL scheme type 84 | // 85 | 86 | INTERNET_SCHEME = Integer; 87 | TInternetScheme = INTERNET_SCHEME; 88 | PInternetScheme = ^TInternetScheme; 89 | 90 | const 91 | INTERNET_SCHEME_HTTP = (1); 92 | INTERNET_SCHEME_HTTPS = (2); 93 | 94 | 95 | // 96 | // URL_COMPONENTS - the constituent parts of an URL. Used in WinHttpCrackUrl() 97 | // and WinHttpCreateUrl() 98 | // 99 | // For WinHttpCrackUrl(), if a pointer field and its corresponding length field 100 | // are both 0 then that component is not returned. If the pointer field is NULL 101 | // but the length field is not zero, then both the pointer and length fields are 102 | // returned if both pointer and corresponding length fields are non-zero then 103 | // the pointer field points to a buffer where the component is copied. The 104 | // component may be un-escaped, depending on dwFlags 105 | // 106 | // For WinHttpCreateUrl(), the pointer fields should be NULL if the component 107 | // is not required. If the corresponding length field is zero then the pointer 108 | // field is the address of a zero-terminated string. If the length field is not 109 | // zero then it is the string length of the corresponding pointer field 110 | // 111 | 112 | //#pragma warning( disable : 4121 ) // disable alignment warning 113 | 114 | type 115 | PURLComponents = ^TURLComponents; 116 | URL_COMPONENTS = record 117 | dwStructSize: DWORD; // size of this structure. Used in version check 118 | lpszScheme: LPWSTR; // pointer to scheme name 119 | dwSchemeLength: DWORD; // length of scheme name 120 | nScheme: TInternetScheme; // enumerated scheme type (if known) 121 | lpszHostName: LPWSTR; // pointer to host name 122 | dwHostNameLength: DWORD; // length of host name 123 | nPort: INTERNET_PORT; // converted port number 124 | lpszUserName: LPWSTR; // pointer to user name 125 | dwUserNameLength: DWORD; // length of user name 126 | lpszPassword: LPWSTR; // pointer to password 127 | dwPasswordLength: DWORD; // length of password 128 | lpszUrlPath: LPWSTR; // pointer to URL-path 129 | dwUrlPathLength: DWORD; // length of URL-path 130 | lpszExtraInfo: LPWSTR; // pointer to extra information (e.g. ?foo or #foo) 131 | dwExtraInfoLength: DWORD; // length of extra information 132 | end; 133 | TURLComponents = URL_COMPONENTS; 134 | 135 | TURLComponentsW = TURLComponents; 136 | PURLComponentsW = PURLComponents; 137 | 138 | //#pragma warning( default : 4121 ) // restore alignment warning 139 | 140 | // 141 | // WINHTTP_PROXY_INFO - structure supplied with WINHTTP_OPTION_PROXY to get/ 142 | // set proxy information on a WinHttpOpen() handle 143 | // 144 | 145 | PWinHttpProxyInfo = ^TWinHttpProxyInfo; 146 | WINHTTP_PROXY_INFO = record 147 | dwAccessType: DWORD; // see WINHTTP_ACCESS_* types below 148 | lpszProxy: LPWSTR; // proxy server list 149 | lpszProxyBypass: LPWSTR; // proxy bypass list 150 | end; 151 | TWinHttpProxyInfo = WINHTTP_PROXY_INFO; 152 | 153 | TWinHttpProxyInfoW = TWinHttpProxyInfo; 154 | PWinHttpProxyInfoW = PWinHttpProxyInfo; 155 | 156 | PWinHttpAutoProxyOptions = ^TWinHttpAutoProxyOptions; 157 | WINHTTP_AUTOPROXY_OPTIONS = record 158 | dwFlags: DWORD; 159 | dwAutoDetectFlags: DWORD; 160 | lpszAutoConfigUrl: LPCWSTR; 161 | lpvReserved: Pointer; 162 | dwReserved: WORD; 163 | fAutoLogonIfChallenged: BOOL; 164 | end; 165 | TWinHttpAutoProxyOptions = WINHTTP_AUTOPROXY_OPTIONS; 166 | 167 | const 168 | WINHTTP_AUTOPROXY_AUTO_DETECT = $00000001; 169 | WINHTTP_AUTOPROXY_CONFIG_URL = $00000002; 170 | WINHTTP_AUTOPROXY_RUN_INPROCESS = $00010000; 171 | WINHTTP_AUTOPROXY_RUN_OUTPROCESS_ONLY = $00020000; 172 | // 173 | // Flags for dwAutoDetectFlags 174 | // 175 | WINHTTP_AUTO_DETECT_TYPE_DHCP = $00000001; 176 | WINHTTP_AUTO_DETECT_TYPE_DNS_A = $00000002; 177 | 178 | 179 | // 180 | // WINHTTP_CERTIFICATE_INFO lpBuffer - contains the certificate returned from 181 | // the server 182 | // 183 | type 184 | WINHTTP_CERTIFICATE_INFO = record 185 | // 186 | // ftExpiry - date the certificate expires. 187 | // 188 | 189 | ftExpiry: TFileTime; 190 | 191 | // 192 | // ftStart - date the certificate becomes valid. 193 | // 194 | 195 | ftStart: TFileTime; 196 | 197 | // 198 | // lpszSubjectInfo - the name of organization, site, and server 199 | // the cert. was issued for. 200 | // 201 | 202 | lpszSubjectInfo: LPWSTR; 203 | 204 | // 205 | // lpszIssuerInfo - the name of orgainzation, site, and server 206 | // the cert was issues by. 207 | // 208 | 209 | lpszIssuerInfo: LPWSTR; 210 | 211 | // 212 | // lpszProtocolName - the name of the protocol used to provide the secure 213 | // connection. 214 | // 215 | 216 | lpszProtocolName: LPWSTR; 217 | 218 | // 219 | // lpszSignatureAlgName - the name of the algorithm used for signing 220 | // the certificate. 221 | // 222 | 223 | lpszSignatureAlgName: LPWSTR; 224 | 225 | // 226 | // lpszEncryptionAlgName - the name of the algorithm used for 227 | // doing encryption over the secure channel (SSL) connection. 228 | // 229 | 230 | lpszEncryptionAlgName: LPWSTR; 231 | 232 | // 233 | // dwKeySize - size of the key. 234 | // 235 | 236 | dwKeySize: DWORD; 237 | 238 | end; 239 | TWinHttpCertificateInfo = WINHTTP_CERTIFICATE_INFO; 240 | 241 | {#ifdef _WS2DEF_ 242 | 243 | WINHTTP_CONNECTION_INFO = record 244 | cbSize: DWORD; 245 | LocalAddress: SOCKADDR_STORAGE; // local ip, local port 246 | RemoteAddress: SOCKADDR_STORAGE; // remote ip, remote port 247 | end; 248 | TWinHttpConnectionInfo = WINHTTP_CONNECTION_INFO; 249 | 250 | #endif} 251 | 252 | // 253 | // prototypes 254 | // 255 | 256 | // 257 | // constants for WinHttpTimeFromSystemTime 258 | // 259 | const 260 | WINHTTP_TIME_FORMAT_BUFSIZE = 62; 261 | 262 | 263 | function WinHttpTimeFromSystemTime 264 | ( 265 | pst: PSystemTime; // input GMT time 266 | pwszTime: LPWSTR // output string buffer 267 | ): BOOL; stdcall; 268 | 269 | function WinHttpTimeToSystemTime 270 | ( 271 | pwszTime: LPCWSTR; // NULL terminated string 272 | pst: PSystemTime // output in GMT time 273 | ): BOOL; stdcall; 274 | 275 | 276 | // 277 | // flags for CrackUrl() and CombineUrl() 278 | // 279 | const 280 | ICU_NO_ENCODE = $20000000; // Don't convert unsafe characters to escape sequence 281 | ICU_DECODE = $10000000; // Convert %XX escape sequences to characters 282 | ICU_NO_META = $08000000; // Don't convert .. etc. meta path sequences 283 | ICU_ENCODE_SPACES_ONLY = $04000000; // Encode spaces only 284 | ICU_BROWSER_MODE = $02000000; // Special encode/decode rules for browser 285 | ICU_ENCODE_PERCENT = $00001000; // Encode any percent (ASCII25) 286 | 287 | // signs encountered, default is to not encode percent. 288 | 289 | 290 | function WinHttpCrackUrl 291 | ( 292 | pwszUrl: LPCWSTR; 293 | dwUrlLength: DWORD; 294 | dwFlags: DWORD; 295 | lpUrlComponents: PURLComponents 296 | ): BOOL; stdcall; 297 | 298 | function WinHttpCreateUrl 299 | ( 300 | lpUrlComponents: PURLComponents; 301 | dwFlags: DWORD; 302 | pwszUrl: LPWSTR; 303 | lpdwUrlLength: LPDWORD 304 | ): BOOL; stdcall; 305 | 306 | // 307 | // flags for WinHttpCrackUrl() and WinHttpCreateUrl() 308 | // 309 | const 310 | ICU_ESCAPE = DWORD($80000000); // (un)escape URL characters 311 | ICU_ESCAPE_AUTHORITY = $00002000; // causes InternetCreateUrlA to escape chars in authority components (user, pwd, host) 312 | ICU_REJECT_USERPWD = $00004000; // rejects usrls whick have username/pwd sections 313 | 314 | function WinHttpCheckPlatform: BOOL; cdecl; 315 | 316 | function WinHttpGetDefaultProxyConfiguration(pProxyInfo: PWinHttpProxyInfo): BOOL; stdcall; 317 | function WinHttpSetDefaultProxyConfiguration(pProxyInfo: PWinHttpProxyInfo): BOOL; stdcall; 318 | 319 | 320 | function WinHttpOpen 321 | ( 322 | pszAgentW: LPCWSTR; 323 | dwAccessType: DWORD; 324 | pszProxyW: LPCWSTR; 325 | pszProxyBypassW: LPCWSTR; 326 | dwFlags: DWORD 327 | ): HINTERNET; stdcall; 328 | 329 | // WinHttpOpen dwAccessType values (also for WINHTTP_PROXY_INFO::dwAccessType) 330 | const 331 | WINHTTP_ACCESS_TYPE_DEFAULT_PROXY = 0; 332 | WINHTTP_ACCESS_TYPE_NO_PROXY = 1; 333 | WINHTTP_ACCESS_TYPE_NAMED_PROXY = 3; 334 | 335 | // WinHttpOpen prettifiers for optional parameters 336 | WINHTTP_NO_PROXY_NAME = nil; 337 | WINHTTP_NO_PROXY_BYPASS = nil; 338 | 339 | 340 | function WinHttpCloseHandle 341 | ( 342 | hInternet: HINTERNET 343 | ): BOOL; stdcall; 344 | 345 | 346 | function WinHttpConnect 347 | ( 348 | hSession: HINTERNET; 349 | pswzServerName: LPCWSTR; 350 | nServerPort: INTERNET_PORT; 351 | dwReserved: DWORD 352 | ): HINTERNET; stdcall; 353 | 354 | 355 | function WinHttpReadData 356 | ( 357 | hRequest: HINTERNET; 358 | lpBuffer: Pointer; 359 | dwNumberOfBytesToRead: DWORD; 360 | lpdwNumberOfBytesRead: LPDWORD 361 | ): BOOL; stdcall; 362 | 363 | 364 | function WinHttpWriteData 365 | ( 366 | hRequest: HINTERNET; 367 | lpBuffer: Pointer; 368 | dwNumberOfBytesToWrite: DWORD; 369 | lpdwNumberOfBytesWritten: LPDWORD 370 | ): BOOL; stdcall; 371 | 372 | 373 | function WinHttpQueryDataAvailable 374 | ( 375 | hRequest: HINTERNET; 376 | lpdwNumberOfBytesAvailable: LPDWORD 377 | ): BOOL; stdcall; 378 | 379 | 380 | function WinHttpQueryOption 381 | ( 382 | hInternet: HINTERNET; 383 | dwOption: DWORD; 384 | lpBuffer: Pointer; 385 | lpdwBufferLength: LPDWORD 386 | ): BOOL; stdcall; 387 | 388 | const 389 | WINHTTP_NO_CLIENT_CERT_CONTEXT = nil; 390 | 391 | function WinHttpSetOption 392 | ( 393 | hInternet: HINTERNET; 394 | dwOption: DWORD; 395 | lpBuffer: Pointer; 396 | dwBufferLength: DWORD 397 | ): BOOL; stdcall; 398 | 399 | 400 | function WinHttpSetTimeouts 401 | ( 402 | hInternet: HINTERNET; // Session/Request handle. 403 | nResolveTimeout: Integer; 404 | nConnectTimeout: Integer; 405 | nSendTimeout: Integer; 406 | nReceiveTimeout: Integer 407 | ): BOOL; stdcall; 408 | 409 | // 410 | // options manifests for WinHttp{Query|Set}Option 411 | // 412 | const 413 | WINHTTP_FIRST_OPTION = 1; //WINHTTP_OPTION_CALLBACK; 414 | 415 | WINHTTP_OPTION_CALLBACK = 1; 416 | WINHTTP_OPTION_RESOLVE_TIMEOUT = 2; 417 | WINHTTP_OPTION_CONNECT_TIMEOUT = 3; 418 | WINHTTP_OPTION_CONNECT_RETRIES = 4; 419 | WINHTTP_OPTION_SEND_TIMEOUT = 5; 420 | WINHTTP_OPTION_RECEIVE_TIMEOUT = 6; 421 | WINHTTP_OPTION_RECEIVE_RESPONSE_TIMEOUT = 7; 422 | WINHTTP_OPTION_HANDLE_TYPE = 9; 423 | WINHTTP_OPTION_READ_BUFFER_SIZE = 12; 424 | WINHTTP_OPTION_WRITE_BUFFER_SIZE = 13; 425 | WINHTTP_OPTION_PARENT_HANDLE = 21; 426 | WINHTTP_OPTION_EXTENDED_ERROR = 24; 427 | WINHTTP_OPTION_SECURITY_FLAGS = 31; 428 | WINHTTP_OPTION_SECURITY_CERTIFICATE_STRUCT = 32; 429 | WINHTTP_OPTION_URL = 34; 430 | WINHTTP_OPTION_SECURITY_KEY_BITNESS = 36; 431 | WINHTTP_OPTION_PROXY = 38; 432 | 433 | 434 | WINHTTP_OPTION_USER_AGENT = 41; 435 | WINHTTP_OPTION_CONTEXT_VALUE = 45; 436 | WINHTTP_OPTION_CLIENT_CERT_CONTEXT = 47; 437 | WINHTTP_OPTION_REQUEST_PRIORITY = 58; 438 | WINHTTP_OPTION_HTTP_VERSION = 59; 439 | WINHTTP_OPTION_DISABLE_FEATURE = 63; 440 | 441 | WINHTTP_OPTION_CODEPAGE = 68; 442 | WINHTTP_OPTION_MAX_CONNS_PER_SERVER = 73; 443 | WINHTTP_OPTION_MAX_CONNS_PER_1_0_SERVER = 74; 444 | WINHTTP_OPTION_AUTOLOGON_POLICY = 77; 445 | WINHTTP_OPTION_SERVER_CERT_CONTEXT = 78; 446 | WINHTTP_OPTION_ENABLE_FEATURE = 79; 447 | WINHTTP_OPTION_WORKER_THREAD_COUNT = 80; 448 | WINHTTP_OPTION_PASSPORT_COBRANDING_TEXT = 81; 449 | WINHTTP_OPTION_PASSPORT_COBRANDING_URL = 82; 450 | WINHTTP_OPTION_CONFIGURE_PASSPORT_AUTH = 83; 451 | WINHTTP_OPTION_SECURE_PROTOCOLS = 84; 452 | WINHTTP_OPTION_ENABLETRACING = 85; 453 | WINHTTP_OPTION_PASSPORT_SIGN_OUT = 86; 454 | WINHTTP_OPTION_PASSPORT_RETURN_URL = 87; 455 | WINHTTP_OPTION_REDIRECT_POLICY = 88; 456 | WINHTTP_OPTION_MAX_HTTP_AUTOMATIC_REDIRECTS = 89; 457 | WINHTTP_OPTION_MAX_HTTP_STATUS_CONTINUE = 90; 458 | WINHTTP_OPTION_MAX_RESPONSE_HEADER_SIZE = 91; 459 | WINHTTP_OPTION_MAX_RESPONSE_DRAIN_SIZE = 92; 460 | WINHTTP_OPTION_CONNECTION_INFO = 93; 461 | WINHTTP_OPTION_CLIENT_CERT_ISSUER_LIST = 94; 462 | WINHTTP_OPTION_SPN = 96; 463 | 464 | WINHTTP_OPTION_GLOBAL_PROXY_CREDS = 97; 465 | WINHTTP_OPTION_GLOBAL_SERVER_CREDS = 98; 466 | 467 | WINHTTP_OPTION_UNLOAD_NOTIFY_EVENT = 99; 468 | WINHTTP_OPTION_REJECT_USERPWD_IN_URL = 100; 469 | WINHTTP_OPTION_USE_GLOBAL_SERVER_CREDENTIALS = 101; 470 | 471 | 472 | WINHTTP_LAST_OPTION = WINHTTP_OPTION_USE_GLOBAL_SERVER_CREDENTIALS; 473 | 474 | WINHTTP_OPTION_USERNAME = $1000; 475 | WINHTTP_OPTION_PASSWORD = $1001; 476 | WINHTTP_OPTION_PROXY_USERNAME = $1002; 477 | WINHTTP_OPTION_PROXY_PASSWORD = $1003; 478 | 479 | 480 | // manifest value for WINHTTP_OPTION_MAX_CONNS_PER_SERVER and WINHTTP_OPTION_MAX_CONNS_PER_1_0_SERVER 481 | WINHTTP_CONNS_PER_SERVER_UNLIMITED = DWORD($FFFFFFFF); 482 | 483 | 484 | // values for WINHTTP_OPTION_AUTOLOGON_POLICY 485 | WINHTTP_AUTOLOGON_SECURITY_LEVEL_MEDIUM = 0; 486 | WINHTTP_AUTOLOGON_SECURITY_LEVEL_LOW = 1; 487 | WINHTTP_AUTOLOGON_SECURITY_LEVEL_HIGH = 2; 488 | 489 | WINHTTP_AUTOLOGON_SECURITY_LEVEL_DEFAULT = WINHTTP_AUTOLOGON_SECURITY_LEVEL_MEDIUM; 490 | 491 | // values for WINHTTP_OPTION_REDIRECT_POLICY 492 | WINHTTP_OPTION_REDIRECT_POLICY_NEVER = 0; 493 | WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP = 1; 494 | WINHTTP_OPTION_REDIRECT_POLICY_ALWAYS = 2; 495 | 496 | WINHTTP_OPTION_REDIRECT_POLICY_LAST = WINHTTP_OPTION_REDIRECT_POLICY_ALWAYS; 497 | WINHTTP_OPTION_REDIRECT_POLICY_DEFAULT = WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP; 498 | 499 | WINHTTP_DISABLE_PASSPORT_AUTH = $00000000; 500 | WINHTTP_ENABLE_PASSPORT_AUTH = $10000000; 501 | WINHTTP_DISABLE_PASSPORT_KEYRING = $20000000; 502 | WINHTTP_ENABLE_PASSPORT_KEYRING = $40000000; 503 | 504 | 505 | // values for WINHTTP_OPTION_DISABLE_FEATURE 506 | WINHTTP_DISABLE_COOKIES = $00000001; 507 | WINHTTP_DISABLE_REDIRECTS = $00000002; 508 | WINHTTP_DISABLE_AUTHENTICATION = $00000004; 509 | WINHTTP_DISABLE_KEEP_ALIVE = $00000008; 510 | 511 | // values for WINHTTP_OPTION_ENABLE_FEATURE 512 | WINHTTP_ENABLE_SSL_REVOCATION = $00000001; 513 | WINHTTP_ENABLE_SSL_REVERT_IMPERSONATION = $00000002; 514 | 515 | // values for WINHTTP_OPTION_SPN 516 | WINHTTP_DISABLE_SPN_SERVER_PORT = $00000000; 517 | WINHTTP_ENABLE_SPN_SERVER_PORT = $00000001; 518 | WINHTTP_OPTION_SPN_MASK = WINHTTP_ENABLE_SPN_SERVER_PORT; 519 | type 520 | PWinHttpCreds = ^TWinHttpCreds; 521 | tagWINHTTP_CREDS = record 522 | lpszUserName: LPSTR; 523 | lpszPassword: LPSTR; 524 | lpszRealm: LPSTR; 525 | dwAuthScheme: DWORD; 526 | lpszHostName: LPSTR; 527 | dwPort: DWORD; 528 | end; 529 | TWinHttpCreds = tagWINHTTP_CREDS; 530 | 531 | WINHTTP_CREDS = tagWINHTTP_CREDS; 532 | PWINHTTP_CREDS = ^tagWINHTTP_CREDS; 533 | 534 | // structure for WINHTTP_OPTION_GLOBAL_SERVER_CREDS and 535 | // WINHTTP_OPTION_GLOBAL_PROXY_CREDS 536 | PWinHttpCredsEx = ^TWinHttpCredsEx; 537 | tagWINHTTP_CREDS_EX = record 538 | lpszUserName: LPSTR; 539 | lpszPassword: LPSTR; 540 | lpszRealm: LPSTR; 541 | dwAuthScheme: DWORD; 542 | lpszHostName: DWORD; 543 | dwPort: DWORD; 544 | lpszUrl: LPSTR; 545 | end; 546 | TWinHttpCredsEx = tagWINHTTP_CREDS_EX; 547 | 548 | WINHTTP_CREDS_EX = tagWINHTTP_CREDS_EX; 549 | PWINHTTP_CREDS_EX = ^tagWINHTTP_CREDS_EX; 550 | 551 | // 552 | // winhttp handle types 553 | // 554 | const 555 | WINHTTP_HANDLE_TYPE_SESSION = 1; 556 | WINHTTP_HANDLE_TYPE_CONNECT = 2; 557 | WINHTTP_HANDLE_TYPE_REQUEST = 3; 558 | 559 | // 560 | // values for auth schemes 561 | // 562 | WINHTTP_AUTH_SCHEME_BASIC = $00000001; 563 | WINHTTP_AUTH_SCHEME_NTLM = $00000002; 564 | WINHTTP_AUTH_SCHEME_PASSPORT = $00000004; 565 | WINHTTP_AUTH_SCHEME_DIGEST = $00000008; 566 | WINHTTP_AUTH_SCHEME_NEGOTIATE = $00000010; 567 | 568 | // WinHttp supported Authentication Targets 569 | 570 | WINHTTP_AUTH_TARGET_SERVER = $00000000; 571 | WINHTTP_AUTH_TARGET_PROXY = $00000001; 572 | 573 | // 574 | // values for WINHTTP_OPTION_SECURITY_FLAGS 575 | // 576 | 577 | // query only 578 | SECURITY_FLAG_SECURE = $00000001; // can query only 579 | SECURITY_FLAG_STRENGTH_WEAK = $10000000; 580 | SECURITY_FLAG_STRENGTH_MEDIUM = $40000000; 581 | SECURITY_FLAG_STRENGTH_STRONG = $20000000; 582 | 583 | 584 | 585 | // Secure connection error status flags 586 | WINHTTP_CALLBACK_STATUS_FLAG_CERT_REV_FAILED = $00000001; 587 | WINHTTP_CALLBACK_STATUS_FLAG_INVALID_CERT = $00000002; 588 | WINHTTP_CALLBACK_STATUS_FLAG_CERT_REVOKED = $00000004; 589 | WINHTTP_CALLBACK_STATUS_FLAG_INVALID_CA = $00000008; 590 | WINHTTP_CALLBACK_STATUS_FLAG_CERT_CN_INVALID = $00000010; 591 | WINHTTP_CALLBACK_STATUS_FLAG_CERT_DATE_INVALID = $00000020; 592 | WINHTTP_CALLBACK_STATUS_FLAG_CERT_WRONG_USAGE = $00000040; 593 | WINHTTP_CALLBACK_STATUS_FLAG_SECURITY_CHANNEL_ERROR = DWORD($80000000); 594 | 595 | 596 | WINHTTP_FLAG_SECURE_PROTOCOL_SSL2 = $00000008; 597 | WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 = $00000020; 598 | WINHTTP_FLAG_SECURE_PROTOCOL_TLS1 = $00000080; 599 | WINHTTP_FLAG_SECURE_PROTOCOL_ALL = (WINHTTP_FLAG_SECURE_PROTOCOL_SSL2 or 600 | WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 or 601 | WINHTTP_FLAG_SECURE_PROTOCOL_TLS1); 602 | 603 | 604 | // 605 | // callback function for WinHttpSetStatusCallback 606 | // 607 | type 608 | {WINHTTP_STATUS_CALLBACK = procedure( 609 | hInternet: HINTERNET; 610 | dwContext: DWORD_PTR; 611 | dwInternetStatus: DWORD; 612 | lpvStatusInformation: Pointer; 613 | dwStatusInformationLength: DWORD); stdcall; 614 | 615 | TFNWinHttpStatusCallback = WINHTTP_STATUS_CALLBACK; 616 | PFNWinHttpStatusCallback = ^TFNWinHttpStatusCallback;} 617 | TFNWinHttpStatusCallback = TFarProc; 618 | 619 | function WinHttpSetStatusCallback 620 | ( 621 | hInternet: HINTERNET; 622 | lpfnInternetCallback: TFNWinHttpStatusCallback; 623 | dwNotificationFlags: DWORD; 624 | dwReserved: DWORD_PTR 625 | ): TFNWinHttpStatusCallback; stdcall; 626 | 627 | // 628 | // status manifests for WinHttp status callback 629 | // 630 | const 631 | WINHTTP_CALLBACK_STATUS_RESOLVING_NAME = $00000001; 632 | WINHTTP_CALLBACK_STATUS_NAME_RESOLVED = $00000002; 633 | WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER = $00000004; 634 | WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER = $00000008; 635 | WINHTTP_CALLBACK_STATUS_SENDING_REQUEST = $00000010; 636 | WINHTTP_CALLBACK_STATUS_REQUEST_SENT = $00000020; 637 | WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE = $00000040; 638 | WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED = $00000080; 639 | WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION = $00000100; 640 | WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED = $00000200; 641 | WINHTTP_CALLBACK_STATUS_HANDLE_CREATED = $00000400; 642 | WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING = $00000800; 643 | WINHTTP_CALLBACK_STATUS_DETECTING_PROXY = $00001000; 644 | WINHTTP_CALLBACK_STATUS_REDIRECT = $00004000; 645 | WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE = $00008000; 646 | WINHTTP_CALLBACK_STATUS_SECURE_FAILURE = $00010000; 647 | WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE = $00020000; 648 | WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE = $00040000; 649 | WINHTTP_CALLBACK_STATUS_READ_COMPLETE = $00080000; 650 | WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE = $00100000; 651 | WINHTTP_CALLBACK_STATUS_REQUEST_ERROR = $00200000; 652 | WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE = $00400000; 653 | 654 | 655 | // API Enums for WINHTTP_CALLBACK_STATUS_REQUEST_ERROR: 656 | API_RECEIVE_RESPONSE = (1); 657 | API_QUERY_DATA_AVAILABLE = (2); 658 | API_READ_DATA = (3); 659 | API_WRITE_DATA = (4); 660 | API_SEND_REQUEST = (5); 661 | 662 | 663 | WINHTTP_CALLBACK_FLAG_RESOLVE_NAME = (WINHTTP_CALLBACK_STATUS_RESOLVING_NAME or WINHTTP_CALLBACK_STATUS_NAME_RESOLVED); 664 | WINHTTP_CALLBACK_FLAG_CONNECT_TO_SERVER = (WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER or WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER); 665 | WINHTTP_CALLBACK_FLAG_SEND_REQUEST = (WINHTTP_CALLBACK_STATUS_SENDING_REQUEST or WINHTTP_CALLBACK_STATUS_REQUEST_SENT); 666 | WINHTTP_CALLBACK_FLAG_RECEIVE_RESPONSE = (WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE or WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED); 667 | WINHTTP_CALLBACK_FLAG_CLOSE_CONNECTION = (WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION or WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED); 668 | WINHTTP_CALLBACK_FLAG_HANDLES = (WINHTTP_CALLBACK_STATUS_HANDLE_CREATED or WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING); 669 | WINHTTP_CALLBACK_FLAG_DETECTING_PROXY = WINHTTP_CALLBACK_STATUS_DETECTING_PROXY; 670 | WINHTTP_CALLBACK_FLAG_REDIRECT = WINHTTP_CALLBACK_STATUS_REDIRECT; 671 | WINHTTP_CALLBACK_FLAG_INTERMEDIATE_RESPONSE = WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE; 672 | WINHTTP_CALLBACK_FLAG_SECURE_FAILURE = WINHTTP_CALLBACK_STATUS_SECURE_FAILURE; 673 | WINHTTP_CALLBACK_FLAG_SENDREQUEST_COMPLETE = WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE; 674 | WINHTTP_CALLBACK_FLAG_HEADERS_AVAILABLE = WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE; 675 | WINHTTP_CALLBACK_FLAG_DATA_AVAILABLE = WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE; 676 | WINHTTP_CALLBACK_FLAG_READ_COMPLETE = WINHTTP_CALLBACK_STATUS_READ_COMPLETE; 677 | WINHTTP_CALLBACK_FLAG_WRITE_COMPLETE = WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE; 678 | WINHTTP_CALLBACK_FLAG_REQUEST_ERROR = WINHTTP_CALLBACK_STATUS_REQUEST_ERROR; 679 | 680 | 681 | WINHTTP_CALLBACK_FLAG_ALL_COMPLETIONS = (WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE or 682 | WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE or 683 | WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE or 684 | WINHTTP_CALLBACK_STATUS_READ_COMPLETE or 685 | WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE or 686 | WINHTTP_CALLBACK_STATUS_REQUEST_ERROR); 687 | WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS = DWORD($ffffffff); 688 | 689 | // 690 | // if the following value is returned by WinHttpSetStatusCallback, then 691 | // probably an invalid (non-code) address was supplied for the callback 692 | // 693 | 694 | WINHTTP_INVALID_STATUS_CALLBACK = Pointer(-1); 695 | 696 | 697 | // 698 | // WinHttpQueryHeaders info levels. Generally, there is one info level 699 | // for each potential RFC822/HTTP/MIME header that an HTTP server 700 | // may send as part of a request response. 701 | // 702 | // The WINHTTP_QUERY_RAW_HEADERS info level is provided for clients 703 | // that choose to perform their own header parsing. 704 | // 705 | 706 | 707 | WINHTTP_QUERY_MIME_VERSION = 0; 708 | WINHTTP_QUERY_CONTENT_TYPE = 1; 709 | WINHTTP_QUERY_CONTENT_TRANSFER_ENCODING = 2; 710 | WINHTTP_QUERY_CONTENT_ID = 3; 711 | WINHTTP_QUERY_CONTENT_DESCRIPTION = 4; 712 | WINHTTP_QUERY_CONTENT_LENGTH = 5; 713 | WINHTTP_QUERY_CONTENT_LANGUAGE = 6; 714 | WINHTTP_QUERY_ALLOW = 7; 715 | WINHTTP_QUERY_PUBLIC = 8; 716 | WINHTTP_QUERY_DATE = 9; 717 | WINHTTP_QUERY_EXPIRES = 10; 718 | WINHTTP_QUERY_LAST_MODIFIED = 11; 719 | WINHTTP_QUERY_MESSAGE_ID = 12; 720 | WINHTTP_QUERY_URI = 13; 721 | WINHTTP_QUERY_DERIVED_FROM = 14; 722 | WINHTTP_QUERY_COST = 15; 723 | WINHTTP_QUERY_LINK = 16; 724 | WINHTTP_QUERY_PRAGMA = 17; 725 | WINHTTP_QUERY_VERSION = 18; // special: part of status line 726 | WINHTTP_QUERY_STATUS_CODE = 19; // special: part of status line 727 | WINHTTP_QUERY_STATUS_TEXT = 20; // special: part of status line 728 | WINHTTP_QUERY_RAW_HEADERS = 21; // special: all headers as ASCIIZ 729 | WINHTTP_QUERY_RAW_HEADERS_CRLF = 22; // special: all headers 730 | WINHTTP_QUERY_CONNECTION = 23; 731 | WINHTTP_QUERY_ACCEPT = 24; 732 | WINHTTP_QUERY_ACCEPT_CHARSET = 25; 733 | WINHTTP_QUERY_ACCEPT_ENCODING = 26; 734 | WINHTTP_QUERY_ACCEPT_LANGUAGE = 27; 735 | WINHTTP_QUERY_AUTHORIZATION = 28; 736 | WINHTTP_QUERY_CONTENT_ENCODING = 29; 737 | WINHTTP_QUERY_FORWARDED = 30; 738 | WINHTTP_QUERY_FROM = 31; 739 | WINHTTP_QUERY_IF_MODIFIED_SINCE = 32; 740 | WINHTTP_QUERY_LOCATION = 33; 741 | WINHTTP_QUERY_ORIG_URI = 34; 742 | WINHTTP_QUERY_REFERER = 35; 743 | WINHTTP_QUERY_RETRY_AFTER = 36; 744 | WINHTTP_QUERY_SERVER = 37; 745 | WINHTTP_QUERY_TITLE = 38; 746 | WINHTTP_QUERY_USER_AGENT = 39; 747 | WINHTTP_QUERY_WWW_AUTHENTICATE = 40; 748 | WINHTTP_QUERY_PROXY_AUTHENTICATE = 41; 749 | WINHTTP_QUERY_ACCEPT_RANGES = 42; 750 | WINHTTP_QUERY_SET_COOKIE = 43; 751 | WINHTTP_QUERY_COOKIE = 44; 752 | WINHTTP_QUERY_REQUEST_METHOD = 45; // special: GET/POST etc. 753 | WINHTTP_QUERY_REFRESH = 46; 754 | WINHTTP_QUERY_CONTENT_DISPOSITION = 47; 755 | 756 | // 757 | // HTTP 1.1 defined headers 758 | // 759 | 760 | WINHTTP_QUERY_AGE = 48; 761 | WINHTTP_QUERY_CACHE_CONTROL = 49; 762 | WINHTTP_QUERY_CONTENT_BASE = 50; 763 | WINHTTP_QUERY_CONTENT_LOCATION = 51; 764 | WINHTTP_QUERY_CONTENT_MD5 = 52; 765 | WINHTTP_QUERY_CONTENT_RANGE = 53; 766 | WINHTTP_QUERY_ETAG = 54; 767 | WINHTTP_QUERY_HOST = 55; 768 | WINHTTP_QUERY_IF_MATCH = 56; 769 | WINHTTP_QUERY_IF_NONE_MATCH = 57; 770 | WINHTTP_QUERY_IF_RANGE = 58; 771 | WINHTTP_QUERY_IF_UNMODIFIED_SINCE = 59; 772 | WINHTTP_QUERY_MAX_FORWARDS = 60; 773 | WINHTTP_QUERY_PROXY_AUTHORIZATION = 61; 774 | WINHTTP_QUERY_RANGE = 62; 775 | WINHTTP_QUERY_TRANSFER_ENCODING = 63; 776 | WINHTTP_QUERY_UPGRADE = 64; 777 | WINHTTP_QUERY_VARY = 65; 778 | WINHTTP_QUERY_VIA = 66; 779 | WINHTTP_QUERY_WARNING = 67; 780 | WINHTTP_QUERY_EXPECT = 68; 781 | WINHTTP_QUERY_PROXY_CONNECTION = 69; 782 | WINHTTP_QUERY_UNLESS_MODIFIED_SINCE = 70; 783 | 784 | 785 | 786 | WINHTTP_QUERY_PROXY_SUPPORT = 75; 787 | WINHTTP_QUERY_AUTHENTICATION_INFO = 76; 788 | WINHTTP_QUERY_PASSPORT_URLS = 77; 789 | WINHTTP_QUERY_PASSPORT_CONFIG = 78; 790 | 791 | WINHTTP_QUERY_MAX = 78; 792 | 793 | // 794 | // WINHTTP_QUERY_CUSTOM - if this special value is supplied as the dwInfoLevel 795 | // parameter of WinHttpQueryHeaders() then the lpBuffer parameter contains the name 796 | // of the header we are to query 797 | // 798 | 799 | WINHTTP_QUERY_CUSTOM = 65535; 800 | 801 | // 802 | // WINHTTP_QUERY_FLAG_REQUEST_HEADERS - if this bit is set in the dwInfoLevel 803 | // parameter of WinHttpQueryHeaders() then the request headers will be queried for the 804 | // request information 805 | // 806 | 807 | WINHTTP_QUERY_FLAG_REQUEST_HEADERS = DWORD($80000000); 808 | 809 | // 810 | // WINHTTP_QUERY_FLAG_SYSTEMTIME - if this bit is set in the dwInfoLevel parameter 811 | // of WinHttpQueryHeaders() AND the header being queried contains date information, 812 | // e.g. the "Expires:" header then lpBuffer will contain a SYSTEMTIME structure 813 | // containing the date and time information converted from the header string 814 | // 815 | 816 | WINHTTP_QUERY_FLAG_SYSTEMTIME = $40000000; 817 | 818 | // 819 | // WINHTTP_QUERY_FLAG_NUMBER - if this bit is set in the dwInfoLevel parameter of 820 | // HttpQueryHeader(), then the value of the header will be converted to a number 821 | // before being returned to the caller, if applicable 822 | // 823 | 824 | WINHTTP_QUERY_FLAG_NUMBER = $20000000; 825 | 826 | 827 | 828 | // 829 | // HTTP Response Status Codes: 830 | // 831 | 832 | HTTP_STATUS_CONTINUE = 100; // OK to continue with request 833 | HTTP_STATUS_SWITCH_PROTOCOLS = 101; // server has switched protocols in upgrade header 834 | 835 | HTTP_STATUS_OK = 200; // request completed 836 | HTTP_STATUS_CREATED = 201; // object created, reason = new URI 837 | HTTP_STATUS_ACCEPTED = 202; // async completion (TBS) 838 | HTTP_STATUS_PARTIAL = 203; // partial completion 839 | HTTP_STATUS_NO_CONTENT = 204; // no info to return 840 | HTTP_STATUS_RESET_CONTENT = 205; // request completed, but clear form 841 | HTTP_STATUS_PARTIAL_CONTENT = 206; // partial GET fulfilled 842 | HTTP_STATUS_WEBDAV_MULTI_STATUS = 207; // WebDAV Multi-Status 843 | 844 | HTTP_STATUS_AMBIGUOUS = 300; // server couldn't decide what to return 845 | HTTP_STATUS_MOVED = 301; // object permanently moved 846 | HTTP_STATUS_REDIRECT = 302; // object temporarily moved 847 | HTTP_STATUS_REDIRECT_METHOD = 303; // redirection w/ new access method 848 | HTTP_STATUS_NOT_MODIFIED = 304; // if-modified-since was not modified 849 | HTTP_STATUS_USE_PROXY = 305; // redirection to proxy, location header specifies proxy to use 850 | HTTP_STATUS_REDIRECT_KEEP_VERB = 307; // HTTP/1.1: keep same verb 851 | 852 | HTTP_STATUS_BAD_REQUEST = 400; // invalid syntax 853 | HTTP_STATUS_DENIED = 401; // access denied 854 | HTTP_STATUS_PAYMENT_REQ = 402; // payment required 855 | HTTP_STATUS_FORBIDDEN = 403; // request forbidden 856 | HTTP_STATUS_NOT_FOUND = 404; // object not found 857 | HTTP_STATUS_BAD_METHOD = 405; // method is not allowed 858 | HTTP_STATUS_NONE_ACCEPTABLE = 406; // no response acceptable to client found 859 | HTTP_STATUS_PROXY_AUTH_REQ = 407; // proxy authentication required 860 | HTTP_STATUS_REQUEST_TIMEOUT = 408; // server timed out waiting for request 861 | HTTP_STATUS_CONFLICT = 409; // user should resubmit with more info 862 | HTTP_STATUS_GONE = 410; // the resource is no longer available 863 | HTTP_STATUS_LENGTH_REQUIRED = 411; // the server refused to accept request w/o a length 864 | HTTP_STATUS_PRECOND_FAILED = 412; // precondition given in request failed 865 | HTTP_STATUS_REQUEST_TOO_LARGE = 413; // request entity was too large 866 | HTTP_STATUS_URI_TOO_LONG = 414; // request URI too long 867 | HTTP_STATUS_UNSUPPORTED_MEDIA = 415; // unsupported media type 868 | HTTP_STATUS_RETRY_WITH = 449; // retry after doing the appropriate action. 869 | 870 | HTTP_STATUS_SERVER_ERROR = 500; // internal server error 871 | HTTP_STATUS_NOT_SUPPORTED = 501; // required not supported 872 | HTTP_STATUS_BAD_GATEWAY = 502; // error response received from gateway 873 | HTTP_STATUS_SERVICE_UNAVAIL = 503; // temporarily overloaded 874 | HTTP_STATUS_GATEWAY_TIMEOUT = 504; // timed out waiting for gateway 875 | HTTP_STATUS_VERSION_NOT_SUP = 505; // HTTP version not supported 876 | 877 | HTTP_STATUS_FIRST = HTTP_STATUS_CONTINUE; 878 | HTTP_STATUS_LAST = HTTP_STATUS_VERSION_NOT_SUP; 879 | 880 | // 881 | // prototypes 882 | // 883 | 884 | function WinHttpOpenRequest 885 | ( 886 | hConnect: HINTERNET; 887 | pwszVerb: LPCWSTR; 888 | pwszObjectName: LPCWSTR; 889 | pwszVersion: LPCWSTR; 890 | pwszReferrer: LPCWSTR; 891 | ppwszAcceptTypes: LPCWSTR; //LPCWSTR FAR * 892 | dwFlags: DWORD 893 | ): HINTERNET; stdcall; 894 | 895 | // WinHttpOpenRequest prettifers for optional parameters 896 | const 897 | WINHTTP_NO_REFERER = nil; 898 | WINHTTP_DEFAULT_ACCEPT_TYPES = nil; 899 | 900 | function WinHttpAddRequestHeaders 901 | ( 902 | hRequest: HINTERNET; 903 | pwszHeaders: LPCWSTR; 904 | dwHeadersLength: DWORD; 905 | dwModifiers: DWORD 906 | ): BOOL; stdcall; 907 | 908 | // 909 | // values for dwModifiers parameter of WinHttpAddRequestHeaders() 910 | // 911 | const 912 | WINHTTP_ADDREQ_INDEX_MASK = $0000FFFF; 913 | WINHTTP_ADDREQ_FLAGS_MASK = DWORD($FFFF0000); 914 | 915 | // 916 | // WINHTTP_ADDREQ_FLAG_ADD_IF_NEW - the header will only be added if it doesn't 917 | // already exist 918 | // 919 | 920 | WINHTTP_ADDREQ_FLAG_ADD_IF_NEW = $10000000; 921 | 922 | // 923 | // WINHTTP_ADDREQ_FLAG_ADD - if WINHTTP_ADDREQ_FLAG_REPLACE is set but the header is 924 | // not found then if this flag is set, the header is added anyway, so long as 925 | // there is a valid header-value 926 | // 927 | 928 | WINHTTP_ADDREQ_FLAG_ADD = $20000000; 929 | 930 | // 931 | // WINHTTP_ADDREQ_FLAG_COALESCE - coalesce headers with same name. e.g. 932 | // "Accept: text/*" and "Accept: audio/*" with this flag results in a single 933 | // header: "Accept: text/*, audio/*" 934 | // 935 | 936 | WINHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA = $40000000; 937 | WINHTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON = $01000000; 938 | WINHTTP_ADDREQ_FLAG_COALESCE = WINHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA; 939 | 940 | // 941 | // WINHTTP_ADDREQ_FLAG_REPLACE - replaces the specified header. Only one header can 942 | // be supplied in the buffer. If the header to be replaced is not the first 943 | // in a list of headers with the same name, then the relative index should be 944 | // supplied in the low 8 bits of the dwModifiers parameter. If the header-value 945 | // part is missing, then the header is removed 946 | // 947 | 948 | WINHTTP_ADDREQ_FLAG_REPLACE = DWORD($80000000); 949 | 950 | WINHTTP_IGNORE_REQUEST_TOTAL_LENGTH = 0; 951 | 952 | function WinHttpSendRequest 953 | ( 954 | hRequest: HINTERNET; 955 | pwszHeaders: LPCWSTR; 956 | dwHeadersLength: DWORD; 957 | lpOptional: Pointer; 958 | dwOptionalLength: DWORD; 959 | dwTotalLength: DWORD; 960 | dwContext: DWORD_PTR 961 | ): BOOL; stdcall; 962 | 963 | // WinHttpSendRequest prettifiers for optional parameters. 964 | const 965 | WINHTTP_NO_ADDITIONAL_HEADERS = nil; 966 | WINHTTP_NO_REQUEST_DATA = nil; 967 | 968 | 969 | function WinHttpSetCredentials 970 | ( 971 | 972 | hRequest: HINTERNET; // HINTERNET handle returned by WinHttpOpenRequest. 973 | 974 | 975 | AuthTargets: DWORD; // Only WINHTTP_AUTH_TARGET_SERVER and 976 | // WINHTTP_AUTH_TARGET_PROXY are supported 977 | // in this version and they are mutually 978 | // exclusive 979 | 980 | AuthScheme: DWORD; // must be one of the supported Auth Schemes 981 | // returned from WinHttpQueryAuthSchemes() 982 | 983 | pwszUserName: LPCWSTR; // 1) NULL if default creds is to be used, in 984 | // which case pszPassword will be ignored 985 | 986 | pwszPassword: LPCWSTR; // 1) "" == Blank Password; 2)Parameter ignored 987 | // if pszUserName is NULL; 3) Invalid to pass in 988 | // NULL if pszUserName is not NULL 989 | pAuthParams: Pointer 990 | ): BOOL; stdcall; 991 | 992 | 993 | function WinHttpQueryAuthSchemes 994 | ( 995 | hRequest: HINTERNET; // HINTERNET handle returned by WinHttpOpenRequest 996 | lpdwSupportedSchemes: LPDWORD; // a bitmap of available Authentication Schemes 997 | lpdwFirstScheme: LPDWORD; // returns the first auth scheme returned by the server 998 | pdwAuthTarget: LPDWORD 999 | ): BOOL; stdcall; 1000 | 1001 | function WinHttpQueryAuthParams( 1002 | hRequest: HINTERNET; // HINTERNET handle returned by WinHttpOpenRequest 1003 | AuthScheme: DWORD; 1004 | pAuthParams: Pointer // Scheme-specific Advanced auth parameters 1005 | ): BOOL; stdcall; 1006 | 1007 | function WinHttpReceiveResponse 1008 | ( 1009 | hRequest: HINTERNET; 1010 | lpReserved: Pointer 1011 | ): BOOL; stdcall; 1012 | 1013 | 1014 | 1015 | function WinHttpQueryHeaders 1016 | ( 1017 | hRequest: HINTERNET; 1018 | dwInfoLevel: DWORD; 1019 | pwszName: LPCWSTR; 1020 | lpBuffer: Pointer; 1021 | lpdwBufferLength: LPDWORD; 1022 | lpdwIndex: LPDWORD 1023 | ): BOOL; stdcall; 1024 | 1025 | // WinHttpQueryHeaders prettifiers for optional parameters. 1026 | const 1027 | WINHTTP_HEADER_NAME_BY_INDEX = nil; 1028 | WINHTTP_NO_OUTPUT_BUFFER = nil; 1029 | WINHTTP_NO_HEADER_INDEX = nil; 1030 | 1031 | function WinHttpDetectAutoProxyConfigUrl 1032 | ( 1033 | dwAutoDetectFlags: DWORD; 1034 | ppwszAutoConfigUrl: PLPWSTR 1035 | ): BOOL; stdcall; 1036 | 1037 | function WinHttpGetProxyForUrl 1038 | ( 1039 | hSession: HINTERNET; 1040 | lpcwszUrl: LPCWSTR; 1041 | pAutoProxyOptions: PWinHttpAutoProxyOptions; 1042 | pProxyInfo: PWinHttpProxyInfo 1043 | ): BOOL; stdcall; 1044 | 1045 | type 1046 | PWinHttpCurrentUserIEProxyConfig = ^TWinHttpCurrentUserIEProxyConfig; 1047 | WINHTTP_CURRENT_USER_IE_PROXY_CONFIG = record 1048 | fAutoDetect: BOOL; 1049 | lpszAutoConfigUrl: LPWSTR; 1050 | lpszProxy: LPWSTR; 1051 | lpszProxyBypass: LPWSTR; 1052 | end; 1053 | TWinHttpCurrentUserIEProxyConfig = WINHTTP_CURRENT_USER_IE_PROXY_CONFIG; 1054 | 1055 | function WinHttpGetIEProxyConfigForCurrentUser 1056 | ( 1057 | pProxyConfig: PWinHttpCurrentUserIEProxyConfig 1058 | ): BOOL; stdcall; 1059 | 1060 | 1061 | //#if !defined(_WINERROR_) 1062 | 1063 | // 1064 | // WinHttp API error returns 1065 | // 1066 | const 1067 | WINHTTP_ERROR_BASE = 12000; 1068 | 1069 | ERROR_WINHTTP_OUT_OF_HANDLES = (WINHTTP_ERROR_BASE + 1); 1070 | ERROR_WINHTTP_TIMEOUT = (WINHTTP_ERROR_BASE + 2); 1071 | ERROR_WINHTTP_INTERNAL_ERROR = (WINHTTP_ERROR_BASE + 4); 1072 | ERROR_WINHTTP_INVALID_URL = (WINHTTP_ERROR_BASE + 5); 1073 | ERROR_WINHTTP_UNRECOGNIZED_SCHEME = (WINHTTP_ERROR_BASE + 6); 1074 | ERROR_WINHTTP_NAME_NOT_RESOLVED = (WINHTTP_ERROR_BASE + 7); 1075 | ERROR_WINHTTP_INVALID_OPTION = (WINHTTP_ERROR_BASE + 9); 1076 | ERROR_WINHTTP_OPTION_NOT_SETTABLE = (WINHTTP_ERROR_BASE + 11); 1077 | ERROR_WINHTTP_SHUTDOWN = (WINHTTP_ERROR_BASE + 12); 1078 | 1079 | 1080 | ERROR_WINHTTP_LOGIN_FAILURE = (WINHTTP_ERROR_BASE + 15); 1081 | ERROR_WINHTTP_OPERATION_CANCELLED = (WINHTTP_ERROR_BASE + 17); 1082 | ERROR_WINHTTP_INCORRECT_HANDLE_TYPE = (WINHTTP_ERROR_BASE + 18); 1083 | ERROR_WINHTTP_INCORRECT_HANDLE_STATE = (WINHTTP_ERROR_BASE + 19); 1084 | ERROR_WINHTTP_CANNOT_CONNECT = (WINHTTP_ERROR_BASE + 29); 1085 | ERROR_WINHTTP_CONNECTION_ERROR = (WINHTTP_ERROR_BASE + 30); 1086 | ERROR_WINHTTP_RESEND_REQUEST = (WINHTTP_ERROR_BASE + 32); 1087 | 1088 | ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED = (WINHTTP_ERROR_BASE + 44); 1089 | 1090 | // 1091 | // WinHttpRequest Component errors 1092 | // 1093 | ERROR_WINHTTP_CANNOT_CALL_BEFORE_OPEN = (WINHTTP_ERROR_BASE + 100); 1094 | ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND = (WINHTTP_ERROR_BASE + 101); 1095 | ERROR_WINHTTP_CANNOT_CALL_AFTER_SEND = (WINHTTP_ERROR_BASE + 102); 1096 | ERROR_WINHTTP_CANNOT_CALL_AFTER_OPEN = (WINHTTP_ERROR_BASE + 103); 1097 | 1098 | 1099 | // 1100 | // HTTP API errors 1101 | // 1102 | 1103 | ERROR_WINHTTP_HEADER_NOT_FOUND = (WINHTTP_ERROR_BASE + 150); 1104 | ERROR_WINHTTP_INVALID_SERVER_RESPONSE = (WINHTTP_ERROR_BASE + 152); 1105 | ERROR_WINHTTP_INVALID_HEADER = (WINHTTP_ERROR_BASE + 153); 1106 | ERROR_WINHTTP_INVALID_QUERY_REQUEST = (WINHTTP_ERROR_BASE + 154); 1107 | ERROR_WINHTTP_HEADER_ALREADY_EXISTS = (WINHTTP_ERROR_BASE + 155); 1108 | ERROR_WINHTTP_REDIRECT_FAILED = (WINHTTP_ERROR_BASE + 156); 1109 | 1110 | 1111 | 1112 | // 1113 | // additional WinHttp API error codes 1114 | // 1115 | 1116 | // 1117 | // additional WinHttp API error codes 1118 | // 1119 | ERROR_WINHTTP_AUTO_PROXY_SERVICE_ERROR = (WINHTTP_ERROR_BASE + 178); 1120 | ERROR_WINHTTP_BAD_AUTO_PROXY_SCRIPT = (WINHTTP_ERROR_BASE + 166); 1121 | ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT = (WINHTTP_ERROR_BASE + 167); 1122 | 1123 | ERROR_WINHTTP_NOT_INITIALIZED = (WINHTTP_ERROR_BASE + 172); 1124 | ERROR_WINHTTP_SECURE_FAILURE = (WINHTTP_ERROR_BASE + 175); 1125 | 1126 | 1127 | // 1128 | // Certificate security errors. These are raised only by the WinHttpRequest 1129 | // component. The WinHTTP Win32 API will return ERROR_WINHTTP_SECURE_FAILE and 1130 | // provide additional information via the WINHTTP_CALLBACK_STATUS_SECURE_FAILURE 1131 | // callback notification. 1132 | // 1133 | ERROR_WINHTTP_SECURE_CERT_DATE_INVALID = (WINHTTP_ERROR_BASE + 37); 1134 | ERROR_WINHTTP_SECURE_CERT_CN_INVALID = (WINHTTP_ERROR_BASE + 38); 1135 | ERROR_WINHTTP_SECURE_INVALID_CA = (WINHTTP_ERROR_BASE + 45); 1136 | ERROR_WINHTTP_SECURE_CERT_REV_FAILED = (WINHTTP_ERROR_BASE + 57); 1137 | ERROR_WINHTTP_SECURE_CHANNEL_ERROR = (WINHTTP_ERROR_BASE + 157); 1138 | ERROR_WINHTTP_SECURE_INVALID_CERT = (WINHTTP_ERROR_BASE + 169); 1139 | ERROR_WINHTTP_SECURE_CERT_REVOKED = (WINHTTP_ERROR_BASE + 170); 1140 | ERROR_WINHTTP_SECURE_CERT_WRONG_USAGE = (WINHTTP_ERROR_BASE + 179); 1141 | 1142 | 1143 | ERROR_WINHTTP_AUTODETECTION_FAILED = (WINHTTP_ERROR_BASE + 180); 1144 | ERROR_WINHTTP_HEADER_COUNT_EXCEEDED = (WINHTTP_ERROR_BASE + 181); 1145 | ERROR_WINHTTP_HEADER_SIZE_OVERFLOW = (WINHTTP_ERROR_BASE + 182); 1146 | ERROR_WINHTTP_CHUNKED_ENCODING_HEADER_SIZE_OVERFLOW = (WINHTTP_ERROR_BASE + 183); 1147 | ERROR_WINHTTP_RESPONSE_DRAIN_OVERFLOW = (WINHTTP_ERROR_BASE + 184); 1148 | ERROR_WINHTTP_CLIENT_CERT_NO_PRIVATE_KEY = (WINHTTP_ERROR_BASE + 185); 1149 | ERROR_WINHTTP_CLIENT_CERT_NO_ACCESS_PRIVATE_KEY = (WINHTTP_ERROR_BASE + 186); 1150 | 1151 | WINHTTP_ERROR_LAST = (WINHTTP_ERROR_BASE + 186); 1152 | 1153 | implementation 1154 | 1155 | const 1156 | Winhttpdll = 'Winhttp.dll'; 1157 | 1158 | function WinHttpAddRequestHeaders; external Winhttpdll name 'WinHttpAddRequestHeaders'; 1159 | function WinHttpCheckPlatform; external Winhttpdll name 'WinHttpCheckPlatform'; 1160 | function WinHttpCloseHandle; external Winhttpdll name 'WinHttpCloseHandle'; 1161 | function WinHttpConnect; external Winhttpdll name 'WinHttpConnect'; 1162 | function WinHttpCrackUrl; external Winhttpdll name 'WinHttpCrackUrl'; 1163 | function WinHttpCreateUrl; external Winhttpdll name 'WinHttpCreateUrl'; 1164 | function WinHttpDetectAutoProxyConfigUrl; external Winhttpdll name 'WinHttpDetectAutoProxyConfigUrl'; 1165 | function WinHttpGetDefaultProxyConfiguration; external Winhttpdll name 'WinHttpGetDefaultProxyConfiguration'; 1166 | function WinHttpGetIEProxyConfigForCurrentUser; external Winhttpdll name 'WinHttpGetIEProxyConfigForCurrentUser'; 1167 | function WinHttpGetProxyForUrl; external Winhttpdll name 'WinHttpGetProxyForUrl'; 1168 | function WinHttpOpen; external Winhttpdll name 'WinHttpOpen'; 1169 | function WinHttpOpenRequest; external Winhttpdll name 'WinHttpOpenRequest'; 1170 | function WinHttpQueryAuthParams; external Winhttpdll name 'WinHttpQueryAuthParams'; 1171 | function WinHttpQueryAuthSchemes; external Winhttpdll name 'WinHttpQueryAuthSchemes'; 1172 | function WinHttpQueryDataAvailable; external Winhttpdll name 'WinHttpQueryDataAvailable'; 1173 | function WinHttpQueryHeaders; external Winhttpdll name 'WinHttpQueryHeaders'; 1174 | function WinHttpQueryOption; external Winhttpdll name 'WinHttpQueryOption'; 1175 | function WinHttpReadData; external Winhttpdll name 'WinHttpReadData'; 1176 | function WinHttpReceiveResponse; external Winhttpdll name 'WinHttpReceiveResponse'; 1177 | function WinHttpSendRequest; external Winhttpdll name 'WinHttpSendRequest'; 1178 | function WinHttpSetCredentials; external Winhttpdll name 'WinHttpSetCredentials'; 1179 | function WinHttpSetDefaultProxyConfiguration; external Winhttpdll name 'WinHttpDefaultProxyConfiguration'; 1180 | function WinHttpSetOption; external Winhttpdll name 'WinHttpSetOption'; 1181 | function WinHttpSetStatusCallback; external Winhttpdll name 'WinHttpSetStatusCallback'; 1182 | function WinHttpSetTimeouts; external Winhttpdll name 'WinHttpSetTimeouts'; 1183 | function WinHttpTimeFromSystemTime; external Winhttpdll name 'WinHttpTimeFromSystemTime'; 1184 | function WinHttpTimeToSystemTime; external Winhttpdll name 'WinHttpTimeToSystemTime'; 1185 | function WinHttpWriteData; external Winhttpdll name 'WinHttpWriteData'; 1186 | 1187 | end. 1188 | --------------------------------------------------------------------------------