WinHTTP C/C++ API Reference
The following sections contain the C/C++ reference for Microsoft Windows HTTP Services (WinHTTP).
- WinHTTP Interfaces
- WinHTTP Functions
- WinHTTP Callbacks
- WinHTTP Structures
- WinHTTP Enumerations
- WinHTTP Constants
WinHTTP Interfaces
Microsoft Windows HTTP Services (WinHTTP) exposes the following two interfaces:
implements WinHTTP methods that do not involve events.
implements WinHTTP events and event-based methods.
WinHTTP Functions
WinHTTP provides the following functions:
- WinHttpAddRequestHeaders
- Adds one or more HTTP request headers to the HTTP request handle.
- WinHttpCheckPlatform
- Determines whether the current platform is supported by WinHTTP.
- WinHttpCloseHandle
- Closes a single HINTERNET handle.
- WinHttpConnect
- Specifies the initial target server of an HTTP request.
- WinHttpCrackUrl
- Separates a URL into its component parts, for example, host name and path.
- WinHttpCreateUrl
- Creates a URL from component parts, for example, the host name and path.
- WinHttpDetectAutoProxyConfigUrl
- Finds the URL for the Proxy Auto-Configuration (PAC) file. This function reports the URL of the PAC file, but it does not download the file.
- WinHttpGetDefaultProxyConfiguration
- Retrieves the default WinHTTP proxy configuration from the registry.
- WinHTTPGetIEProxyConfigForCurrentUser
- Obtains the Internet Explorer (IE) proxy configuration for the current user.
- WinHttpGetProxyForUrl
- Retrieves the proxy information for the specified URL.
- WinHttpOpen
- Initializes an application's use of the WinHTTP functions.
- WinHttpOpenRequest
- Creates an HTTP request handle.
- WinHttpQueryAuthSchemes
- Returns the authorization schemes that the server supports.
- WinHttpQueryDataAvailable
- Returns the number of bytes of data that are available immediately to be read with WinHttpReadData.
- WinHttpQueryHeaders
- Retrieves header information associated with an HTTP request.
- WinHttpQueryOption
- Queries an Internet option on the specified handle.
- WinHttpReadData
- Reads data from a handle opened by the WinHttpOpenRequest function.
- WinHttpReceiveResponse
- Ends an HTTP request that is initiated by WinHttpSendRequest.
- WinHttpSendRequest
- Sends the specified request to the HTTP server.
- WinHttpSetCredentials
- Passes the required authorization credentials to the server.
- WinHttpSetDefaultProxyConfiguration
- Sets the default WinHTTP proxy configuration in the registry.
- WinHttpSetOption
- Sets an Internet option.
- WinHttpSetStatusCallback
- Sets up a callback function that WinHTTP can call as progress is made during an operation.
- WinHttpSetTimeouts
- Sets the various time-outs that are involved with HTTP transactions.
- WinHttpTimeFromSystemTime
- Formats a date and time according to the HTTP version 1.0 specification.
- WinHttpTimeToSystemTime
- Takes an HTTP time/date string and converts it to a SYSTEMTIME structure.
- WinHttpWriteData
- Writes request data to an HTTP server.
WinHTTP Callbacks
WinHTTP uses the following callback:
WINHTTP_STATUS_CALLBACK Prototype for an application-defined status callback function.
WinHTTP Structures
WinHTTP uses the following structures:
- HTTP_VERSION_INFO
- Contains the global HTTP version.
- URL_COMPONENTS
- Contains the constituent parts of a URL. This structure is used with the WinHttpCrackUrl and WinHttpCreateUrl functions.
- WINHTTP_ASYNC_RESULT
- Contains the result of a call to an asynchronous function. This structure is used with the WINHTTP_STATUS_CALLBACK prototype.
- WINHTTP_AUTOPROXY_OPTIONS
- Used to indicate to the WinHttpGetProxyForURL function whether to specify the URL of the Proxy Auto-Configuration (PAC) file or to automatically locate the URL with DHCP or DNS queries to the network.
- WINHTTP_CERTIFICATE_INFO
- Contains certificate information returned from the server. This structure is used by the WinHttpQueryOption function.
- WINHTTP_CURRENT_USER_IE_PROXY_CONFIG
- Contains the Internet Explorer proxy configuration information.
- WINHTTP_PROXY_INFO
- Contains the session or default proxy configuration.
WinHTTP Enumerations
WinHTTP uses the following enumerations:
- WinHttpRequestAutoLogonPolicy
- Possible settings for the Automatic Logon Policy.
- WinHttpRequestOption
- Options that can be set or retrieved for the current WinHTTP session.
WinHTTP Constants
WinHTTP uses the following constants:
- Error Messages
- These error messages are specific to the WinHTTP functions. These functions also return Windows error messages where appropriate. The value that corresponds to each constant is the value of the constant for the application programming interface (API) functions and the lower 16 bits of the error number for the object.
- HTTP Status Codes
- These constants and corresponding values indicate HTTP status codes returned by servers on the Internet.
- Option Flags
- These option flags are supported by WinHttpQueryOption and WinHttpSetOption. All valid option flags have a value greater than or equal to WINHTTP_FIRST_OPTION and less than or equal to WINHTTP_LAST_OPTION.
- Query Info Flags
- These attributes and modifiers are used by WinHttpQueryHeaders.