Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This function opens an HTTP request handle.
HINTERNET WINAPI HttpOpenRequest( HINTERNET hConnect , LPCTSTR lpszVerb , LPCTSTR lpszObjectName , LPCTSTR lpszVersion , LPCTSTR lpszReferrer , LPCTSTR * lplpszAcceptTypes , DWORD dwFlags , DWORD dwContext );
Parameters
Value | Description |
---|---|
INTERNET_FLAG_CACHE_IF_NET_FAIL | Return the resource from the cache if the network request for the resource fails due to an ERROR_INTERNET_CONNECTION_RESET or ERROR_INTERNET_CANNOT_CONNECT. |
INTERNET_FLAG_DONT_CACHE | Not supported. Data is never cached. |
INTERNET_FLAG_HYPERLINK | Forces a reload if there was no Expires time and no Last-Modified time returned from the server when determining whether to reload the item from the network. |
INTERNET_FLAG_IGNORE_CERT_CN_INVALID | Disables Win32 Internet function checking of SSL/PCT-based certificates that are returned from the server against the host name given in the request. Win32 Internet functions use a simple check against certificates by comparing for matching host names and simple wildcarding rules. |
INTERNET_FLAG_IGNORE_CERT_DATE_INVALID | Disables Win32 Internet function checking of SSL/PCT-based certificates for proper validity dates. |
INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP | Disables the ability of the Win32 Internet functions to detect this special type of redirect. When this flag is used, Win32 Internet functions transparently allow redirects from HTTPS to HTTP URLs. |
INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS | Disables the ability of the Win32 Internet functions to detect this special type of redirect. When this flag is used, Win32 Internet functions transparently allow redirects from HTTP to HTTPS URLs. |
INTERNET_FLAG_KEEP_CONNECTION | Uses keep-alive semantics, if available, for the connection. This flag is required for Microsoft Network (MSN), NT LAN Manager (NTLM), and other types of authentication. |
INTERNET_FLAG_MAKE_PERSISTENT | Not supported. |
INTERNET_FLAG_MUST_CACHE_REQUEST | Causes a temporary file to be created if the file cannot be cached. Identical to the preferred value INTERNET_FLAG_NEED_FILE. |
INTERNET_FLAG_NEED_FILE | Causes a temporary file to be created if the file cannot be cached. |
INTERNET_FLAG_NO_AUTH | Does not attempt authentication automatically. |
INTERNET_FLAG_NO_AUTO_REDIRECT | Does not automatically handle redirection in HttpSendRequest. |
INTERNET_FLAG_NO_CACHE_WRITE | Does not add the returned entity to the cache. |
INTERNET_FLAG_NO_COOKIES | Does not automatically add cookie headers to requests, and does not automatically add returned cookies to the cookie database. |
INTERNET_FLAG_NO_UI | Disables the cookie dialog box. |
INTERNET_FLAG_PRAGMA_NOCACHE | Forces the request to be resolved by the origin server, even if a cached copy exists on the proxy. |
INTERNET_FLAG_READ_PREFETCH | This flag is currently disabled. |
INTERNET_FLAG_RELOAD | Not supported. Data is always from the wire and caching is not supported. |
INTERNET_FLAG_RESYNCHRONIZE | Reloads HTTP resources if the resource has been modified since the last time it was downloaded. |
INTERNET_FLAG_SECURE | Uses SSL/PCT transaction semantics. |
Return Values
A valid, non-NULL HTTP request handle indicates success. NULL indicates failure. To get extended error information, call GetLastError.
Remarks
HttpOpenRequestcreates a new HTTP request handle and stores the specified parameters in that handle. An HTTP request handle holds a request to be sent to an HTTP server and contains all RFC822/MIME/HTTP headers to be sent as part of the request.
Use the InternetCloseHandlefunction to close the handle returned by HttpOpenRequest. InternetCloseHandlecancels all outstanding I/O on the handle.
The lpszReferrerparameter to InternetOpenis used as the referrer for the HTTP request.
The dwContextparameter allows for progress status callbacks to the application, but all requests will be handled synchronously.
When establishing a Secure Sockets Layer (SSL) or Private Communications Technology, HttpOpenRequestuses the INTERNET_FLAG_SECURE option in addition to all other options.
The following dwFlagsvalues can be used in HttpOpenRequestto ignore invalid certificate errors:
Requirements
Runs on | Versions | Defined in | Include | Link to |
---|---|---|---|---|
Windows CE OS | 2.0 and later | Wininet.h | Wininet.lib |
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
See Also
GetLastError, HttpAddRequestHeaders, HttpQueryInfo, HttpSendRequest, InternetCloseHandle, InternetConnect, InternetOpen, InternetReadFile