Share via


HttpOpenRequest (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.
    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 Does not cache the data, either locally or in any gateways. Identical to the preferred value, INTERNET_FLAG_NO_CACHE_WRITE.
    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 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_INVALID Disables WinInet function checking of SSL/TLS-based certificates for proper validity dates.
    INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP Disables 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_HTTPS Disables 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_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. If the INTERNET_FLAG_HYPERLINK is also specified, WinInet will create the cache file but will not commit it.
    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 Forces the function to retrieve the requested resource directly from the Internet. The data that is downloaded is stored in the cache.
    INTERNET_FLAG_RESYNCHRONIZE Reloads HTTP resources if the resource has been modified since the last time it was downloaded.
    INTERNET_FLAG_SECURE Uses 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.

Value Description
INTERNET_FLAG_IGNORE_CERT_CN_INVALID Ignores errors caused when the certificate host name of the server does not match the host name in the request.
INTERNET_FLAG_IGNORE_CERT_DATE_INVALID Ignores 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.