using System; using Vanara.InteropServices; using static Vanara.PInvoke.Schannel; using static Vanara.PInvoke.Ws2_32; namespace Vanara.PInvoke { /// Items from the WinHTTP.dll. public static partial class WinHTTP { /// The default internet HTTP port. public const ushort INTERNET_DEFAULT_HTTP_PORT = 80; /// The default internet HTTPS port. public const ushort INTERNET_DEFAULT_HTTPS_PORT = 443; /// The default internet port for the specified protocol. public const ushort INTERNET_DEFAULT_PORT = 0; /// public const WINHTTP_ADDREQ_FLAG WINHTTP_ADDREQ_FLAGS_MASK = (WINHTTP_ADDREQ_FLAG)0xFFFF0000; /// public const WINHTTP_ADDREQ_FLAG WINHTTP_ADDREQ_INDEX_MASK = (WINHTTP_ADDREQ_FLAG)0x0000FFFF; /// Default value. public const string WINHTTP_HEADER_NAME_BY_INDEX = null; /// Default value. public const string WINHTTP_NO_ADDITIONAL_HEADERS = null; /// Default value. public const string WINHTTP_NO_HEADER_INDEX = null; /// Default value. public const string WINHTTP_NO_OUTPUT_BUFFER = null; /// public const string WINHTTP_NO_PROXY_BYPASS = null; /// public const string WINHTTP_NO_PROXY_NAME = null; /// Default value. public const string WINHTTP_NO_REQUEST_DATA = null; /// The size of a string buffer to recieve a formatted time. public const uint WINHTTP_TIME_FORMAT_BUFSIZE = 62; /// If the following value is returned by WinHttpSetStatusCallback, then probably an invalid (non-code) address was supplied for the callback. public static readonly IntPtr WINHTTP_INVALID_STATUS_CALLBACK = new(-1); /// Return value from an asynchronous Microsoft Windows HTTP Services (WinHTTP) function. [PInvokeData("winhttp.h", MSDNShortId = "NS:winhttp._WINHTTP_ASYNC_RESULT")] public enum ASYNC_RESULT : ulong { /// The error occurred during a call to WinHttpReceiveResponse. API_RECEIVE_RESPONSE = 1, /// The error occurred during a call to WinHttpQueryDataAvailable. API_QUERY_DATA_AVAILABLE = 2, /// The error occurred during a call to WinHttpReadData. API_READ_DATA = 3, /// The error occurred during a call to WinHttpWriteData. API_WRITE_DATA = 4, /// The error occurred during a call to WinHttpSendRequest. API_SEND_REQUEST = 5, /// The error occurred during a call to WinHttpGetProxyForUrl. API_GET_PROXY_FOR_URL = 6, } /// These constants and corresponding values indicate HTTP status codes returned by servers on the Internet. [PInvokeData("winhttp.h")] public enum HTTP_STATUS { /// The request can be continued. HTTP_STATUS_CONTINUE = 100, /// The server has switched protocols in an upgrade header. HTTP_STATUS_SWITCH_PROTOCOLS = 101, /// The request completed successfully. HTTP_STATUS_OK = 200, /// The request has been fulfilled and resulted in the creation of a new resource. HTTP_STATUS_CREATED = 201, /// The request has been accepted for processing, but the processing has not been completed. HTTP_STATUS_ACCEPTED = 202, /// The returned meta information in the entity-header is not the definitive set available from the originating server. HTTP_STATUS_PARTIAL = 203, /// The server has fulfilled the request, but there is no new information to send back. HTTP_STATUS_NO_CONTENT = 204, /// /// The request has been completed, and the client program should reset the document view that caused the request to be sent to /// allow the user to easily initiate another input action. /// HTTP_STATUS_RESET_CONTENT = 205, /// The server has fulfilled the partial GET request for the resource. HTTP_STATUS_PARTIAL_CONTENT = 206, /// /// During a World Wide Web Distributed Authoring and Versioning (WebDAV) operation, this indicates multiple status codes for a /// single response. The response body contains Extensible Markup Language (XML) that describes the status codes. For more /// information, see HTTP Extensions for Distributed Authoring. /// HTTP_STATUS_WEBDAV_MULTI_STATUS = 207, /// The requested resource is available at one or more locations. HTTP_STATUS_AMBIGUOUS = 300, /// /// The requested resource has been assigned to a new permanent Uniform Resource Identifier (URI), and any future references to /// this resource should be done using one of the returned URIs. /// HTTP_STATUS_MOVED = 301, /// The requested resource resides temporarily under a different URI. HTTP_STATUS_REDIRECT = 302, /// /// The response to the request can be found under a different URI and should be retrieved using a GET HTTP verb on that resource. /// HTTP_STATUS_REDIRECT_METHOD = 303, /// The requested resource has not been modified. HTTP_STATUS_NOT_MODIFIED = 304, /// The requested resource must be accessed through the proxy given by the location field. HTTP_STATUS_USE_PROXY = 305, /// The redirected request keeps the same HTTP verb. HTTP/1.1 behavior. HTTP_STATUS_REDIRECT_KEEP_VERB = 307, /// The request could not be processed by the server due to invalid syntax. HTTP_STATUS_BAD_REQUEST = 400, /// The requested resource requires user authentication. HTTP_STATUS_DENIED = 401, /// Not implemented in the HTTP protocol. HTTP_STATUS_PAYMENT_REQ = 402, /// The server understood the request, but cannot fulfill it. HTTP_STATUS_FORBIDDEN = 403, /// The server has not found anything that matches the requested URI. HTTP_STATUS_NOT_FOUND = 404, /// The HTTP verb used is not allowed. HTTP_STATUS_BAD_METHOD = 405, /// No responses acceptable to the client were found. HTTP_STATUS_NONE_ACCEPTABLE = 406, /// Proxy authentication required. HTTP_STATUS_PROXY_AUTH_REQ = 407, /// The server timed out waiting for the request. HTTP_STATUS_REQUEST_TIMEOUT = 408, /// /// The request could not be completed due to a conflict with the current state of the resource. The user should resubmit with /// more information. /// HTTP_STATUS_CONFLICT = 409, /// The requested resource is no longer available at the server, and no forwarding address is known. HTTP_STATUS_GONE = 410, /// The server cannot accept the request without a defined content length. HTTP_STATUS_LENGTH_REQUIRED = 411, /// /// The precondition given in one or more of the request header fields evaluated to false when it was tested on the server. /// HTTP_STATUS_PRECOND_FAILED = 412, /// The server cannot process the request because the request entity is larger than the server is able to process. HTTP_STATUS_REQUEST_TOO_LARGE = 413, /// The server cannot service the request because the request URI is longer than the server can interpret. HTTP_STATUS_URI_TOO_LONG = 414, /// /// The server cannot service the request because the entity of the request is in a format not supported by the requested /// resource for the requested method. /// HTTP_STATUS_UNSUPPORTED_MEDIA = 415, /// The request should be retried after doing the appropriate action. HTTP_STATUS_RETRY_WITH = 449, /// The server encountered an unexpected condition that prevented it from fulfilling the request. HTTP_STATUS_SERVER_ERROR = 500, /// The server does not support the functionality required to fulfill the request. HTTP_STATUS_NOT_SUPPORTED = 501, /// /// The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in /// attempting to fulfill the request. /// HTTP_STATUS_BAD_GATEWAY = 502, /// The service is temporarily overloaded. HTTP_STATUS_SERVICE_UNAVAIL = 503, /// The request was timed out waiting for a gateway. HTTP_STATUS_GATEWAY_TIMEOUT = 504, /// The server does not support the HTTP protocol version that was used in the request message. HTTP_STATUS_VERSION_NOT_SUP = 505, } /// Flags that control the operation of this function. [PInvokeData("winhttp.h", MSDNShortId = "NF:winhttp.WinHttpCreateUrl")] [Flags] public enum ICU : uint { /// Does not convert unsafe characters to escape sequences. ICU_NO_ENCODE = 0x20000000, /// Converts all %XX sequences to characters, including escape sequences, before the URL is parsed. ICU_DECODE = 0x10000000, /// Does not remove meta sequences (such as "." and "..") from the URL. ICU_NO_META = 0x08000000, /// Encodes spaces only. ICU_ENCODE_SPACES_ONLY = 0x04000000, /// /// Does not encode or decode characters after "#" or "?", and does not remove trailing white space after "?". If this value is /// not specified, the entire URL is encoded and trailing white space is removed. /// ICU_BROWSER_MODE = 0x02000000, /// /// Encodes any percent signs encountered. By default, percent signs are not encoded. This value is available in Microsoft /// Internet Explorer 5 and later. /// ICU_ENCODE_PERCENT = 0x00001000, /// /// Converts all unsafe characters to their corresponding escape sequences in the path string pointed to by the /// lpszUrlPath member and in lpszExtraInfo the extra-information string pointed to by the member of the /// URL_COMPONENTS structure pointed to by the lpUrlComponents parameter. /// ICU_ESCAPE = 0x80000000, /// /// The percent character (%) in the IPv6 literal address must be percent escaped when present in the URI. For example, the scope /// ID FE80::2%3, must appear in the URI as "https://[FE80::2%253]/", where %25 is the hex encoded percent character (%). If the /// application retrieves the URI from a Unicode API, such as the Winsock WSAAddressToString API, the application must add the /// escaped version of the percent character (%) in the hostname of the URI. To create the escaped version of the URI, /// applications call InternetCreateUrl with the dwFlags parameter set to ICU_ESCAPE_AUTHORITY, and the IPv6 hostname specified /// in the URL components structure specified in the lpUrlComponents parameter. /// ICU_ESCAPE_AUTHORITY = 0x00002000, /// /// Rejects URLs as input that contains either a username, or a password, or both. If the function fails because of an invalid /// URL, subsequent calls to GetLastError will return ERROR_WINHTTP_INVALID_URL. /// ICU_REJECT_USERPWD = 0x00004000, } /// Internet schemes supported by WinHTTP. [PInvokeData("winhttp.h")] public enum INTERNET_SCHEME { /// An HTTP internet scheme. INTERNET_SCHEME_HTTP = 1, /// An HTTPS (SSL) internet scheme. INTERNET_SCHEME_HTTPS = 2, /// An FTP internet scheme. This scheme is only supported for use in WinHttpGetProxyForUrl and WinHttpGetProxyForUrlEx. INTERNET_SCHEME_FTP = 3, /// A SOCKS internet scheme. This scheme is only supported for use in WINHTTP_PROXY_RESULT_ENTRY. INTERNET_SCHEME_SOCKS = 4, } /// Contains the security flags for a handle. [PInvokeData("winhttp.h")] [Flags] public enum SECURITY_FLAG : uint { /// Uses secure transfers. This is only returned in a call to WinHttpQueryOption. SECURITY_FLAG_SECURE = 0x00000001, /// Uses weak (40-bit) encryption. This is only returned in a call to WinHttpQueryOption. SECURITY_FLAG_STRENGTH_WEAK = 0x10000000, /// Uses medium (56-bit) encryption. This is only returned in a call to WinHttpQueryOption. SECURITY_FLAG_STRENGTH_MEDIUM = 0x40000000, /// Uses strong (128-bit) encryption. This is only returned in a call to WinHttpQueryOption. SECURITY_FLAG_STRENGTH_STRONG = 0x20000000, /// /// Allows an invalid certificate authority. If this flag is set, the application does not receive a /// WINHTTP_CALLBACK_STATUS_FLAG_INVALID_CA callback. /// SECURITY_FLAG_IGNORE_UNKNOWN_CA = 0x00000100, /// /// Allows an invalid certificate date, that is, an expired or not-yet-effective certificate. If this flag is set, the /// application does not receive a WINHTTP_CALLBACK_STATUS_FLAG_CERT_DATE_INVALID callback. /// SECURITY_FLAG_IGNORE_CERT_DATE_INVALID = 0x00002000, /// /// Allows an invalid common name in a certificate; that is, the server name specified by the application does not match the /// common name in the certificate. If this flag is set, the application does not receive a /// WINHTTP_CALLBACK_STATUS_FLAG_CERT_CN_INVALID callback. /// SECURITY_FLAG_IGNORE_CERT_CN_INVALID = 0x00001000, /// Allows the identity of a server to be established with a non-server certificate (for example, a client certificate). SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE = 0x00000200, /// /// Allows a weak signature to be ignored. This flag is available in the rollup update for each OS starting with Windows 7 and /// Windows Server 2008 R2. /// SECURITY_FLAG_IGNORE_ALL_CERT_ERRORS = SECURITY_FLAG_IGNORE_UNKNOWN_CA | SECURITY_FLAG_IGNORE_CERT_DATE_INVALID | SECURITY_FLAG_IGNORE_CERT_CN_INVALID | SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE } /// The access type. [PInvokeData("winhttp.h", MSDNShortId = "NS:winhttp._WINHTTP_PROXY_INFO")] public enum WINHTTP_ACCESS_TYPE : uint { /// Applies only when setting proxy information. WINHTTP_ACCESS_TYPE_DEFAULT_PROXY = 0, /// Internet accessed through a direct connection. WINHTTP_ACCESS_TYPE_NO_PROXY = 1, /// Internet accessed using a proxy. WINHTTP_ACCESS_TYPE_NAMED_PROXY = 3, /// Internet accessed using an automatic proxy. WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY = 4, } /// contains the flags used to modify the semantics of this function. [PInvokeData("winhttp.h", MSDNShortId = "NF:winhttp.WinHttpAddRequestHeaders")] [Flags] public enum WINHTTP_ADDREQ_FLAG : uint { /// Adds the header only if it does not already exist; otherwise, an error is returned. WINHTTP_ADDREQ_FLAG_ADD_IF_NEW = 0x10000000, /// Adds the header if it does not exist. Used with WINHTTP_ADDREQ_FLAG_REPLACE. WINHTTP_ADDREQ_FLAG_ADD = 0x20000000, /// /// Merges headers of the same name using a comma. For example, adding "Accept: text/*" followed by "Accept: audio/*" with this /// flag results in a single header "Accept: text/*, audio/*". This causes the first header found to be merged. The calling /// application must to ensure a cohesive scheme with respect to merged and separate headers. /// WINHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA = 0x40000000, /// Merges headers of the same name using a semicolon. WINHTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON = 0x01000000, /// Merges headers of the same name. WINHTTP_ADDREQ_FLAG_COALESCE = WINHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA, /// /// Replaces or removes a header. If the header value is empty and the header is found, it is removed. If the value is not empty, /// it is replaced. /// WINHTTP_ADDREQ_FLAG_REPLACE = 0x80000000, } /// A flag that contains the authentication scheme. [PInvokeData("winhttp.h", MSDNShortId = "NS:winhttp.tagWINHTTP_CREDS")] [Flags] public enum WINHTTP_AUTH_SCHEME : uint { /// Use basic authentication. WINHTTP_AUTH_SCHEME_BASIC = 0x00000001, /// Use NTLM authentication. WINHTTP_AUTH_SCHEME_NTLM = 0x00000002, /// Indicates passport authentication is available. WINHTTP_AUTH_SCHEME_PASSPORT = 0x00000004, /// Use digest authentication. WINHTTP_AUTH_SCHEME_DIGEST = 0x00000008, /// Select between NTLM and Kerberos authentication. WINHTTP_AUTH_SCHEME_NEGOTIATE = 0x00000010, } /// Specifies a flag that contains the authentication target. [PInvokeData("winhttp.h", MSDNShortId = "NF:winhttp.WinHttpQueryAuthSchemes")] [Flags] public enum WINHTTP_AUTH_TARGET : uint { /// Authentication target is a server. Indicates that a 401 status code has been received. WINHTTP_AUTH_TARGET_SERVER = 0x00000000, /// Authentication target is a proxy. Indicates that a 407 status code has been received. WINHTTP_AUTH_TARGET_PROXY = 0x00000001, } /// Specifies what protocols are to be used to locate the PAC file. [PInvokeData("winhttp.h", MSDNShortId = "NS:winhttp._WINHTTP_AUTOPROXY_OPTIONS")] [Flags] public enum WINHTTP_AUTO_DETECT_TYPE : uint { /// Use DHCP to locate the proxy auto-configuration file. WINHTTP_AUTO_DETECT_TYPE_DHCP = 0x00000001, /// /// Use DNS to attempt to locate the proxy auto-configuration file at a well-known location on the domain of the local computer. /// WINHTTP_AUTO_DETECT_TYPE_DNS_A = 0x00000002, } /// Values for WINHTTP_OPTION_AUTOLOGON_POLICY. [PInvokeData("winhttp.h")] public enum WINHTTP_AUTOLOGON_SECURITY_LEVEL : uint { /// WINHTTP_AUTOLOGON_SECURITY_LEVEL_MEDIUM WINHTTP_AUTOLOGON_SECURITY_LEVEL_DEFAULT = WINHTTP_AUTOLOGON_SECURITY_LEVEL_MEDIUM, /// An authenticated log on using the default credentials is performed only for requests on the local Intranet. WINHTTP_AUTOLOGON_SECURITY_LEVEL_MEDIUM = 0, /// An authenticated log on using the default credentials is performed for all requests. WINHTTP_AUTOLOGON_SECURITY_LEVEL_LOW = 1, /// /// Default credentials are not used. Note that this flag takes effect only if you specify the server by the actual machine name. /// It will not take effect, if you specify the server by "localhost" or IP address. /// WINHTTP_AUTOLOGON_SECURITY_LEVEL_HIGH = 2, } /// Mechanisms should be used to obtain the PAC file. [PInvokeData("winhttp.h", MSDNShortId = "NS:winhttp._WINHTTP_AUTOPROXY_OPTIONS")] [Flags] public enum WINHTTP_AUTOPROXY : uint { /// Attempt to automatically discover the URL of the PAC file using both DHCP and DNS queries to the local network. WINHTTP_AUTOPROXY_AUTO_DETECT = 0x00000001, /// /// Download the PAC file from the URL specified by lpszAutoConfigUrl in the WINHTTP_AUTOPROXY_OPTIONS structure. /// WINHTTP_AUTOPROXY_CONFIG_URL = 0x00000002, /// Maintains the case of the hostnames passed to the PAC script. This is the default behavior. WINHTTP_AUTOPROXY_HOST_KEEPCASE = 0x00000004, /// Converts hostnames to lowercase before passing them to the PAC script. WINHTTP_AUTOPROXY_HOST_LOWERCASE = 0x00000008, /// Enables proxy detection via autoconfig URL. WINHTTP_AUTOPROXY_ALLOW_AUTOCONFIG = 0x00000100, /// Enables proxy detection via static configuration. WINHTTP_AUTOPROXY_ALLOW_STATIC = 0x00000200, /// Enables proxy detection via connection manager. WINHTTP_AUTOPROXY_ALLOW_CM = 0x00000400, /// /// Executes the Web Proxy Auto-Discovery (WPAD) protocol in-process instead of delegating to an out-of-process WinHTTP AutoProxy /// Service, if available. This flag must be combined with one of the other flags. This option has no effect when passed to WinHttpGetProxyForUrlEx. /// WINHTTP_AUTOPROXY_RUN_INPROCESS = 0x00010000, /// /// By default, WinHTTP is configured to fall back to auto-discover a proxy in-process. If this fallback behavior is undesirable /// in the event that an out-of-process discovery fails, it can be disabled using this flag. This option has no effect when /// passed to WinHttpGetProxyForUrlEx. /// WINHTTP_AUTOPROXY_RUN_OUTPROCESS_ONLY = 0x00020000, /// Disables querying Direct Access proxy settings for this request. WINHTTP_AUTOPROXY_NO_DIRECTACCESS = 0x00040000, /// Disables querying a host to proxy cache of script execution results in the current process. WINHTTP_AUTOPROXY_NO_CACHE_CLIENT = 0x00080000, /// Disables querying a host to proxy cache of script execution results in the autoproxy service. WINHTTP_AUTOPROXY_NO_CACHE_SVC = 0x00100000, /// Orders the proxy results based on a heuristic placing the fastest proxies first. WINHTTP_AUTOPROXY_SORT_RESULTS = 0x00400000, } /// Specifies flags to indicate which events activate the callback function. [PInvokeData("winhttp.h", MSDNShortId = "NF:winhttp.WinHttpSetStatusCallback")] [Flags] public enum WINHTTP_CALLBACK_FLAG : uint { /// Activates upon beginning and completing name resolution. WINHTTP_CALLBACK_FLAG_RESOLVE_NAME = WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_RESOLVING_NAME | WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_NAME_RESOLVED, /// Activates upon beginning and completing connection to the server. WINHTTP_CALLBACK_FLAG_CONNECT_TO_SERVER = WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER | WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER, /// Activates upon beginning and completing the sending of a request header with WinHttpSendRequest. WINHTTP_CALLBACK_FLAG_SEND_REQUEST = WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_SENDING_REQUEST | WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_REQUEST_SENT, /// Activates upon beginning and completing the receipt of a resource from the HTTP server. WINHTTP_CALLBACK_FLAG_RECEIVE_RESPONSE = WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE | WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED, /// Activates when beginning and completing the closing of an HTTP connection. WINHTTP_CALLBACK_FLAG_CLOSE_CONNECTION = WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION | WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, /// Activates when an HINTERNET handle is created or closed. WINHTTP_CALLBACK_FLAG_HANDLES = WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_HANDLE_CREATED | WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, /// Activates when detecting the proxy server. WINHTTP_CALLBACK_FLAG_DETECTING_PROXY = WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_DETECTING_PROXY, /// Activates when the request is redirected. WINHTTP_CALLBACK_FLAG_REDIRECT = WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_REDIRECT, /// Activates when receiving an intermediate (100 level) status code message from the server. WINHTTP_CALLBACK_FLAG_INTERMEDIATE_RESPONSE = WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE, /// Activates upon a secure connection failure. WINHTTP_CALLBACK_FLAG_SECURE_FAILURE = WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_SECURE_FAILURE, /// Activates when a request header has been sent with WinHttpSendRequest. WINHTTP_CALLBACK_FLAG_SENDREQUEST_COMPLETE = WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE, /// Activates when the response headers are available for retrieval. WINHTTP_CALLBACK_FLAG_HEADERS_AVAILABLE = WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE, /// Activates when completing a query for data. WINHTTP_CALLBACK_FLAG_DATA_AVAILABLE = WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE, /// Activates upon completion of a data-read operation. WINHTTP_CALLBACK_FLAG_READ_COMPLETE = WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_READ_COMPLETE, /// Activates upon completion of a data-post operation. WINHTTP_CALLBACK_FLAG_WRITE_COMPLETE = WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE, /// Activates when an asynchronous error occurs. WINHTTP_CALLBACK_FLAG_REQUEST_ERROR = WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, /// WINHTTP_CALLBACK_FLAG_GETPROXYFORURL_COMPLETE = WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_GETPROXYFORURL_COMPLETE, /// /// Activates upon any completion notification. This flag specifies that all notifications required for read or write operations /// are used. See WINHTTP_STATUS_CALLBACK for a list of completions. /// WINHTTP_CALLBACK_FLAG_ALL_COMPLETIONS = WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE | WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE | WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE | WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_READ_COMPLETE | WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE | WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_REQUEST_ERROR | WINHTTP_CALLBACK_STATUS.WINHTTP_CALLBACK_STATUS_GETPROXYFORURL_COMPLETE, /// /// Activates upon any status change notification including completions. See WINHTTP_STATUS_CALLBACK for a list of notifications. /// WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS = 0xffffffff, } /// Specifies the status code that indicates why the callback function is called. [PInvokeData("winhttp.h", MSDNShortId = "NC:winhttp.WINHTTP_STATUS_CALLBACK")] [Flags] public enum WINHTTP_CALLBACK_STATUS : uint { /// The connection was successfully closed via a call to WinHttpWebSocketClose. WINHTTP_CALLBACK_STATUS_CLOSE_COMPLETE = 0x02000000, /// Closing the connection to the server. The lpvStatusInformation parameter is NULL. WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION = 0x00000100, /// /// Successfully connected to the server. The lpvStatusInformation parameter contains a pointer to an LPWSTR that /// indicates the IP address of the server in dotted notation. /// WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER = 0x00000008, /// /// Connecting to the server. The lpvStatusInformation parameter contains a pointer to an LPWSTR that indicates the /// IP address of the server in dotted notation. /// WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER = 0x00000004, /// Successfully closed the connection to the server. The lpvStatusInformation parameter is NULL. WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED = 0x00000200, /// /// Data is available to be retrieved with WinHttpReadData. The lpvStatusInformation parameter points to a DWORD /// that contains the number of bytes of data available. The dwStatusInformationLength parameter itself is 4 (the size of /// a DWORD). /// WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE = 0x00040000, /// Not implemented. WINHTTP_CALLBACK_STATUS_DETECTING_PROXY = 0x00001000, /// /// The operation initiated by a call to WinHttpGetProxyForUrlEx is complete. Data is available to be retrieved with WinHttpReadData. /// WINHTTP_CALLBACK_STATUS_GETPROXYFORURL_COMPLETE = 0x01000000, /// /// This handle value has been terminated. The lpvStatusInformation parameter contains a pointer to the HINTERNET handle. /// There will be no more callbacks for this handle. /// WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING = 0x00000800, /// /// An HINTERNET handle has been created. The lpvStatusInformation parameter contains a pointer to the HINTERNET handle. /// WINHTTP_CALLBACK_STATUS_HANDLE_CREATED = 0x00000400, /// /// The response header has been received and is available with WinHttpQueryHeaders. The lpvStatusInformation parameter is NULL. /// WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE = 0x00020000, /// /// Received an intermediate (100 level) status code message from the server. The lpvStatusInformation parameter contains /// a pointer to a DWORD that indicates the status code. /// WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE = 0x00008000, /// /// Successfully found the IP address of the server. The lpvStatusInformation parameter contains a pointer to a /// LPWSTR that indicates the name that was resolved. /// WINHTTP_CALLBACK_STATUS_NAME_RESOLVED = 0x00000002, /// /// /// Data was successfully read from the server. The lpvStatusInformation parameter contains a pointer to the buffer /// specified in the call to WinHttpReadData. The dwStatusInformationLength parameter contains the number of bytes read. /// /// /// When used by WinHttpWebSocketReceive, the lpvStatusInformation parameter contains a pointer to a /// WINHTTP_WEB_SOCKET_STATUS structure, and the dwStatusInformationLength parameter indicates the size of lpvStatusInformation. /// /// WINHTTP_CALLBACK_STATUS_READ_COMPLETE = 0x00080000, /// Waiting for the server to respond to a request. The lpvStatusInformation parameter is NULL. WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE = 0x00000040, /// /// An HTTP request is about to automatically redirect the request. The lpvStatusInformation parameter contains a pointer /// to an LPWSTR indicating the new URL. At this point, the application can read any data returned by the server with the /// redirect response and can query the response headers. It can also cancel the operation by closing the handle. /// WINHTTP_CALLBACK_STATUS_REDIRECT = 0x00004000, /// /// An error occurred while sending an HTTP request. The lpvStatusInformation parameter contains a pointer to a /// WINHTTP_ASYNC_RESULT structure. Its dwResult member indicates the ID of the called function and dwError /// indicates the return value. /// WINHTTP_CALLBACK_STATUS_REQUEST_ERROR = 0x00200000, /// /// Successfully sent the information request to the server. The lpvStatusInformation parameter contains a pointer to a /// DWORD indicating the number of bytes sent. /// WINHTTP_CALLBACK_STATUS_REQUEST_SENT = 0x00000020, /// /// Looking up the IP address of a server name. The lpvStatusInformation parameter contains a pointer to the server name /// being resolved. /// WINHTTP_CALLBACK_STATUS_RESOLVING_NAME = 0x00000001, /// /// Successfully received a response from the server. The lpvStatusInformation parameter contains a pointer to a /// DWORD indicating the number of bytes received. /// WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED = 0x00000080, /// /// One or more errors were encountered while retrieving a Secure Sockets Layer (SSL) certificate from the server. The /// lpvStatusInformation parameter contains a flag. For more information, see the description for lpvStatusInformation. /// WINHTTP_CALLBACK_STATUS_SECURE_FAILURE = 0x00010000, /// Sending the information request to the server. The lpvStatusInformation parameter is NULL. WINHTTP_CALLBACK_STATUS_SENDING_REQUEST = 0x00000010, /// The request completed successfully. The lpvStatusInformation parameter is NULL. WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE = 0x00400000, /// WINHTTP_CALLBACK_STATUS_SETTINGS_READ_COMPLETE = 0x20000000, /// WINHTTP_CALLBACK_STATUS_SETTINGS_WRITE_COMPLETE = 0x10000000, /// The connection was successfully shut down via a call to WinHttpWebSocketShutdown. WINHTTP_CALLBACK_STATUS_SHUTDOWN_COMPLETE = 0x04000000, /// /// /// Data was successfully written to the server. The lpvStatusInformation parameter contains a pointer to a DWORD /// that indicates the number of bytes written. /// /// /// When used by WinHttpWebSocketSend, the lpvStatusInformation parameter contains a pointer to a /// WINHTTP_WEB_SOCKET_STATUS structure, and the dwStatusInformationLength parameter indicates the size of lpvStatusInformation. /// /// WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE = 0x00100000, } /// /// If the dwInternetStatus argument is WINHTTP_CALLBACK_STATUS_SECURE_FAILURE, then lpvStatusInformation points to a /// DWORD which is a bitwise-OR combination of one or more of the following values. /// [PInvokeData("winhttp.h", MSDNShortId = "NC:winhttp.WINHTTP_STATUS_CALLBACK")] [Flags] public enum WINHTTP_CALLBACK_STATUS_FLAG : uint { /// /// Certification revocation checking has been enabled, but the revocation check failed to verify whether a certificate has been /// revoked. The server used to check for revocation might be unreachable. /// WINHTTP_CALLBACK_STATUS_FLAG_CERT_REV_FAILED = 0x00000001, /// SSL certificate is invalid. WINHTTP_CALLBACK_STATUS_FLAG_INVALID_CERT = 0x00000002, /// SSL certificate was revoked. WINHTTP_CALLBACK_STATUS_FLAG_CERT_REVOKED = 0x00000004, /// The function is unfamiliar with the Certificate Authority that generated the server's certificate. WINHTTP_CALLBACK_STATUS_FLAG_INVALID_CA = 0x00000008, /// /// SSL certificate common name (host name field) is incorrect, for example, if you entered www.microsoft.com and the common name /// on the certificate says www.msn.com. /// WINHTTP_CALLBACK_STATUS_FLAG_CERT_CN_INVALID = 0x00000010, /// SSL certificate date that was received from the server is bad. The certificate is expired. WINHTTP_CALLBACK_STATUS_FLAG_CERT_DATE_INVALID = 0x00000020, /// WINHTTP_CALLBACK_STATUS_FLAG_CERT_WRONG_USAGE = 0x00000040, /// The application experienced an internal error loading the SSL libraries. WINHTTP_CALLBACK_STATUS_FLAG_SECURITY_CHANNEL_ERROR = 0x80000000, } /// Flags which determine whether WinHTTP will automatically decompress response bodies with compressed Content-Encodings. [PInvokeData("winhttp.h")] [Flags] public enum WINHTTP_DECOMPRESSION_FLAG : uint { /// Decompress Content-Encoding: gzip responses. WINHTTP_DECOMPRESSION_FLAG_GZIP = 0x00000001, /// Decompress Content-Encoding: deflate responses. WINHTTP_DECOMPRESSION_FLAG_DEFLATE = 0x00000002, /// Decompress responses with any supported Content-Encoding. WINHTTP_DECOMPRESSION_FLAG_ALL = WINHTTP_DECOMPRESSION_FLAG_GZIP | WINHTTP_DECOMPRESSION_FLAG_DEFLATE } /// Specifies which features are disabled. [PInvokeData("winhttp.h")] [Flags] public enum WINHTTP_DISABLE : uint { /// /// Automatic addition of cookie headers to requests is disabled. Also, returned cookies are not automatically added to the /// cookie database. Disabling cookies can result in poor performance for Passport authentication. /// WINHTTP_DISABLE_COOKIES = 0x00000001, /// /// Automatic redirection is disabled when sending requests with WinHttpSendRequest. If automatic redirection is disabled, an /// application must register a callback function in order for Passport authentication to succeed. /// WINHTTP_DISABLE_REDIRECTS = 0x00000002, /// Automatic authentication is disabled. WINHTTP_DISABLE_AUTHENTICATION = 0x00000004, /// /// Disables keep-alive semantics for the connection. Keep-alive semantics are required for MSN, NTLM, and other types of authentication. /// WINHTTP_DISABLE_KEEP_ALIVE = 0x00000008, } /// Specifies whether Passport Authentication in WinHTTP authentication is enabled. [PInvokeData("winhttp.h")] [Flags] public enum WINHTTP_DISABLE_PASSPORT : uint { /// Microsoft Passport authentication is disabled. This is the default. WINHTTP_DISABLE_PASSPORT_AUTH = 0x00000000, /// Passport authentication is enabled. WINHTTP_ENABLE_PASSPORT_AUTH = 0x10000000, /// The Passport keyring is disabled. This is the default. WINHTTP_DISABLE_PASSPORT_KEYRING = 0x20000000, /// The Passport keyring is enabled. WINHTTP_ENABLE_PASSPORT_KEYRING = 0x40000000, } /// Specifies the features currently enabled. [PInvokeData("winhttp.h")] [Flags] public enum WINHTTP_ENABLE_SSL : uint { /// If enabled, WinHTTP allows SSL revocation. This value can be set only on the request handle. WINHTTP_ENABLE_SSL_REVOCATION = 0x00000001, /// /// If enabled, WinHTTP temporarily reverts client impersonation for the duration of SSL certificate authentication operations. /// This value can be set only on the session handle. /// WINHTTP_ENABLE_SSL_REVERT_IMPERSONATION = 0x00000002, } /// Flags for WinHttpAddRequestHeadersEx. [PInvokeData("winhttp.h", MSDNShortId = "NF:winhttp.WinHttpAddRequestHeadersEx")] [Flags] public enum WINHTTP_EXTENDED_HEADER_FLAG : ulong { /// Indicate that the strings passed in are Unicode strings. WINHTTP_EXTENDED_HEADER_FLAG_UNICODE = 1 } /// Specifies which secure protocols are acceptable. [PInvokeData("winhttp.h")] [Flags] public enum WINHTTP_FLAG_SECURE_PROTOCOL : uint { /// The SSL 2.0 protocol can be used. WINHTTP_FLAG_SECURE_PROTOCOL_SSL2 = 0x00000008, /// The SSL 3.0 protocol can be used. WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 = 0x00000020, /// The TLS 1.0 protocol can be used. WINHTTP_FLAG_SECURE_PROTOCOL_TLS1 = 0x00000080, /// The TLS 1.1 protocol can be used. WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1 = 0x00000200, /// The TLS 1.2 protocol can be used. WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2 = 0x00000800, /// The TLS 1.3 protocol can be used. WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_3 = 0x00002000, /// The Secure Sockets Layer (SSL) 2.0, SSL 3.0, and Transport Layer Security (TLS) 1.0 protocols can be used. WINHTTP_FLAG_SECURE_PROTOCOL_ALL = WINHTTP_FLAG_SECURE_PROTOCOL_SSL2 | WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 | WINHTTP_FLAG_SECURE_PROTOCOL_TLS1, } /// The type of the HINTERNET handle passed in. [PInvokeData("winhttp.h")] public enum WINHTTP_HANDLE_TYPE : uint { /// The handle is a session handle. WINHTTP_HANDLE_TYPE_SESSION = 1, /// The handle is a connection handle. WINHTTP_HANDLE_TYPE_CONNECT = 2, /// The handle is a request handle. WINHTTP_HANDLE_TYPE_REQUEST = 3, } /// Flags for WINHTTP_MATCH_CONNECTION_GUID. [PInvokeData("winhttp.h", MSDNShortId = "NS:winhttp._WINHTTP_MATCH_CONNECTION_GUID")] [Flags] public enum WINHTTP_MATCH_CONNECTION_GUID_FLAG : ulong { /// /// If you don't want an unmarked connection to be matched. When using that flag, if no matching marked connection is found, then /// a new connection is created, and the request is sent on that connection. /// WINHTTP_MATCH_CONNECTION_GUID_FLAG_REQUIRE_MARKED_CONNECTION = 0x00000001 } /// The flags that indicate various options affecting the behavior of WinHttpOpen. [PInvokeData("winhttp.h", MSDNShortId = "NF:winhttp.WinHttpOpen")] [Flags] public enum WINHTTP_OPEN_FLAG : uint { /// /// Use the WinHTTP functions asynchronously. By default, all WinHTTP functions that use the returned HINTERNET handle are /// performed synchronously. When this flag is set, the caller needs to specify a callback function through WinHttpSetStatusCallback. /// WINHTTP_FLAG_ASYNC = 0x10000000, /// /// When this flag is set, WinHttp will require use of TLS 1.2 or newer. If the caller attempts to enable older TLS versions by /// setting WINHTTP_OPTION_SECURE_PROTOCOLS, it will fail with ERROR_ACCESS_DENIED. Additionally, TLS fallback will /// be disabled. Note that setting this flag also sets flag WINHTTP_FLAG_ASYNC. /// WINHTTP_FLAG_SECURE_DEFAULTS = 0x30000000, } /// [PInvokeData("winhttp.h", MSDNShortId = "NF:winhttp.WinHttpOpenRequest")] [Flags] public enum WINHTTP_OPENREQ_FLAG : uint { /// /// Uses secure transaction semantics. This translates to using Secure Sockets Layer (SSL)/Transport Layer Security (TLS). /// WINHTTP_FLAG_SECURE = 0x00800000, /// /// The string passed in for pwszObjectName is converted from an LPCWSTR to an LPSTR. All unsafe characters /// are converted to an escape sequence including the percent symbol. By default, all unsafe characters except the percent symbol /// are converted to an escape sequence. /// WINHTTP_FLAG_ESCAPE_PERCENT = 0x00000004, /// /// The string passed in for pwszObjectName is assumed to consist of valid ANSI characters represented by WCHAR. No /// check are done for unsafe characters. Windows 7: This option is obsolete. /// WINHTTP_FLAG_NULL_CODEPAGE = 0x00000008, /// This flag provides the same behavior as WINHTTP_FLAG_REFRESH. WINHTTP_FLAG_BYPASS_PROXY_CACHE = 0x00000100, /// /// Indicates that the request should be forwarded to the originating server rather than sending a cached version of a resource /// from a proxy server. When this flag is used, a "Pragma: no-cache" header is added to the request handle. When creating an /// HTTP/1.1 request header, a "Cache-Control: no-cache" is also added. /// WINHTTP_FLAG_REFRESH = WINHTTP_FLAG_BYPASS_PROXY_CACHE, /// Unsafe characters in the URL passed in for pwszObjectName are not converted to escape sequences. WINHTTP_FLAG_ESCAPE_DISABLE = 0x00000040, /// /// Unsafe characters in the query component of the URL passed in for pwszObjectName are not converted to escape sequences. /// WINHTTP_FLAG_ESCAPE_DISABLE_QUERY = 0x00000080, } /// /// The following option flags are supported by WinHttpQueryOption and WinHttpSetOption. /// WINHTTP_OPTION_ASSURED_NON_BLOCKING_CALLBACKS /// /// The default is FALSE. If set to TRUE, WinHTTP does not guarantee progress if status callbacks are blocked by the client application. /// /// /// The client application must take special care to perform minimal operations within the callback without blocking, returning as /// quickly as possible, and in particular must not wait for any subsequent WinHTTP calls. If it does not follow these guidelines, /// there is likely to be a negative performance impact or a potential application hang. If used in the prescribed manner, this /// option may improve performance. /// /// [PInvokeData("winhttp.h")] public enum WINHTTP_OPTION { /// Undocumented. WINHTTP_OPTION_AGGREGATE_PROXY_CONFIG = 181, /// Undocumented. [CorrespondingType(typeof(BOOL), CorrespondingAction.Set)] WINHTTP_OPTION_ASSURED_NON_BLOCKING_CALLBACKS = 111, /// /// Sets an unsigned long integer value that specifies the Automatic Logon Policy with one of the /// WINHTTP_AUTOLOGON_SECURITY_LEVEL values. /// [CorrespondingType(typeof(WINHTTP_AUTOLOGON_SECURITY_LEVEL), CorrespondingAction.Set)] WINHTTP_OPTION_AUTOLOGON_POLICY = 77, /// /// When you set this option on a session handle, you must pass the number of connections you wish to open. Then, upon first /// sending a request, rather than opening only a single connection, WinHttp opens a number of connections in parallel. This can /// improve the performance of subsequent requests to the same destination, which won't have the overhead of connection establishment. /// [CorrespondingType(typeof(uint), CorrespondingAction.Set)] WINHTTP_OPTION_BACKGROUND_CONNECTIONS = 172, /// Retrieves the pointer to the callback function set with WinHttpSetStatusCallback. [CorrespondingType(typeof(WINHTTP_STATUS_CALLBACK))] WINHTTP_OPTION_CALLBACK = 1, /// /// /// Sets the client certificate context. If an application receives ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED, it must call /// WinHttpSetOption to supply a certificate before retrying the request. As a part of processing this option, WinHttp calls /// CertDuplicateCertificateContext on the caller-provided certificate context so that the certificate context can be /// independently released by the caller. /// /// /// The application should not attempt to close the certificate store with the CERT_CLOSE_STORE_FORCE_FLAG flag /// in the call to CertCloseStore on the certificate store from which the certificate context was retrieved. An access violation /// may occur. /// /// /// When the server requests a client certificate, WinHttpSendRequest, or WinHttpReceiveResponse returns an /// ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED error. If the server requests the certificate but does not require it, the application /// can specify this option to indicate that it does not have a certificate. The server can choose another authentication scheme /// or allow anonymous access to the server. The application provides the WINHTTP_NO_CLIENT_CERT_CONTEXT macro in the lpBuffer /// parameter of WinHttpSetOption as shown in the following code example. /// /// /// BOOL fRet = WinHttpSetOption(hRequest, WINHTTP_OPTION_CLIENT_CERT_CONTEXT, WINHTTP_NO_CLIENT_CERT_CONTEXT, 0); /// /// /// If the server requires a client certificate, it may send a 403 HTTP status code in response. For more information, see the /// WINHTTP_OPTION_CLIENT_CERT_ISSUER_LIST option. /// /// [CorrespondingType(typeof(Crypt32.CERT_CONTEXT), CorrespondingAction.Set)] WINHTTP_OPTION_CLIENT_CERT_CONTEXT = 47, /// /// Retrieves a SecPkgContext_IssuerListInfoEx structure when the error from WinHttpSendRequest or WinHttpReceiveResponse is /// ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED. The issuer list in the structure contains a list of acceptable Certificate Authorities /// (CA) from the server. The client application can filter the CA list to retrieve the client certificate for SSL authentication. /// /// Alternately, if the server requests the client certificate, but does not require it, the application can call /// WinHttpSetOption with the WINHTTP_OPTION_CLIENT_CERT_CONTEXT option. For more information, see the /// WINHTTP_OPTION_CLIENT_CERT_CONTEXT option. /// /// [CorrespondingType(typeof(SecPkgContext_IssuerListInfoEx), CorrespondingAction.Get)] WINHTTP_OPTION_CLIENT_CERT_ISSUER_LIST = 94, /// Sets the code page that is used to process the URL (that is, query string). The default is UTF8. [CorrespondingType(typeof(uint), CorrespondingAction.Set)] WINHTTP_OPTION_CODEPAGE = 68, /// /// Sets a WINHTTP_DISABLE_PASSPORT value that specifies whether Passport Authentication in WinHTTP authentication is enabled. /// [CorrespondingType(typeof(WINHTTP_DISABLE_PASSPORT), CorrespondingAction.Set)] WINHTTP_OPTION_CONFIGURE_PASSPORT_AUTH = 83, /// /// Sets or retrieves an unsigned long integer value that contains the number of timesWinHTTP attempts to connect to a host. /// Microsoft Windows HTTP Services (WinHTTP) only attempts once per Internet Protocol (IP) address. For example, if you attempt /// to connect to a multihomed host that has 10 IP addresses and WINHTTP_OPTION_CONNECT_RETRIES is set to 7, then WinHTTP only /// attempts to connect to the first seven IP address. Given the same set of 10 IP addresses, if WINHTTP_OPTION_CONNECT_RETRIES /// is set to 20, WinHTTP attempts each of the 10 only once. If a connection attempt still fails after the specified number of /// attempts, or if the connect timeout expired before then, the request is canceled. The default value for /// WINHTTP_OPTION_CONNECT_RETRIES is five attempts. /// [CorrespondingType(typeof(uint))] WINHTTP_OPTION_CONNECT_RETRIES = 4, /// /// Sets or retrieves an unsigned long integer value that contains the time-out value, in milliseconds. Setting this option to /// infinite (0xFFFFFFFF) will disable this timer. /// /// If a TCP connection request takes longer than this time-out value, the request is canceled. The default timeout is 60 /// seconds. When you are attempting to connect to multiple IP addresses for a single host (a multihomed host), the timeout limit /// is for each individual connection. /// /// [CorrespondingType(typeof(uint))] WINHTTP_OPTION_CONNECT_TIMEOUT = 3, /// Undocumented. [CorrespondingType(typeof(uint), CorrespondingAction.Set)] WINHTTP_OPTION_CONNECTION_FILTER = 131, /// Undocumented. [CorrespondingType(typeof(Guid))] WINHTTP_OPTION_CONNECTION_GUID = 178, /// /// Retrieves the source and destination IP address, and port of the request that generated the response when /// WinHttpReceiveResponse returns. The application calls WinHttpQueryOption with the WINHTTP_OPTION_CONNECTION_INFO option, and /// provides the WINHTTP_CONNECTION_INFO structure in the lpBuffer parameter. For more information, see WINHTTP_CONNECTION_INFO. /// Windows Server 2003 with SP1 and Windows XP with SP2: This flag is obsolete. /// [CorrespondingType(typeof(WINHTTP_CONNECTION_INFO))] WINHTTP_OPTION_CONNECTION_INFO = 93, /// /// Retreives the TCP_INFO_v0 struct for the underlying connection used by the request. The returned struct may contain /// statistics from prior requests sent over the same connection. This option has been superseded by WINHTTP_OPTION_CONNECTION_STATS_V1. /// [CorrespondingType(typeof(TCP_INFO_v0))] WINHTTP_OPTION_CONNECTION_STATS_V0 = 141, /// /// Retreives the TCP_INFO_v1 struct for the underlying connection used by the request. The returned struct may contain /// statistics from prior requests sent over the same connection. /// [CorrespondingType(typeof(TCP_INFO_v1))] WINHTTP_OPTION_CONNECTION_STATS_V1 = 150, /// /// Sets or retrieves a DWORD_PTR that contains a pointer to the context value associated with this HINTERNET handle. The value /// stored in the buffer is used and the WINHTTP_OPTION_CONTEXT_VALUE option flag is assigned a new value. /// [CorrespondingType(typeof(IntPtr))] WINHTTP_OPTION_CONTEXT_VALUE = 45, /// /// Sets a WINHTTP_DECOMPRESSION_FLAG flag value which determine whether WinHTTP will automatically decompress response bodies /// with compressed Content-Encodings. WinHTTP will also set an appropriate Accept-Encoding header, overriding any supplied by /// the caller. /// By default, WinHTTP will deliver compressed responses to the caller unmodified. /// [CorrespondingType(typeof(WINHTTP_DECOMPRESSION_FLAG), CorrespondingAction.Set)] WINHTTP_OPTION_DECOMPRESSION = 118, /// /// Setting this option on a WinHttp session handle allows you to enable/disable whether the server certificate chain is built. /// [CorrespondingType(typeof(BOOL), CorrespondingAction.Set)] WINHTTP_OPTION_DISABLE_CERT_CHAIN_BUILDING = 171, /// /// Sets a WINHTTP_DISABLE value that specifies which features are disabled with one or more of the following flags. Be aware /// that this feature should only be passed to WinHttpSetOption on request handles after the request handle is created with /// WinHttpOpenRequest, and before the request is sent with WinHttpSendRequest. /// [CorrespondingType(typeof(WINHTTP_DISABLE), CorrespondingAction.Set)] WINHTTP_OPTION_DISABLE_FEATURE = 63, /// Undocumented. [CorrespondingType(typeof(BOOL), CorrespondingAction.Set)] WINHTTP_OPTION_DISABLE_PROXY_LINK_LOCAL_NAME_RESOLUTION = 176, /// /// Prevents WinHTTP from retrying a connection with a lower version of the security protocol when the initial protocol /// negotiation fails. /// [CorrespondingType(typeof(BOOL), CorrespondingAction.Set)] WINHTTP_OPTION_DISABLE_SECURE_PROTOCOL_FALLBACK = 144, /// /// Allows new requests to open an additional HTTP/2 connection when the maximum concurrent stream limit is reached, rather than /// waiting for the next available stream on an existing connection. /// [CorrespondingType(typeof(BOOL), CorrespondingAction.Set)] WINHTTP_OPTION_DISABLE_STREAM_QUEUE = 139, /// Sets a WINHTTP_ENABLE_SSL value that specifies the features currently enabled. [CorrespondingType(typeof(WINHTTP_ENABLE_SSL), CorrespondingAction.Set)] WINHTTP_OPTION_ENABLE_FEATURE = 79, /// /// Sets a DWORD bitmask of acceptable advanced HTTP versions. /// Legacy versions of HTTP (1.1 and prior) cannot be disabled using this option. The default is 0x0. /// [CorrespondingType(typeof(WINHTTP_PROTOCOL_FLAG), CorrespondingAction.Set)] WINHTTP_OPTION_ENABLE_HTTP_PROTOCOL = 133, /// /// This option can be set on a WinHttp session handle to allow WinHttp to use the caller-provided client certificate context /// when HTTP/2 is being used. /// [CorrespondingType(typeof(BOOL), CorrespondingAction.Set)] WINHTTP_OPTION_ENABLE_HTTP2_PLUS_CLIENT_CERT = 161, /// Undocumented. [CorrespondingType(typeof(BOOL), CorrespondingAction.Set)] WINHTTP_OPTION_ENABLE_TEST_SIGNING = 174, /// /// Sets a BOOL value that specifies whether tracing is currently enabled. For more information about the trace facility in /// WinHTTP, see WinHTTP Trace Facility. This option can only be set on a NULL HINTERNET handle. /// [CorrespondingType(typeof(BOOL), CorrespondingAction.Set)] WINHTTP_OPTION_ENABLETRACING = 85, /// /// Enables URL percent encoding for path and query string. Alternatively, you can percent encode before calling WinHttp. /// [CorrespondingType(typeof(BOOL), CorrespondingAction.Set)] WINHTTP_OPTION_ENCODE_EXTRA = 138, /// /// This option can only be set on a request handle which is still active (sending or receiving). Setting this option will tell /// WinHttp to stop serving requests on the connection associated with the request handle passed in. The connection will be /// closed after the request handle this option is called with is completed. This option does not take any parameters. /// [CorrespondingType(null, CorrespondingAction.Set)] WINHTTP_OPTION_EXPIRE_CONNECTION = 143, /// /// Retrieves an unsigned long integer value that contains a Microsoft Windows Sockets error code that was mapped to the /// ERROR_WINHTTP_* error messages last returned in this thread context. You can pass NULL as the handle value. /// [CorrespondingType(typeof(Win32Error), CorrespondingAction.Get)] WINHTTP_OPTION_EXTENDED_ERROR = 24, /// Undocumented. [CorrespondingType(typeof(uint), CorrespondingAction.Set)] WINHTTP_OPTION_FAILED_CONNECTION_RETRIES = 162, /// /// By default, when WinHttp sends a request, if there are no available connections to serve the request, WinHttp will attempt to /// establish a new connection, and the request will be bound to this new connection. When you set this option, such a request /// will instead be served on the first connection that becomes available, and not necessarily the one being established. /// [CorrespondingType(typeof(BOOL), CorrespondingAction.Set)] WINHTTP_OPTION_FIRST_AVAILABLE_CONNECTION = 173, /// /// Takes a pointer to a WINHTTP_CREDS_EX structure with the hInternet function parameter set to NULL. This option requires /// registry key HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings!ShareCredsWithWinHttp. If this registry key is /// not set WinHTTP will return error ERROR_WINHTTP_INVALID_OPTION. This registry key is not present by default. When it is set, /// WinINet will send credentials down to WinHTTP. Whenever WinHttp gets an authentication challenge and if there are no /// credentials set on the current handle, it will use the credentials provided by WinINet. In order to share server credentials /// in addition to proxy credentials, users needs to set WINHTTP_OPTION_USE_GLOBAL_SERVER_CREDENTIALS. /// [CorrespondingType(typeof(WINHTTP_CREDS_EX), CorrespondingAction.Set)] WINHTTP_OPTION_GLOBAL_PROXY_CREDS = 97, /// /// Takes a pointer to a WINHTTP_CREDS_EX structure with the hInternet function parameter set to NULL. This option requires /// registry key HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings!ShareCredsWithWinHttp. If this registry key is /// not set WinHTTP will return error ERROR_WINHTTP_INVALID_OPTION. This registry key is not present by default. When it is set, /// WinINet will send credentials down to WinHTTP. Whenever WinHttp gets an authentication challenge and if there are no /// credentials set on the current handle, it will use the credentials provided by WinINet. In order to share server credentials /// in addition to proxy credentials, users needs to set WINHTTP_OPTION_USE_GLOBAL_SERVER_CREDENTIALS. /// [CorrespondingType(typeof(WINHTTP_CREDS_EX), CorrespondingAction.Set)] WINHTTP_OPTION_GLOBAL_SERVER_CREDS = 98, /// Retrieves an unsigned long integer value that contains the type of the HINTERNET handle passed in. [CorrespondingType(typeof(WINHTTP_HANDLE_TYPE), CorrespondingAction.Get)] WINHTTP_OPTION_HANDLE_TYPE = 9, /// Undocumented. [CorrespondingType(typeof(uint), CorrespondingAction.Set)] WINHTTP_OPTION_HEAP_EXTENSION = 157, /// /// Prevents protocol versions other than those enabled by WINHTTP_OPTION_ENABLE_HTTP_PROTOCOL from being used for the request. /// [CorrespondingType(typeof(BOOL), CorrespondingAction.Set)] WINHTTP_OPTION_HTTP_PROTOCOL_REQUIRED = 145, /// /// Gets a DWORD indicating which advanced HTTP version was used on a given request. For a list of possible values, see WINHTTP_OPTION_ENABLE_HTTP_PROTOCOL. /// [CorrespondingType(typeof(WINHTTP_PROTOCOL_FLAG), CorrespondingAction.Get)] WINHTTP_OPTION_HTTP_PROTOCOL_USED = 134, /// /// Sets or retrieves an HTTP_VERSION_INFO structure that contains the HTTP version being supported. This is a process-wide /// option; use NULL for the handle. /// [CorrespondingType(typeof(HTTP_VERSION_INFO))] WINHTTP_OPTION_HTTP_VERSION = 59, /// /// This option can be set on a session handle to have WinHttp use HTTP/2 PING frames as a keepalive mechanism. Callers specify a /// timeout in milliseconds, and after there is no activity on a connection for that timeout period, WinHttp will begin to send /// HTTP/2 PING frames. Callers cannot set a timeout value less than 5000 milliseconds. /// [CorrespondingType(typeof(uint), CorrespondingAction.Set)] WINHTTP_OPTION_HTTP2_KEEPALIVE = 164, /// /// This option can be set on a WinHttp request handle to control how WinHttp behaves when an HTTP/2 response contains a /// "Transfer-Encoding" header. In such a case, WinHttp will return an error if this option is set to FALSE. /// [CorrespondingType(typeof(BOOL), CorrespondingAction.Set)] WINHTTP_OPTION_HTTP2_PLUS_TRANSFER_ENCODING = 169, /// Undocumented. [CorrespondingType(typeof(uint), CorrespondingAction.Set)] WINHTTP_OPTION_HTTP2_RECEIVE_WINDOW = 183, /// /// Allows secure connections to use security certificates for which the certificate revocation list could not be downloaded. /// [CorrespondingType(typeof(BOOL), CorrespondingAction.Set)] WINHTTP_OPTION_IGNORE_CERT_REVOCATION_OFFLINE = 155, /// /// Enables IPv6 fast fallback (Happier Eyeballs) for the connection. This behavior is similar to the Happy Eyeballs behavior /// described in RFC 6555 for improving connection times on networks where IPv6 is unreliable. /// /// /// If both IPv6 and IPv4 addresses are resolved for a given host, WinHttp will begin by connecting to the first resolved IPv6 /// address with a short (300ms) timeout. /// /// Should that connection fail, WinHttp will attempt to connect to the first resolved IPv4 address with the standard timeout. /// Should the second connection fail, WinHttp will retry the first resolved IPv6 address with the standard timeout. /// /// Should the third connection fail, WinHttp will revert to the default behavior for any remaining addresses, attempting a /// connection to each one with the standard timeout until a connection is made or no addresses remain. /// /// /// [CorrespondingType(typeof(BOOL), CorrespondingAction.Set)] WINHTTP_OPTION_IPV6_FAST_FALLBACK = 140, /// Gets whether or not a Proxy Return Connect Response can be retrieved. [CorrespondingType(typeof(BOOL), CorrespondingAction.Get)] WINHTTP_OPTION_IS_PROXY_CONNECT_RESPONSE = 104, /// Undocumented. [CorrespondingType(typeof(uint), CorrespondingAction.Set)] WINHTTP_OPTION_KDC_PROXY_SETTINGS = 136, /// Undocumented. [CorrespondingType(typeof(Guid), CorrespondingAction.Set)] WINHTTP_OPTION_MATCH_CONNECTION_GUID = 179, /// /// Sets or retrieves an unsigned long integer value that contains the maximum number of connections allowed per HTTP/1.0 server. /// The default value is INFINITE. /// Windows Vista with SP1 and Windows Server 2008: This flag is obsolete. /// [CorrespondingType(typeof(uint))] WINHTTP_OPTION_MAX_CONNS_PER_1_0_SERVER = 74, /// /// Sets or retrieves an unsigned long integer value that contains the maximum number of connections allowed per server. The /// default value is INFINITE. /// When this option is set to zero, WinHTTP sets the limit on the number of connections to 2. /// [CorrespondingType(typeof(uint))] WINHTTP_OPTION_MAX_CONNS_PER_SERVER = 73, /// /// Sets the maximum number of redirects that WinHTTP follows; the default is 10. This limit prevents unauthorized sites from /// making the WinHTTP client pause following a large number of redirects. /// Windows XP with SP1 and Windows 2000 with SP3: This flag is obsolete. /// [CorrespondingType(typeof(uint))] WINHTTP_OPTION_MAX_HTTP_AUTOMATIC_REDIRECTS = 89, /// /// The maximum number of Informational 100-199 status code responses ignored before returning the final status code to the /// WinHTTP client. Informational 100-199 status codes can be sent by the server before the final status code, and are described /// in the specification for HTTP/1.1 (for more information, see RFC 2616). The default is 10. /// Windows XP with SP1 and Windows 2000 with SP3: This flag is obsolete. /// [CorrespondingType(typeof(uint))] WINHTTP_OPTION_MAX_HTTP_STATUS_CONTINUE = 90, /// /// A bound on the amount of data drained from responses in order to reuse a connection, specified in bytes. The default is 1MB. /// Windows XP with SP1 and Windows 2000 with SP3: This flag is obsolete. /// [CorrespondingType(typeof(uint))] WINHTTP_OPTION_MAX_RESPONSE_DRAIN_SIZE = 92, /// /// A bound set on the maximum size of the header portion of the server response, specified in bytes. This bound protects the /// client from an unauthorized server attempting to stall the client by sending a response with an infinite amount of header /// data. The default value is 64KB. /// Windows XP with SP1 and Windows 2000 with SP3: This flag is obsolete. /// [CorrespondingType(typeof(uint))] WINHTTP_OPTION_MAX_RESPONSE_HEADER_SIZE = 91, /// Undocumented. [CorrespondingType(typeof(uint), CorrespondingAction.Set)] WINHTTP_OPTION_NTSERVICE_FLAG_TEST = 175, /// Retrieves the parent handle to this handle. [CorrespondingType(typeof(HINTERNET), CorrespondingAction.Get)] WINHTTP_OPTION_PARENT_HANDLE = 21, /// /// Retrieves a string that contains the cobranding text provided by the Passport logon server. This option should be retrieved /// immediately after the logon server responds with a 401 status code. An application should pass in a buffer size, in bytes, /// that is big enough to hold the returned string. /// [CorrespondingType(typeof(string), CorrespondingAction.Get)] WINHTTP_OPTION_PASSPORT_COBRANDING_TEXT = 81, /// /// Retrieves a string that contains a URL for a cobranding graphic provided by the Passport logon server. This option should be /// retrieved immediately after the logon server responds with a 401 status code. An application should pass in a buffer size, in /// bytes, that is big enough to hold the returned string. /// [CorrespondingType(typeof(string), CorrespondingAction.Get)] WINHTTP_OPTION_PASSPORT_COBRANDING_URL = 82, /// Sets a read-only option on a request handle that retrieves the Passport return URL. [CorrespondingType(typeof(IntPtr), CorrespondingAction.Set)] WINHTTP_OPTION_PASSPORT_RETURN_URL = 87, /// /// Sets the option on a session handle to sign out of any Passport logins. An application should pass in the Passport return URL /// that was retrieved with WINHTTP_OPTION_PASSPORT_RETURN_URL. All cookies related to the return URL are cleared. /// [CorrespondingType(typeof(IntPtr), CorrespondingAction.Set)] WINHTTP_OPTION_PASSPORT_SIGN_OUT = 86, /// Sets or retrieves a string value that contains the password associated with a request handle. [CorrespondingType(typeof(string))] WINHTTP_OPTION_PASSWORD = 0x1001, /// /// Sets or retrieves an WINHTTP_PROXY_INFO structure that contains the proxy data on an existing session handle or request /// handle. When retrieving proxy data, an application must free the lpszProxy and lpszProxyBypass strings contained in this /// structure (if they are non-NULL) using the GlobalFree function. An application can query for the global proxy data (the /// default proxy) by passing a NULL handle. /// [CorrespondingType(typeof(WINHTTP_PROXY_INFO), CorrespondingAction.Get)] [CorrespondingType(typeof(WINHTTP_PROXY_INFO_IN), CorrespondingAction.Set)] WINHTTP_OPTION_PROXY = 38, /// Undocumented. [CorrespondingType(typeof(WINHTTP_PROXY_SETTINGS))] WINHTTP_OPTION_PROXY_CONFIG_INFO = 180, /// Undocumented. [CorrespondingType(typeof(uint), CorrespondingAction.Set)] WINHTTP_OPTION_PROXY_DISABLE_SERVICE_CALLS = 137, /// Sets or retrieves a string value that contains the password used to access the proxy. [CorrespondingType(typeof(string))] WINHTTP_OPTION_PROXY_PASSWORD = 0x1003, /// Undocumented. [CorrespondingType(typeof(WINHTTP_PROXY_RESULT_ENTRY), CorrespondingAction.Set)] WINHTTP_OPTION_PROXY_RESULT_ENTRY = 39, /// /// Gets the proxy Server Principal Name that WinHTTP supplied to SSPI during authentication. This string value is usefor passing /// to SspiPromptForCredentials after an authentication failure. /// [CorrespondingType(typeof(string), CorrespondingAction.Get)] WINHTTP_OPTION_PROXY_SPN_USED = 107, /// Sets or retrieves a string value that contains the user name used to access the proxy. [CorrespondingType(typeof(string))] WINHTTP_OPTION_PROXY_USERNAME = 0x1002, /// This option has been deprecated; it has no effect. [CorrespondingType(typeof(uint))] WINHTTP_OPTION_READ_BUFFER_SIZE = 12, /// Sets whether or not the proxy response entity can be retrieved. This option is disabled by default. [CorrespondingType(typeof(BOOL), CorrespondingAction.Set)] WINHTTP_OPTION_RECEIVE_PROXY_CONNECT_RESPONSE = 103, /// /// Sets or retrieves an unsigned long integer value that contains the timeout value, in milliseconds, to wait to receive all /// response headers to a request. If WinHTTP fails to receive all the headers within this timeout period, the request is /// canceled. The default timeout value is 90 seconds. /// /// This timeout is checked only when data is received from the socket. As a result, when the timeout expires the client /// application is not notified until more data arrives from the server. If no data arrives from the server, the delay between /// the timeout expiration and notification of the client application could be as large as the timeout value set using the /// dwReceiveTimeout parameter of the WinHttpSetTimeouts function. /// /// [CorrespondingType(typeof(uint))] WINHTTP_OPTION_RECEIVE_RESPONSE_TIMEOUT = 7, /// /// Sets or retrieves an unsigned long integer value that contains the time-out value, in milliseconds, to receive a partial /// response to a request or read some data. If the response takes longer than this time-out value, the request is canceled. The /// default timeout value is 30 seconds. /// [CorrespondingType(typeof(uint))] WINHTTP_OPTION_RECEIVE_TIMEOUT = 6, /// /// Sets the behavior of WinHTTP regarding the handling of a 30x HTTP redirect status code. This option can be set on a session /// or request handle. /// [CorrespondingType(typeof(WINHTTP_OPTION_REDIRECT_POLICY), CorrespondingAction.Set)] WINHTTP_OPTION_REDIRECT_POLICY = 88, /// Undocumented. [CorrespondingType(typeof(BOOL), CorrespondingAction.Set)] WINHTTP_OPTION_REFERER_TOKEN_BINDING_HOSTNAME = 168, /// /// Rejects URLs that contain a username and password. This option also rejects URLs that contain username:password semantics, /// even if no username or password is specified. For example, "u:p@hostname", ":@hostname", "u:@hostname", and ":p@hostname" /// would all be flagged as invalid. If an invalid URL is passed to the function, it returns ERROR_WINHTTP_INVALID_URL. This /// option is turned off by default. /// [CorrespondingType(typeof(BOOL), CorrespondingAction.GetSet)] WINHTTP_OPTION_REJECT_USERPWD_IN_URL = 100, /// This option has been deprecated; it has no effect. [CorrespondingType(typeof(uint), CorrespondingAction.GetSet)] WINHTTP_OPTION_REQUEST_PRIORITY = 58, /// Retreives statistics for the request. For a list of the available statistics, see WINHTTP_REQUEST_STATS. [CorrespondingType(typeof(WINHTTP_REQUEST_STATS), CorrespondingAction.Get)] WINHTTP_OPTION_REQUEST_STATS = 146, /// Retreives timing information for the request. For a list of the available timings, see WINHTTP_REQUEST_TIMES. [CorrespondingType(typeof(WINHTTP_REQUEST_TIMES), CorrespondingAction.Get)] WINHTTP_OPTION_REQUEST_TIMES = 142, /// /// This option tells WinHttp to ignore "Content-Length" response headers, and continue receiving on a stream until the /// END_STREAM flag is received. /// [CorrespondingType(typeof(BOOL), CorrespondingAction.Set)] WINHTTP_OPTION_REQUIRE_STREAM_END = 160, /// /// This option can be set on a WinHttp request handle before it has been sent. If set, WinHttp will use the caller-provided /// string as the hostname for DNS resolution. /// [CorrespondingType(typeof(string), CorrespondingAction.Set)] WINHTTP_OPTION_RESOLUTION_HOSTNAME = 165, /// /// Sets or retrieves an unsigned long integer value that contains the time-out value, in milliseconds, to resolve a host name. /// The default timeout value is INFINITE. If a non-default value is specified, there is an overhead of one thread-creation per /// name resolution. /// [CorrespondingType(typeof(uint))] WINHTTP_OPTION_RESOLVE_TIMEOUT = 2, /// Undocumented. [CorrespondingType(typeof(uint), CorrespondingAction.Set)] WINHTTP_OPTION_RESOLVER_CACHE_CONFIG = 170, /// /// Sets an unsigned long integer value that specifies which secure protocols are acceptable. By default only SSL3 and TLS1 are /// enabled in Windows 7 and Windows 8. By default only SSL3, TLS1.0, TLS1.1, and TLS1.2 are enabled in Windows 8.1 and Windows 10. /// [CorrespondingType(typeof(WINHTTP_FLAG_SECURE_PROTOCOL), CorrespondingAction.Set)] WINHTTP_OPTION_SECURE_PROTOCOLS = 84, /// /// Retrieves the certificate for a SSL/TLS server into the WINHTTP_CERTIFICATE_INFO structure. The application must free the /// lpszSubjectInfo and lpszIssuerInfo members with LocalFree. /// [CorrespondingType(typeof(WINHTTP_CERTIFICATE_INFO), CorrespondingAction.Get)] WINHTTP_OPTION_SECURITY_CERTIFICATE_STRUCT = 32, /// Sets or retrieves an unsigned long integer value that contains the security flags for a handle. [CorrespondingType(typeof(SECURITY_FLAG))] WINHTTP_OPTION_SECURITY_FLAGS = 31, /// Retreives the SChannel connection and cipher information for a request. [CorrespondingType(typeof(WINHTTP_SECURITY_INFO), CorrespondingAction.Get)] WINHTTP_OPTION_SECURITY_INFO = 151, /// /// Retrieves an unsigned long integer value that contains the cipher strength of the encryption key. A larger number indicates /// stronger cipher strength encryption. /// [CorrespondingType(typeof(uint), CorrespondingAction.Get)] WINHTTP_OPTION_SECURITY_KEY_BITNESS = 36, /// Undocumented. [CorrespondingType(typeof(WINHTTP_PROXY_SETTINGS))] WINHTTP_OPTION_SELECTED_PROXY_CONFIG_INFO = 182, /// /// Sets or retrieves an unsigned long integer value that contains the time-out value, in milliseconds, to send a request or /// write some data. If sending the request takes longer than the timeout, the send operation is canceled. The default timeout is /// 30 seconds. /// [CorrespondingType(typeof(uint))] WINHTTP_OPTION_SEND_TIMEOUT = 5, /// /// Gets a pointer to SecPkgContext_Bindings structure that specifies a Channel Binding Token (CBT). /// /// A Channel Binding Token is a property of a secure transport channel and is used to bind an authentication channel to the /// secure transport channel. This token can only be obtained by this option after an SSL connection has been established. /// /// Passing this option and a null value for lpBuffer to WinHttpQueryOption will return /// ERROR_INSUFFICIENT_BUFFER and the required byte size for the buffer in the lpdwBufferLength parameter.This returned buffer /// size value can be passed in a subsequent call to query for the Channel Binding Token.These steps are necessary when handling /// WINHTTP_CALLBACK_STATUS_REQUEST if you want to modify request headers based on the Channel Binding Token. Note that Windows /// XP and Vista do not support modifying request headers during this callback. /// [CorrespondingType(typeof(Secur32.SecPkgContext_Bindings), CorrespondingAction.Get)] WINHTTP_OPTION_SERVER_CBT = 108, /// /// Retrieves the server certification chain context. WINHTTP_OPTION_SERVER_CERT_CHAIN_CONTEXT can be passed to obtain a /// duplicated pointer to the CERT_CHAIN_CONTEXT for a server certificate chain received during a negotiated SSL connection. The /// client must call CertFreeCertificateContext on the returned PCCERT_CONTEXT pointer that is filled into the buffer. /// [CorrespondingType(typeof(Crypt32.PCCERT_CHAIN_CONTEXT), CorrespondingAction.Get)] WINHTTP_OPTION_SERVER_CERT_CHAIN_CONTEXT = 147, /// /// Retrieves the server certification context. WINHTTP_OPTION_SERVER_CERT_CONTEXT can be passed to obtain a duplicated pointer /// to the CERT CONTEXT for a server certificate received during a negotiated SSL connection. The client must call /// CertFreeCertificateContext on the returned PCCERT_CONTEXT pointer that is filled into the buffer. /// [CorrespondingType(typeof(Crypt32.PCCERT_CONTEXT), CorrespondingAction.Get)] WINHTTP_OPTION_SERVER_CERT_CONTEXT = 78, /// /// Gets the server Server Principal Name that WinHTTP supplied to SSPI during authentication. This string value can be passed to /// SspiPromptForCredentials after an authentication failure. /// [CorrespondingType(typeof(string), CorrespondingAction.Get)] WINHTTP_OPTION_SERVER_SPN_USED = 106, /// Undocumented. [CorrespondingType(typeof(uint), CorrespondingAction.Set)] WINHTTP_OPTION_SET_GLOBAL_CALLBACK = 163, /// Undocumented. [CorrespondingType(typeof(uint), CorrespondingAction.Set)] WINHTTP_OPTION_SET_TOKEN_BINDING = 166, /// Undocumented. [CorrespondingType(typeof(uint), CorrespondingAction.Set)] WINHTTP_OPTION_SOURCE_ADDRESS = 156, /// /// Includes or removes the server port number when the SPN (service principal name) is built for Kerberos or Negotiate Kerberos authentication. /// [CorrespondingType(typeof(WINHTTP_SPN), CorrespondingAction.Set)] WINHTTP_OPTION_SPN = 96, /// /// This option can be queried on a WinHttp request handle, and will return the error code indicated by a RST_STREAM frame /// received on an HTTP stream. /// [CorrespondingType(typeof(Win32Error), CorrespondingAction.Get)] WINHTTP_OPTION_STREAM_ERROR_CODE = 159, /// Enables TCP Fast Open for the connection. [CorrespondingType(typeof(BOOL), CorrespondingAction.Set)] WINHTTP_OPTION_TCP_FAST_OPEN = 153, /// /// This option can be set on a WinHttp session handle to enable TCP keep-alive behavior on the underlying socket. Takes a /// tcp_keepalive struct. /// [CorrespondingType(typeof(tcp_keepalive), CorrespondingAction.Set)] WINHTTP_OPTION_TCP_KEEPALIVE = 152, /// Undocumented. [CorrespondingType(typeof(uint), CorrespondingAction.Set)] WINHTTP_OPTION_TCP_PRIORITY_HINT = 128, /// Undocumented. [CorrespondingType(typeof(ulong), CorrespondingAction.GetSet)] WINHTTP_OPTION_TCP_PRIORITY_STATUS = 177, /// Enables TLS False Start for the connection. [CorrespondingType(typeof(BOOL), CorrespondingAction.Set)] WINHTTP_OPTION_TLS_FALSE_START = 154, /// /// This option can be set on a WinHttp session handle to control whether fallback to TLS 1.0 is allowed if there is a TLS /// handshake failure with a newer protocol version. /// [CorrespondingType(typeof(BOOL), CorrespondingAction.Set)] WINHTTP_OPTION_TLS_PROTOCOL_INSECURE_FALLBACK = 158, /// Undocumented. [CorrespondingType(typeof(uint), CorrespondingAction.GetSet)] WINHTTP_OPTION_TOKEN_BINDING_PUBLIC_KEY = 167, /// /// Takes an event that will be set when the last callback has completed for a particular session. This flag must be must be used /// on a session handle. The event cannot be closed until after it has been set by WinHTTP. /// [CorrespondingType(typeof(HEVENT), CorrespondingAction.Set)] WINHTTP_OPTION_UNLOAD_NOTIFY_EVENT = 99, /// This option is reserved for internal use and should not be called. [CorrespondingType(typeof(uint), CorrespondingAction.Set)] WINHTTP_OPTION_UNSAFE_HEADER_PARSING = 110, /// Instructs the stack to start a WebSocket handshake process with WinHttpSendRequest. This option takes no parameters. [CorrespondingType(null, CorrespondingAction.Set)] WINHTTP_OPTION_UPGRADE_TO_WEB_SOCKET = 114, /// /// Retrieves a string value that contains the full URL of a downloaded resource. If the original URL contained any extra data, /// such as search strings or anchors, or if the call was redirected, the URL returned differs from the original. The application /// should pass in a buffer, sized in bytes, that is big enough to hold the returned URL in wide char. /// [CorrespondingType(typeof(string), CorrespondingAction.Get)] WINHTTP_OPTION_URL = 34, /// /// Takes a BOOL and can be set only a session handle. It will only propagate down to handles created from the session handle /// after the option has been set. If TRUE, this option causes as a last resort the use of global server credentials that were /// pushed down from WinInet. The default for this option is FALSE. This option requires registry key /// HKLM\Software\Microsoft\Windows\CurrentVersion\Internet Settings!ShareCredsWithWinHttp. This registry key is not present by /// default. When it is set, WinINet will send credentials down to WinHTTP. Whenever WinHttp gets an authentication challenge and /// if there are no credentials set on the current handle, it will use the credentials provided by WinINet. /// [CorrespondingType(typeof(BOOL), CorrespondingAction.Set)] WINHTTP_OPTION_USE_GLOBAL_SERVER_CREDENTIALS = 101, /// /// Sets or retrieves the user agent string on handles supplied by WinHttpOpen and used in subsequent WinHttpSendRequest /// functions, as long as it is not overridden by a header added by WinHttpAddRequestHeaders or WinHttpSendRequest. When /// retrieving a user agent, the application should pass in a buffer, sized in bytes, that is big enough to hold the returned URL /// in wide char. When setting the user agent, the buffer size is the length of the string, in characters, plus the NULL terminator. /// [CorrespondingType(typeof(string), CorrespondingAction.GetSet)] WINHTTP_OPTION_USER_AGENT = 41, /// Sets or retrieves a string that contains the user name. [CorrespondingType(typeof(string), CorrespondingAction.GetSet)] WINHTTP_OPTION_USERNAME = 0x1000, /// /// Sets the time, in milliseconds, that WinHttpWebSocketClose should wait to complete the close handshake. The default is 10 seconds. /// [CorrespondingType(typeof(uint), CorrespondingAction.Set)] WINHTTP_OPTION_WEB_SOCKET_CLOSE_TIMEOUT = 115, /// /// Sets the interval, in milliseconds, to send a keep-alive packet over the connection. The default interval is 30000 (30 /// seconds). The minimum interval is 15000 (15 seconds). Using WinHttpSetOption to set a value lower than 15000 will return with /// ERROR_INVALID_PARAMETER. The default value for WINHTTP_OPTION_WEB_SOCKET_KEEPALIVE_INTERVAL is read from /// HKLM:\SOFTWARE\Microsoft\WebSocket\KeepaliveInterval. If a value is not set, the default value of 30000 will be used. It is /// not possible to have a lower keepalive interval than 15000 milliseconds. /// [CorrespondingType(typeof(uint), CorrespondingAction.Set)] WINHTTP_OPTION_WEB_SOCKET_KEEPALIVE_INTERVAL = 116, /// Sets or retrieves a DWORD which specifies the receive buffer size to be used on WebSocket connections. [CorrespondingType(typeof(uint), CorrespondingAction.GetSet)] WINHTTP_OPTION_WEB_SOCKET_RECEIVE_BUFFER_SIZE = 122, /// Sets or retrieves a DWORD which specifies the send buffer size to be used on WebSocket connections. [CorrespondingType(typeof(uint), CorrespondingAction.GetSet)] WINHTTP_OPTION_WEB_SOCKET_SEND_BUFFER_SIZE = 123, /// /// Sets an unsigned long integer value that specifies the number of worker threads the thread pool should use for asynchronous /// completions. The default value of this option is zero, which specifies that the number of worker threads is equal to the /// number of CPUs on the system. This option can only be set on a NULL HINTERNET handle before an asynchronous operation has /// occurred. This option can only be set once. /// Windows Server 2008 R2 and Windows 7: This flag is obsolete. /// [CorrespondingType(typeof(uint), CorrespondingAction.Set)] WINHTTP_OPTION_WORKER_THREAD_COUNT = 80, /// This option has been deprecated; it has no effect. [CorrespondingType(typeof(uint))] WINHTTP_OPTION_WRITE_BUFFER_SIZE = 13, } /// The behavior of WinHTTP regarding the handling of a 30x HTTP redirect status code. [PInvokeData("winhttp.h")] public enum WINHTTP_OPTION_REDIRECT_POLICY : uint { /// WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP WINHTTP_OPTION_REDIRECT_POLICY_DEFAULT = WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP, /// Redirects are never followed. The 30x status is returned to the application. WINHTTP_OPTION_REDIRECT_POLICY_NEVER = 0, /// /// All redirects are followed, except those that originate from a secure (https) URL to an unsecure (http) URL. This is the /// default setting. /// WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP = 1, /// All redirects are followed automatically. WINHTTP_OPTION_REDIRECT_POLICY_ALWAYS = 2, } /// Bitmask of acceptable advanced HTTP versions. [PInvokeData("winhttp.h")] [Flags] public enum WINHTTP_PROTOCOL_FLAG : uint { /// Restricts the request to HTTP/1.1 and prior. None = 0, /// Enables HTTP/2 for the request. WINHTTP_PROTOCOL_FLAG_HTTP2 = 0x1, /// Enables HTTP/3 for the request. WINHTTP_PROTOCOL_FLAG_HTTP3 = 0x2, } /// Defines constants that specify proxy settings types for extended proxy settings APIs. // https://learn.microsoft.com/en-us/windows/win32/api/winhttp/ne-winhttp-winhttp_proxy_settings_type typedef enum // _WINHTTP_PROXY_SETTINGS_TYPE { WinHttpProxySettingsTypeUnknown, WinHttpProxySettingsTypeWsl, WinHttpProxySettingsTypeWsa } // WINHTTP_PROXY_SETTINGS_TYPE, *PWINHTTP_PROXY_SETTINGS_TYPE; [PInvokeData("winhttp.h", MSDNShortId = "NE:winhttp._WINHTTP_PROXY_SETTINGS_TYPE")] public enum WINHTTP_PROXY_SETTINGS_TYPE { /// Specifies an unknown type. WinHttpProxySettingsTypeUnknown, /// Specifies settings for Windows Subsystem for Linux (WSL). WinHttpProxySettingsTypeWsl, /// Specifies settings for Windows Subsystem for Android (WSA). WinHttpProxySettingsTypeWsa, } /// [Flags] public enum WINHTTP_PROXY_TYPE : ulong { /// Direct to net WINHTTP_PROXY_TYPE_DIRECT = 0x00000001, /// Via named proxy WINHTTP_PROXY_TYPE_PROXY = 0x00000002, /// Autoproxy URL WINHTTP_PROXY_TYPE_AUTO_PROXY_URL = 0x00000004, /// Use autoproxy detection WINHTTP_PROXY_TYPE_AUTO_DETECT = 0x00000008, } /// /// These attributes and modifiers are used by WinHttpQueryHeaders. /// /// The attribute flags are used by WinHttpQueryHeaders to indicate what information to retrieve. Most of the attribute flags map /// directly to a specific HTTP header. There are also some special flags, such as WINHTTP_QUERY_RAW_HEADERS, that are not related to /// a specific header. /// /// /// The modifier flags are used in conjunction with an attribute flag to modify the request. Modifier flags either modify the format /// of the data returned or indicate where the WinHttpQueryHeaders function should search for the information. /// /// [PInvokeData("winhttp.h")] [Flags] public enum WINHTTP_QUERY : uint { /// Retrieves the acceptable media types for the response. WINHTTP_QUERY_ACCEPT = 24, /// Retrieves the acceptable character sets for the response. WINHTTP_QUERY_ACCEPT_CHARSET = 25, /// Retrieves the acceptable content-coding values for the response. WINHTTP_QUERY_ACCEPT_ENCODING = 26, /// Retrieves the acceptable natural languages for the response. WINHTTP_QUERY_ACCEPT_LANGUAGE = 27, /// Retrieves the types of range requests that are accepted for a resource. WINHTTP_QUERY_ACCEPT_RANGES = 42, /// /// Retrieves the Age response-header field, which contains the sender's estimate of the amount of time since the response was /// generated at the originating server. /// [CorrespondingType(typeof(uint))] WINHTTP_QUERY_AGE = 48, /// Receives the HTTP verbs supported by the server. WINHTTP_QUERY_ALLOW = 7, /// Retrieves the Authentication-Info header. WINHTTP_QUERY_AUTHENTICATION_INFO = 76, /// Retrieves the authorization credentials used for a request. WINHTTP_QUERY_AUTHORIZATION = 28, /// Retrieves the cache control directives. WINHTTP_QUERY_CACHE_CONTROL = 49, /// /// Retrieves any options that are specified for a particular connection and must not be communicated by proxies over further connections. /// WINHTTP_QUERY_CONNECTION = 23, /// Retrieves the base Uniform Resource Identifier (URI) to resolve relative URLs within the entity. WINHTTP_QUERY_CONTENT_BASE = 50, /// Obsolete. Maintained for legacy application compatibility. WINHTTP_QUERY_CONTENT_DESCRIPTION = 4, /// Obsolete. Maintained for legacy application compatibility. WINHTTP_QUERY_CONTENT_DISPOSITION = 47, /// Retrieves additional content coding that has been applied to the entire resource. WINHTTP_QUERY_CONTENT_ENCODING = 29, /// Retrieves the content identification. WINHTTP_QUERY_CONTENT_ID = 3, /// Retrieves the language that the content is written in. WINHTTP_QUERY_CONTENT_LANGUAGE = 6, /// Retrieves the size of the resource, in bytes. [CorrespondingType(typeof(uint))] WINHTTP_QUERY_CONTENT_LENGTH = 5, /// Retrieves the resource location for the entity enclosed in the message. WINHTTP_QUERY_CONTENT_LOCATION = 51, /// /// Retrieves an MD5 digest of the entity body for the purpose of providing an end-to-end message integrity check for the entity /// body. For more information, see RFC 1864. /// WINHTTP_QUERY_CONTENT_MD5 = 52, /// /// Retrieves the location in the full entity body where the partial entity body should be inserted and the total size of the /// full entity body. /// WINHTTP_QUERY_CONTENT_RANGE = 53, /// /// Retrieves an encoding transformation applicable to an entity-body. It may already have been applied, may need to be applied, /// or may be optionally applicable. /// WINHTTP_QUERY_CONTENT_TRANSFER_ENCODING = 2, /// Receives the content type of the resource, such as text or html. WINHTTP_QUERY_CONTENT_TYPE = 1, /// Retrieves any cookies associated with the request. WINHTTP_QUERY_COOKIE = 44, /// Not supported. WINHTTP_QUERY_COST = 15, /// /// Causes WinHttpQueryHeaders to search for the header name specified in the pwszName parameter and store the header information /// in lpBuffer. An application can use WINHTTP_OPTION_RECEIVE_RESPONSE_TIMEOUT to limit the maximum time this query waits for /// all headers to be received. /// WINHTTP_QUERY_CUSTOM = 65535, /// Receives the date and time at which the message was originated. [CorrespondingType(typeof(SYSTEMTIME))] WINHTTP_QUERY_DATE = 9, /// Not supported. WINHTTP_QUERY_DERIVED_FROM = 14, /// Retrieves the entity tag for the associated entity. WINHTTP_QUERY_ETAG = 54, /// Retrieves the Expect header, which indicates whether the client application should expect 100 series responses. WINHTTP_QUERY_EXPECT = 68, /// Receives the date and time after which the resource should be considered outdated. [CorrespondingType(typeof(SYSTEMTIME))] WINHTTP_QUERY_EXPIRES = 10, /// Obsolete. Maintained for legacy application compatibility. WINHTTP_QUERY_FORWARDED = 30, /// Retrieves the e-mail address for the user who controls the requesting user agent if the From header is given. WINHTTP_QUERY_FROM = 31, /// Retrieves the Internet host and port number of the resource being requested. WINHTTP_QUERY_HOST = 55, /// Retrieves the contents of the If-Match request-header field. WINHTTP_QUERY_IF_MATCH = 56, /// Retrieves the contents of the If-Modified-Since header. [CorrespondingType(typeof(SYSTEMTIME))] WINHTTP_QUERY_IF_MODIFIED_SINCE = 32, /// Retrieves the contents of the If-None-Match request-header field. WINHTTP_QUERY_IF_NONE_MATCH = 57, /// /// Retrieves the contents of the If-Range request-header field. This header allows the client application to check if the entity /// related to a partial copy of the entity in the client application's cache has not been updated. If the entity has not been /// updated, send the parts that the client application is missing. If the entity has been updated, send the entire updated entity. /// WINHTTP_QUERY_IF_RANGE = 58, /// Retrieves the contents of the If-Unmodified-Since request-header field. [CorrespondingType(typeof(SYSTEMTIME))] WINHTTP_QUERY_IF_UNMODIFIED_SINCE = 59, /// Obsolete. Maintained for legacy application compatibility. WINHTTP_QUERY_LINK = 11, /// Receives the date and time at which the resource was last modified. The date and time are determined by the server. [CorrespondingType(typeof(SYSTEMTIME))] WINHTTP_QUERY_LAST_MODIFIED = 16, /// Retrieves the absolute URI used in a Location response-header. WINHTTP_QUERY_LOCATION = 33, /// Indicates the maximum value of a WINHTTP_QUERY_* value. Not a query flag. WINHTTP_QUERY_MAX = 78, /// Retrieves the number of proxies or gateways that can forward the request to the next inbound server. [CorrespondingType(typeof(uint))] WINHTTP_QUERY_MAX_FORWARDS = 60, /// Not supported. WINHTTP_QUERY_MESSAGE_ID = 12, /// /// Receives the version of the Multipurpose Internet Mail Extensions (MIME) protocol that was used to construct the message. /// WINHTTP_QUERY_MIME_VERSION = 0, /// Obsolete. Maintained for legacy application compatibility. WINHTTP_QUERY_ORIG_URI = 34, /// /// Receives the implementation-specific directives that might apply to any recipient along the request/response chain. /// WINHTTP_QUERY_PRAGMA = 17, /// Retrieves the authentication scheme and realm returned by the proxy. WINHTTP_QUERY_PROXY_AUTHENTICATE = 41, /// /// Retrieves the header that is used to identify the user to a proxy that requires authentication. This header can only be /// retrieved before the request is sent to the server. /// WINHTTP_QUERY_PROXY_AUTHORIZATION = 61, /// Retrieves the Proxy-Connection header. WINHTTP_QUERY_PROXY_CONNECTION = 69, /// Retrieves the Proxy-Support header. WINHTTP_QUERY_PROXY_SUPPORT = 75, /// Receives HTTP verbs available at this server. WINHTTP_QUERY_PUBLIC = 8, /// Retrieves the byte range of an entity. WINHTTP_QUERY_RANGE = 62, /// /// Receives all the headers returned by the server. Each header is terminated by "\0". An additional "\0" terminates the list of headers. /// [CorrespondingType(typeof(string[]))] WINHTTP_QUERY_RAW_HEADERS = 21, /// /// Receives all the headers returned by the server. Each header is separated by a carriage return/line feed (CR/LF) sequence. /// [CorrespondingType(typeof(string))] WINHTTP_QUERY_RAW_HEADERS_CRLF = 22, /// Receives the URI of the resource where the requested URI was obtained. [CorrespondingType(typeof(string))] WINHTTP_QUERY_REFERER = 35, /// Obsolete. Maintained for legacy application compatibility. WINHTTP_QUERY_REFRESH = 46, /// Receives the HTTP verb that is being used in the request, typically GET or POST. [CorrespondingType(typeof(string))] WINHTTP_QUERY_REQUEST_METHOD = 45, /// Retrieves the amount of time the service is expected to be unavailable. WINHTTP_QUERY_RETRY_AFTER = 36, /// Retrieves information about the software used by the originating server to handle the request. WINHTTP_QUERY_SERVER = 37, /// Receives the value of the cookie set for the request. WINHTTP_QUERY_SET_COOKIE = 43, /// Receives the status code returned by the server. For a list of possible values, see HTTP Status Codes. [CorrespondingType(typeof(HTTP_STATUS))] WINHTTP_QUERY_STATUS_CODE = 19, /// Receives additional text returned by the server on the response line. WINHTTP_QUERY_STATUS_TEXT = 20, /// Obsolete. Maintained for legacy application compatibility. WINHTTP_QUERY_TITLE = 38, /// /// Retrieves the type of transformation that has been applied to the message body so it can be safely transferred between the /// sender and recipient. /// WINHTTP_QUERY_TRANSFER_ENCODING = 63, /// Retrieves the Unless-Modified-Since header. WINHTTP_QUERY_UNLESS_MODIFIED_SINCE = 70, /// Retrieves the additional communication protocols that are supported by the server. WINHTTP_QUERY_UPGRADE = 64, /// Receives some or all of the URI by which the Request-URI resource can be identified. WINHTTP_QUERY_URI = 13, /// Retrieves information about the user agent that made the request. WINHTTP_QUERY_USER_AGENT = 39, /// /// Retrieves the header that indicates that the entity was selected from a number of available representations of the response /// using server-driven negotiation. /// WINHTTP_QUERY_VARY = 65, /// Retrieves the HTTP version that is present in the status line. WINHTTP_QUERY_VERSION = 18, /// /// Retrieves the intermediate protocols and recipients between the user agent and the server on requests, and between the origin /// server and the client on responses. /// WINHTTP_QUERY_VIA = 66, /// /// Retrieves additional information about the status of a response that might not be reflected by the response status code. /// WINHTTP_QUERY_WARNING = 67, /// Retrieves the authentication scheme and realm returned by the server. WINHTTP_QUERY_WWW_AUTHENTICATE = 40, /// Returns the data as a 32-bit number for headers whose value is a number, such as the status code. WINHTTP_QUERY_FLAG_NUMBER = 0x20000000, /// Queries request headers only. WINHTTP_QUERY_FLAG_REQUEST_HEADERS = 0x80000000, /// /// Returns the header value as a SYSTEMTIME structure, which does not require the application to parse the data. Use for headers /// whose value is a date/time string, such as "Last-Modified-Time". /// WINHTTP_QUERY_FLAG_SYSTEMTIME = 0x40000000, /// /// Queries response trailers. Prior to querying response trailers, you must call WinHttpReadData until it returns 0 bytes read. /// WINHTTP_QUERY_FLAG_TRAILERS = 0x02000000, /// /// By default, WinHttpQueryHeaders performs a Unicode conversion before returning the header that was queried. If this flag is /// set, WinHttp returns the header to the caller without performing this conversion. /// WINHTTP_QUERY_FLAG_WIRE_ENCODING = 0x01000000, /// WINHTTP_QUERY_EX_ALL_HEADERS = WINHTTP_QUERY_RAW_HEADERS, /// Returns the data as a 64-bit number for headers whose value is a number, such as the status code. WINHTTP_QUERY_FLAG_NUMBER64 = 0x08000000, } /// Flags for WinHttpQueryConnectionGroup. [PInvokeData("winhttp.h", MSDNShortId = "NF:winhttp.WinHttpQueryConnectionGroup")] [Flags] public enum WINHTTP_QUERY_CONNECTION_GROUP_FLAG : ulong { /// Indicate that you want non-HTTPS connections (see hInternet). WINHTTP_QUERY_CONNECTION_GROUP_FLAG_INSECURE = 1 } /// Flags for WinHttpReadDataEx. [PInvokeData("winhttp.h")] [Flags] public enum WINHTTP_READ_DATA_EX_FLAG : ulong { /// /// WinHttp won't complete the call to WinHttpReadDataEx until the provided data buffer has been filled, or the response /// is complete. /// WINHTTP_READ_DATA_EX_FLAG_FILL_BUFFER = 0x0000000000000001 } /// The WINHTTP_REQUEST_STAT_ENTRY enumeration lists the available types of request statistics. /// /// This structure is used with WinHttpQueryOption to retrieve statistics for a request by specifying the /// WINHTTP_OPTION_REQUEST_STATS flag. /// // https://docs.microsoft.com/en-us/windows/win32/api/winhttp/ne-winhttp-winhttp_request_stat_entry typedef enum // _WINHTTP_REQUEST_STAT_ENTRY { WinHttpConnectFailureCount = 0, WinHttpProxyFailureCount, WinHttpTlsHandshakeClientLeg1Size, // WinHttpTlsHandshakeServerLeg1Size, WinHttpTlsHandshakeClientLeg2Size, WinHttpTlsHandshakeServerLeg2Size, // WinHttpRequestHeadersSize, WinHttpRequestHeadersCompressedSize, WinHttpResponseHeadersSize, WinHttpResponseHeadersCompressedSize, // WinHttpResponseBodySize, WinHttpResponseBodyCompressedSize, WinHttpProxyTlsHandshakeClientLeg1Size, // WinHttpProxyTlsHandshakeServerLeg1Size, WinHttpProxyTlsHandshakeClientLeg2Size, WinHttpProxyTlsHandshakeServerLeg2Size, // WinHttpRequestStatLast, WinHttpRequestStatMax = 32 } WINHTTP_REQUEST_STAT_ENTRY; [PInvokeData("winhttp.h", MSDNShortId = "NE:winhttp._WINHTTP_REQUEST_STAT_ENTRY")] public enum WINHTTP_REQUEST_STAT_ENTRY : uint { /// /// Value: /// 0 /// The number of connection failures during connection establishment. /// WinHttpConnectFailureCount = 0, /// The number of proxy connection failures during connection establishment. WinHttpProxyFailureCount, /// The size of the client data for the first leg of the TLS handshake. WinHttpTlsHandshakeClientLeg1Size, /// The size of the server data for the first leg of the TLS handshake. WinHttpTlsHandshakeServerLeg1Size, /// The size of the client data for the second leg of the TLS handshake. WinHttpTlsHandshakeClientLeg2Size, /// The size of the server data for the second leg of the TLS handshake. WinHttpTlsHandshakeServerLeg2Size, /// The size of the request headers. WinHttpRequestHeadersSize, /// The compressed size of the request headers. WinHttpRequestHeadersCompressedSize, /// The size of the response headers. WinHttpResponseHeadersSize, /// The compressed size of the response headers. WinHttpResponseHeadersCompressedSize, /// The size of the response body. WinHttpResponseBodySize, /// The compressed size of the response body. WinHttpResponseBodyCompressedSize, /// The size of the client data for the first leg of the proxy TLS handshake. WinHttpProxyTlsHandshakeClientLeg1Size, /// The size of the server data for the first leg of the proxy TLS handshake. WinHttpProxyTlsHandshakeServerLeg1Size, /// The size of the client data for the second leg of the proxy TLS handshake. WinHttpProxyTlsHandshakeClientLeg2Size, /// The size of the server data for the second leg of the proxy TLS handshake. WinHttpProxyTlsHandshakeServerLeg2Size, /// Marker for the end of the list of available statistics. WinHttpRequestStatLast, /// /// Value: /// 32 /// The maximum number of statistics available. /// WinHttpRequestStatMax = 32, } /// Flags containing details on how the request was made. [PInvokeData("winhttp.h")] [Flags] public enum WINHTTP_REQUEST_STAT_FLAG : ulong { /// TCP Fast Open occurred. WINHTTP_REQUEST_STAT_FLAG_TCP_FAST_OPEN = 0x00000001, /// TLS Session Resumption occurred. WINHTTP_REQUEST_STAT_FLAG_TLS_SESSION_RESUMPTION = 0x00000002, /// TLS False Start occurred. WINHTTP_REQUEST_STAT_FLAG_TLS_FALSE_START = 0x00000004, /// TLS Session Resumption occurred for the proxy connection. WINHTTP_REQUEST_STAT_FLAG_PROXY_TLS_SESSION_RESUMPTION = 0x00000008, /// TLS False Start occurred for the proxy connection. WINHTTP_REQUEST_STAT_FLAG_PROXY_TLS_FALSE_START = 0x00000010, /// This is the first request on the connection. WINHTTP_REQUEST_STAT_FLAG_FIRST_REQUEST = 0x00000020, } /// The WINHTTP_REQUEST_TIME_ENTRY enumeration lists the available types of request timing information. /// /// This structure is used with WinHttpQueryOption to retrieve timing information for a request by specifying the /// WINHTTP_OPTION_REQUEST_TIMES flag. /// // https://docs.microsoft.com/en-us/windows/win32/api/winhttp/ne-winhttp-winhttp_request_time_entry typedef enum // _WINHTTP_REQUEST_TIME_ENTRY { WinHttpProxyDetectionStart = 0, WinHttpProxyDetectionEnd, WinHttpConnectionAcquireStart, // WinHttpConnectionAcquireWaitEnd, WinHttpConnectionAcquireEnd, WinHttpNameResolutionStart, WinHttpNameResolutionEnd, // WinHttpConnectionEstablishmentStart, WinHttpConnectionEstablishmentEnd, WinHttpTlsHandshakeClientLeg1Start, // WinHttpTlsHandshakeClientLeg1End, WinHttpTlsHandshakeClientLeg2Start, WinHttpTlsHandshakeClientLeg2End, // WinHttpTlsHandshakeClientLeg3Start, WinHttpTlsHandshakeClientLeg3End, WinHttpStreamWaitStart, WinHttpStreamWaitEnd, // WinHttpSendRequestStart, WinHttpSendRequestHeadersCompressionStart, WinHttpSendRequestHeadersCompressionEnd, // WinHttpSendRequestHeadersEnd, WinHttpSendRequestEnd, WinHttpReceiveResponseStart, WinHttpReceiveResponseHeadersDecompressionStart, // WinHttpReceiveResponseHeadersDecompressionEnd, WinHttpReceiveResponseHeadersEnd, WinHttpReceiveResponseBodyDecompressionDelta, // WinHttpReceiveResponseEnd, WinHttpProxyTunnelStart, WinHttpProxyTunnelEnd, WinHttpProxyTlsHandshakeClientLeg1Start, // WinHttpProxyTlsHandshakeClientLeg1End, WinHttpProxyTlsHandshakeClientLeg2Start, WinHttpProxyTlsHandshakeClientLeg2End, // WinHttpProxyTlsHandshakeClientLeg3Start, WinHttpProxyTlsHandshakeClientLeg3End, WinHttpRequestTimeLast, WinHttpRequestTimeMax = 64 // } WINHTTP_REQUEST_TIME_ENTRY; [PInvokeData("winhttp.h", MSDNShortId = "NE:winhttp._WINHTTP_REQUEST_TIME_ENTRY")] public enum WINHTTP_REQUEST_TIME_ENTRY : uint { /// /// Value: /// 0 /// Start of proxy detection. /// WinHttpProxyDetectionStart = 0, /// End of proxy detection. WinHttpProxyDetectionEnd, /// Start of connection acquisition. WinHttpConnectionAcquireStart, /// End waiting for an available connection. WinHttpConnectionAcquireWaitEnd, /// End of connection acquisition. WinHttpConnectionAcquireEnd, /// Start of name resolution. WinHttpNameResolutionStart, /// End of name resolution. WinHttpNameResolutionEnd, /// Start of connection establishment. WinHttpConnectionEstablishmentStart, /// End of connection establishment. WinHttpConnectionEstablishmentEnd, /// Start of the first leg of the TLS handshake. WinHttpTlsHandshakeClientLeg1Start, /// End of the first leg of the TLS handshake. WinHttpTlsHandshakeClientLeg1End, /// Start of the second leg of the TLS handshake. WinHttpTlsHandshakeClientLeg2Start, /// End of the second leg of the TLS handshake. WinHttpTlsHandshakeClientLeg2End, /// Start of the third leg of the TLS handshake. WinHttpTlsHandshakeClientLeg3Start, /// End of the third leg of the TLS handshake. WinHttpTlsHandshakeClientLeg3End, /// Start waiting for an available stream. WinHttpStreamWaitStart, /// End waiting for an available stream. WinHttpStreamWaitEnd, /// Start sending a request. WinHttpSendRequestStart, /// Start of request header compression. WinHttpSendRequestHeadersCompressionStart, /// End of request header compression. WinHttpSendRequestHeadersCompressionEnd, /// End sending request headers. WinHttpSendRequestHeadersEnd, /// End sending a request. WinHttpSendRequestEnd, /// Start receiving a response. WinHttpReceiveResponseStart, /// Start of response header decompression. WinHttpReceiveResponseHeadersDecompressionStart, /// End of response header decompression. WinHttpReceiveResponseHeadersDecompressionEnd, /// End receiving response headers. WinHttpReceiveResponseHeadersEnd, /// Delta between start and end times for response body decompression. WinHttpReceiveResponseBodyDecompressionDelta, /// End receiving a response. WinHttpReceiveResponseEnd, /// Start establishing a proxy tunnel. WinHttpProxyTunnelStart, /// End establishing a proxy tunnel. WinHttpProxyTunnelEnd, /// Start of the first leg of the proxy TLS handshake. WinHttpProxyTlsHandshakeClientLeg1Start, /// End of the first leg of the proxy TLS handshake. WinHttpProxyTlsHandshakeClientLeg1End, /// Start of the second leg of the proxy TLS handshake. WinHttpProxyTlsHandshakeClientLeg2Start, /// End of the second leg of the proxy TLS handshake. WinHttpProxyTlsHandshakeClientLeg2End, /// Start of the third leg of the proxy TLS handshake. WinHttpProxyTlsHandshakeClientLeg3Start, /// End of the third leg of the proxy TLS handshake. WinHttpProxyTlsHandshakeClientLeg3End, /// Marker for the end of the list of available timings. WinHttpRequestTimeLast, /// /// Value: /// 64 /// The maximum number of timings available. /// WinHttpRequestTimeMax = 64, } /// A set of flags that affects the reset operation. [PInvokeData("winhttp.h", MSDNShortId = "NF:winhttp.WinHttpResetAutoProxy")] [Flags] public enum WINHTTP_RESET : uint { /// Forces a flush and retry of non-persistent proxy information on the current network. WINHTTP_RESET_STATE = 0x00000001, /// Flush the PAD information for the current network. WINHTTP_RESET_SWPAD_CURRENT_NETWORK = 0x00000002, /// Flush the PAD information for all networks. WINHTTP_RESET_SWPAD_ALL = 0x00000004, /// Flush the persistent HTTP cache of proxy scripts. WINHTTP_RESET_SCRIPT_CACHE = 0x00000008, /// Forces a flush and retry of all proxy information on the current network. WINHTTP_RESET_ALL = 0x0000FFFF, /// Flush the current proxy information and notify that the network changed. WINHTTP_RESET_NOTIFY_NETWORK_CHANGED = 0x00010000, /// /// Act on the autoproxy service instead of the current process. Applications that use the WinHttpGetProxyForUrl function to /// purge in-process caching should close the hInternet handle and open a new handle for future calls. /// WINHTTP_RESET_OUT_OF_PROC = 0x00020000, /// WINHTTP_RESET_DISCARD_RESOLVERS = 0x00040000, } /// Includes or removes the server port number when the SPN (service principal name) is built for Kerberos or Negotiate Kerberos authentication. [PInvokeData("winhttp.h")] [Flags] public enum WINHTTP_SPN : uint { /// Removes the server port number. WINHTTP_DISABLE_SPN_SERVER_PORT = 0x00000000, /// Includes the server port number. WINHTTP_ENABLE_SPN_SERVER_PORT = 0x00000001, } /// The WINHTTP_WEB_SOCKET_BUFFER_TYPE enumeration includes types of WebSocket buffers. // https://docs.microsoft.com/en-us/windows/win32/api/winhttp/ne-winhttp-winhttp_web_socket_buffer_type typedef enum // _WINHTTP_WEB_SOCKET_BUFFER_TYPE { WINHTTP_WEB_SOCKET_BINARY_MESSAGE_BUFFER_TYPE = 0, // WINHTTP_WEB_SOCKET_BINARY_FRAGMENT_BUFFER_TYPE = 1, WINHTTP_WEB_SOCKET_UTF8_MESSAGE_BUFFER_TYPE = 2, // WINHTTP_WEB_SOCKET_UTF8_FRAGMENT_BUFFER_TYPE = 3, WINHTTP_WEB_SOCKET_CLOSE_BUFFER_TYPE = 4 } WINHTTP_WEB_SOCKET_BUFFER_TYPE; [PInvokeData("winhttp.h", MSDNShortId = "NE:winhttp._WINHTTP_WEB_SOCKET_BUFFER_TYPE")] public enum WINHTTP_WEB_SOCKET_BUFFER_TYPE { /// /// Value: /// 0 /// Buffer contains either the entire binary message or the last part of it. /// WINHTTP_WEB_SOCKET_BINARY_MESSAGE_BUFFER_TYPE, /// /// Value: /// 1 /// Buffer contains only part of a binary message. /// WINHTTP_WEB_SOCKET_BINARY_FRAGMENT_BUFFER_TYPE, /// /// Value: /// 2 /// Buffer contains either the entire UTF-8 message or the last part of it. /// WINHTTP_WEB_SOCKET_UTF8_MESSAGE_BUFFER_TYPE, /// /// Value: /// 3 /// Buffer contains only part of a UTF-8 message. /// WINHTTP_WEB_SOCKET_UTF8_FRAGMENT_BUFFER_TYPE, /// /// Value: /// 4 /// The server sent a close frame. /// WINHTTP_WEB_SOCKET_CLOSE_BUFFER_TYPE, } /// The WINHTTP_WEB_SOCKET_CLOSE_STATUS enumeration includes the status of a WebSocket close operation. /// WINHTTP_WEB_SOCKET_CLOSE_STATUS is used by WinHttpWebSocketClose, WinHttpWebSocketShutdown, and WinHttpWebSocketQueryCloseStatus. // https://docs.microsoft.com/en-us/windows/win32/api/winhttp/ne-winhttp-winhttp_web_socket_close_status typedef enum // _WINHTTP_WEB_SOCKET_CLOSE_STATUS { WINHTTP_WEB_SOCKET_SUCCESS_CLOSE_STATUS = 1000, // WINHTTP_WEB_SOCKET_ENDPOINT_TERMINATED_CLOSE_STATUS = 1001, WINHTTP_WEB_SOCKET_PROTOCOL_ERROR_CLOSE_STATUS = 1002, // WINHTTP_WEB_SOCKET_INVALID_DATA_TYPE_CLOSE_STATUS = 1003, WINHTTP_WEB_SOCKET_EMPTY_CLOSE_STATUS = 1005, // WINHTTP_WEB_SOCKET_ABORTED_CLOSE_STATUS = 1006, WINHTTP_WEB_SOCKET_INVALID_PAYLOAD_CLOSE_STATUS = 1007, // WINHTTP_WEB_SOCKET_POLICY_VIOLATION_CLOSE_STATUS = 1008, WINHTTP_WEB_SOCKET_MESSAGE_TOO_BIG_CLOSE_STATUS = 1009, // WINHTTP_WEB_SOCKET_UNSUPPORTED_EXTENSIONS_CLOSE_STATUS = 1010, WINHTTP_WEB_SOCKET_SERVER_ERROR_CLOSE_STATUS = 1011, // WINHTTP_WEB_SOCKET_SECURE_HANDSHAKE_ERROR_CLOSE_STATUS = 1015 } WINHTTP_WEB_SOCKET_CLOSE_STATUS; [PInvokeData("winhttp.h", MSDNShortId = "NE:winhttp._WINHTTP_WEB_SOCKET_CLOSE_STATUS")] public enum WINHTTP_WEB_SOCKET_CLOSE_STATUS : ushort { /// /// Value: /// 1000 /// The connection closed successfully. /// WINHTTP_WEB_SOCKET_SUCCESS_CLOSE_STATUS = 1000, /// /// Value: /// 1001 /// The peer is going away and terminating the connection. /// WINHTTP_WEB_SOCKET_ENDPOINT_TERMINATED_CLOSE_STATUS, /// /// Value: /// 1002 /// A protocol error occurred. /// WINHTTP_WEB_SOCKET_PROTOCOL_ERROR_CLOSE_STATUS, /// /// Value: /// 1003 /// Invalid data received by the peer. /// WINHTTP_WEB_SOCKET_INVALID_DATA_TYPE_CLOSE_STATUS, /// /// Value: /// 1005 /// The close message was empty. /// WINHTTP_WEB_SOCKET_EMPTY_CLOSE_STATUS = 1005, /// /// Value: /// 1006 /// The connection was aborted. /// WINHTTP_WEB_SOCKET_ABORTED_CLOSE_STATUS, /// /// Value: /// 1007 /// The payload was invalid. /// WINHTTP_WEB_SOCKET_INVALID_PAYLOAD_CLOSE_STATUS, /// /// Value: /// 1008 /// The message violates an endpoint's policy. /// WINHTTP_WEB_SOCKET_POLICY_VIOLATION_CLOSE_STATUS, /// /// Value: /// 1009 /// The message sent was too large to process. /// WINHTTP_WEB_SOCKET_MESSAGE_TOO_BIG_CLOSE_STATUS, /// /// Value: /// 1010 /// /// A client endpoint expected the server to negotiate one or more extensions, but the server didn't return them in the response /// message of the WebSocket handshake. /// /// WINHTTP_WEB_SOCKET_UNSUPPORTED_EXTENSIONS_CLOSE_STATUS, /// /// Value: /// 1011 /// An unexpected condition prevented the server from /// fulfilling the request. /// WINHTTP_WEB_SOCKET_SERVER_ERROR_CLOSE_STATUS, /// /// Value: /// 1015 /// The TLS handshake could not be completed. /// WINHTTP_WEB_SOCKET_SECURE_HANDSHAKE_ERROR_CLOSE_STATUS = 1015, } /// The WINHTTP_WEB_SOCKET_OPERATION enumeration includes the WebSocket operation type. // https://docs.microsoft.com/en-us/windows/win32/api/winhttp/ne-winhttp-winhttp_web_socket_operation typedef enum // _WINHTTP_WEB_SOCKET_OPERATION { WINHTTP_WEB_SOCKET_SEND_OPERATION = 0, WINHTTP_WEB_SOCKET_RECEIVE_OPERATION = 1, // WINHTTP_WEB_SOCKET_CLOSE_OPERATION = 2, WINHTTP_WEB_SOCKET_SHUTDOWN_OPERATION = 3 } WINHTTP_WEB_SOCKET_OPERATION; [PInvokeData("winhttp.h", MSDNShortId = "NE:winhttp._WINHTTP_WEB_SOCKET_OPERATION")] public enum WINHTTP_WEB_SOCKET_OPERATION { /// /// Value: /// 0 /// A /// WinHttpWebSocketSend /// operation. /// WINHTTP_WEB_SOCKET_SEND_OPERATION, /// /// Value: /// 1 /// A /// WinHttpWebSocketReceive /// operation. /// WINHTTP_WEB_SOCKET_RECEIVE_OPERATION, /// /// Value: /// 2 /// A /// WinHttpWebSocketClose /// operation. /// WINHTTP_WEB_SOCKET_CLOSE_OPERATION, /// /// Value: /// 3 /// A /// WinHttpWebSocketShutdown /// operation. /// WINHTTP_WEB_SOCKET_SHUTDOWN_OPERATION, } /// The WinHttpRequestAutoLogonPolicy enumeration includes possible settings for the Automatic Logon Policy. /// /// To set the automatic logon policy, call the SetAutoLogonPolicy method and specify one of the preceding constants. /// /// Note /// For Windows XP and Windows 2000, see the Run-Time Requirements section of the WinHTTP start page. /// /// // https://docs.microsoft.com/en-us/windows/win32/winhttp/winhttprequestautologonpolicy typedef enum WinHttpRequestAutoLogonPolicy { // AutoLogonPolicy_Always = 0, AutoLogonPolicy_OnlyIfBypassProxy = 1, AutoLogonPolicy_Never = 2 } WinHttpRequestAutoLogonPolicy; [PInvokeData("winhttp.h")] public enum WinHttpRequestAutoLogonPolicy { /// An authenticated log on, using the default credentials, is performed for all requests. AutoLogonPolicy_Always, /// /// An authenticated log on, using the default credentials, is performed only for requests on the local intranet. The local /// intranet is considered to be any server on the proxy bypass list in the current proxy configuration. /// AutoLogonPolicy_OnlyIfBypassProxy, /// Authentication is not used automatically. AutoLogonPolicy_Never, } /// /// The WinHttpRequestOption enumeration includes options that can be set or retrieved for the current Microsoft Windows HTTP /// Services (WinHTTP) session. /// /// /// Set an option by specifying one of the preceding constants as the parameter of the Option property. /// /// Note /// For Windows XP and Windows 2000, see the Run-Time Requirements section of the WinHttp start page. /// /// // https://docs.microsoft.com/en-us/windows/win32/winhttp/winhttprequestoption typedef enum WinHttpRequestOption { // WinHttpRequestOption_UserAgentString, WinHttpRequestOption_URL, WinHttpRequestOption_URLCodePage, // WinHttpRequestOption_EscapePercentInURL, WinHttpRequestOption_SslErrorIgnoreFlags, WinHttpRequestOption_SelectCertificate, // WinHttpRequestOption_EnableRedirects, WinHttpRequestOption_UrlEscapeDisable, WinHttpRequestOption_UrlEscapeDisableQuery, // WinHttpRequestOption_SecureProtocols, WinHttpRequestOption_EnableTracing, WinHttpRequestOption_RevertImpersonationOverSsl, // WinHttpRequestOption_EnableHttpsToHttpRedirects, WinHttpRequestOption_EnablePassportAuthentication, // WinHttpRequestOption_MaxAutomaticRedirects, WinHttpRequestOption_MaxResponseHeaderSize, WinHttpRequestOption_MaxResponseDrainSize, // WinHttpRequestOption_EnableHttp1_1, WinHttpRequestOption_EnableCertificateRevocationCheck } WinHttpRequestOption; [PInvokeData("winhttp.h")] public enum WinHttpRequestOption { /// Sets or retrieves a VARIANT that contains the user agent string. WinHttpRequestOption_UserAgentString, /// /// Retrieves a VARIANT that contains the URL of the resource. This value is read-only; you cannot set the URL using this /// property. The URL cannot be read until the Open method is called. This option is useful for checking the URL after the /// Send method is finished to verify that any redirection occurred. /// WinHttpRequestOption_URL, /// /// Sets or retrieves a VARIANT that identifies the code page for the URL string. The default value is the UTF-8 code /// page. The code page is used to convert the Unicode URL string, passed in the Open method, to a single-byte string representation. /// WinHttpRequestOption_URLCodePage, /// /// Sets or retrieves a VARIANT that indicates whether percent characters in the URL string are converted to an escape /// sequence. The default value of this option is VARIANT_TRUE which specifies all unsafe American National Standards /// Institute (ANSI) characters except the percent symbol are converted to an escape sequence. /// WinHttpRequestOption_EscapePercentInURL, /// /// /// Sets or retrieves a VARIANT that indicates which server certificate errors should be ignored. This can be a /// combination of one or more of the following flags. /// /// /// /// Error /// Value /// /// /// Unknown certification authority (CA) or untrusted root /// 0x0100 /// /// /// Wrong usage /// 0x0200 /// /// /// Invalid common name (CN) /// 0x1000 /// /// /// Invalid date or certificate expired /// 0x2000 /// /// /// /// The default value of this option in Version 5.1 of WinHTTP is zero, which results in no errors being ignored. In earlier /// versions of WinHTTP, the default setting was 0x3300, which resulted in all server certificate errors being ignored by default. /// /// WinHttpRequestOption_SslErrorIgnoreFlags, /// /// Sets a VARIANT that specifies the client certificate that is sent to a server for authentication. This option /// indicates the location, certificate store, and subject of a client certificate delimited with backslashes. For more /// information about selecting a client certificate, see SSL in WinHTTP. /// WinHttpRequestOption_SelectCertificate, /// /// Sets or retrieves a VARIANT that indicates whether requests are automatically redirected when the server specifies a /// new location for the resource. The default value of this option is VARIANT_TRUE to indicate that requests are /// automatically redirected. /// WinHttpRequestOption_EnableRedirects, /// /// Sets or retrieves a VARIANT that indicates whether unsafe characters in the path and query components of a URL are /// converted to escape sequences. The default value of this option is VARIANT_TRUE, which specifies that characters in /// the path and query are converted. /// WinHttpRequestOption_UrlEscapeDisable, /// /// Sets or retrieves a VARIANT that indicates whether unsafe characters in the query component of the URL are converted /// to escape sequences. The default value of this option is VARIANT_TRUE, which specifies that characters in the query /// are converted. /// WinHttpRequestOption_UrlEscapeDisableQuery, /// /// /// Sets or retrieves a VARIANT that indicates which secure protocols can be used. This option selects the protocols /// acceptable to the client. The protocol is negotiated during the Secure Sockets Layer (SSL) handshake. This can be a /// combination of one or more of the following flags. /// /// /// /// Protocol /// Value /// /// /// SSL 2.0 /// 0x0008 /// /// /// SSL 3.0 /// 0x0020 /// /// /// Transport Layer Security (TLS) 1.0 /// 0x0080 /// /// /// /// The default value of this option is 0x0028, which indicates that SSL 2.0 or SSL 3.0 can be used. If this option is set to /// zero, the client and server are not able to determine an acceptable security protocol and the next Send results in an error. /// /// WinHttpRequestOption_SecureProtocols, /// /// Sets or retrieves a VARIANT that indicates whether tracing is currently enabled. For more information about the trace /// facility in Microsoft Windows HTTP Services (WinHTTP), see WinHTTP Trace Facility. /// WinHttpRequestOption_EnableTracing, /// /// Controls whether the WinHttpRequest object temporarily reverts client impersonation for the duration of the SSL /// certificate authentication operations. The default setting for the WinHttpRequest object is TRUE. Set this /// option to FALSE to keep impersonation while performing certificate authentication operations. /// WinHttpRequestOption_RevertImpersonationOverSsl, /// /// Controls whether or not WinHTTP allows redirects. By default, all redirects are automatically followed, except those that /// transfer from a secure (https) URL to an non-secure (http) URL. Set this option to TRUE to enable HTTPS to HTTP redirects. /// WinHttpRequestOption_EnableHttpsToHttpRedirects, /// /// Enables or disables support for Passport authentication. By default, automatic support for Passport authentication is /// disabled; set this option to TRUE to enable Passport authentication support. /// WinHttpRequestOption_EnablePassportAuthentication, /// /// /// Sets or retrieves the maximum number of redirects that WinHTTP follows; the default is 10. This limit prevents unauthorized /// sites from making the WinHTTP client stall following a large number of redirects. /// /// Windows XP with SP1 and Windows 2000 with SP3: This enumeration value is not supported. /// WinHttpRequestOption_MaxAutomaticRedirects, /// /// /// Sets or retrieves a bound set on the maximum size of the header portion of the server's response. This bound protects the /// client from a malicious server attempting to stall the client by sending a response with an infinite amount of header data. /// The default value is 64 KB. /// /// Windows XP with SP1 and Windows 2000 with SP3: This enumeration value is not supported. /// WinHttpRequestOption_MaxResponseHeaderSize, /// /// /// Sets or retrieves a bound on the amount of data that will be drained from responses in order to reuse a connection. The /// default is 1 MB. /// /// Windows XP with SP1 and Windows 2000 with SP3: This enumeration value is not supported. /// WinHttpRequestOption_MaxResponseDrainSize, /// /// /// Sets or retrieves a boolean value that indicates whether HTTP/1.1 or HTTP/1.0 should be used. The default is TRUE, so /// that HTTP/1.1 is used by default. /// /// Windows XP with SP1 and Windows 2000 with SP3: This enumeration value is not supported. /// WinHttpRequestOption_EnableHttp1_1, /// /// /// Enables server certificate revocation checking during SSL negotiation. When the server presents a certificate, a check is /// performed to determine whether the certificate has been revoked by its issuer. If the certificate is indeed revoked, or the /// revocation check fails because the Certificate Revocation List (CRL) cannot be downloaded, the request fails; such revocation /// errors cannot be suppressed. /// /// Windows XP with SP1 and Windows 2000 with SP3: This enumeration value is not supported. /// WinHttpRequestOption_EnableCertificateRevocationCheck, } } }