HttpOpenRequest (Windows CE 5.0)

Windows CE 5.0
Send Feedback

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

hConnect
[in] Handle to an HTTP session returned by InternetConnect.
lpszVerb
[in] Long pointer to a null-terminated string that contains the verb to use in the request. If this parameter is NULL, the function uses "GET" as the verb.
lpszObjectName
[in] Long pointer to a null-terminated string that contains the name of the target object of the specified verb. This is generally a file name, an executable module, or a search specifier.
lpszVersion
[in] Long pointer to a null-terminated string that contains the HTTP version. If this parameter is NULL, the function uses "HTTP/1.0" as the version.
lpszReferrer
[in] Long pointer to a null-terminated string that specifies the address (URL) of the document from which the URL in the request (lpszObjectName) was obtained. If this parameter is NULL, no "referrer" is specified.
lplpszAcceptTypes
[in] Long pointer to a null-terminated array of string pointers indicating content types accepted by the client. If this parameter is NULL, no types are accepted by the client. Servers interpret a lack of accept types to indicate that the client accepts only documents of type "text/*" (that is, only text documents, and not pictures or other binary files).
dwFlags
[in] Specifies a bitmask of Internet flags. The following table shows the possible values for this parameter.
ValueDescription
INTERNET_FLAG_CACHE_IF_NET_FAILReturn 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_CACHEDoes not cache the data, either locally or in any gateways. Identical to the preferred value, INTERNET_FLAG_NO_CACHE_WRITE.
INTERNET_FLAG_HYPERLINKForces 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_INVALIDDisables WinInet function checking of SSL/TLS-based certificates that are returned from the server against the host name given in the request. WinInet functions use a simple check against certificates by comparing for matching host names and simple wildcarding rules.
INTERNET_FLAG_IGNORE_CERT_DATE_INVALIDDisables WinInet function checking of SSL/TLS-based certificates for proper validity dates.
INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPDisables the ability of the WinInet functions to detect this special type of redirect. When this flag is used, WinInet functions transparently allow redirects from HTTPS to HTTP URLs.
INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPSDisables the ability of the WinInet functions to detect this special type of redirect. When this flag is used, WinInet functions transparently allow redirects from HTTP to HTTPS URLs.
INTERNET_FLAG_KEEP_CONNECTIONUses 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_PERSISTENTNot supported.
INTERNET_FLAG_MUST_CACHE_REQUESTCauses a temporary file to be created if the file cannot be cached. Identical to the preferred value INTERNET_FLAG_NEED_FILE.
INTERNET_FLAG_NEED_FILECauses a temporary file to be created if the file cannot be cached.
INTERNET_FLAG_NO_AUTHDoes not attempt authentication automatically.
INTERNET_FLAG_NO_AUTO_REDIRECTDoes not automatically handle redirection in HttpSendRequest.
INTERNET_FLAG_NO_CACHE_WRITEDoes not add the returned entity to the cache. If the INTERNET_FLAG_HYPERLINK is also specified, WinInet will create the cache file but will not commit it.
INTERNET_FLAG_NO_COOKIESDoes not automatically add cookie headers to requests, and does not automatically add returned cookies to the cookie database.
INTERNET_FLAG_NO_UIDisables the cookie dialog box.
INTERNET_FLAG_PRAGMA_NOCACHEForces the request to be resolved by the origin server, even if a cached copy exists on the proxy.
INTERNET_FLAG_READ_PREFETCHThis flag is currently disabled.
INTERNET_FLAG_RELOADForces the function to retrieve the requested resource directly from the Internet. The data that is downloaded is stored in the cache.
INTERNET_FLAG_RESYNCHRONIZEReloads HTTP resources if the resource has been modified since the last time it was downloaded.
INTERNET_FLAG_SECUREUses SSL/TLS transaction semantics.
dwContext
[in] Specifies the application-defined value that associates this operation with any application data.

Return Values

A valid, non-NULL HTTP request handle indicates success. NULL indicates failure. To get extended error information, call GetLastError.

Remarks

This function creates 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 InternetCloseHandle function to close the handle returned by HttpOpenRequest. InternetCloseHandle cancels all outstanding I/O on the handle.

The lpszReferrer parameter to InternetOpen is used as the referrer for the HTTP request.

The dwContext parameter allows for progress status callbacks to the application, but all requests will be handled synchronously.

When establishing a Secure Sockets Layer (SSL) or Transport Layer Security (TLS), HttpOpenRequest uses the INTERNET_FLAG_SECURE option in addition to all other options.

The following table shows the dwFlags values that can be used in this function to ignore invalid certificate errors.

ValueDescription
INTERNET_FLAG_IGNORE_CERT_CN_INVALIDIgnores errors caused when the certificate host name of the server does not match the host name in the request.
INTERNET_FLAG_IGNORE_CERT_DATE_INVALIDIgnores errors caused by an expired server certificate.

Requirements

OS Versions: Windows CE 2.0 and later.
Header: Wininet.h.
Link Library: Wininet.lib.

See Also

HttpAddRequestHeaders | HttpQueryInfo | HttpSendRequest | InternetCloseHandle | InternetConnect | InternetOpen | InternetReadFile | WinInet Functions


Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.


Show: