Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
As specified in the HTTP protocol (RFC 2616) applications can request that the server return HTTP responses in encoded format. Prior to Windows Server 2008 and Windows Vista, requests with content encoding were sent to the application for processing at their level. Starting in Windows Server 2008 and Windows Vista, the application can direct WinINet to perform content decoding for the gzip and deflate content encoding schemes.
To enable content decoding, the application sets the decoding option requesting that WinINet perform decoding on their behalf. However, enabling decoding does not guarantee that WinINet will perform content decoding, and the application should be prepared to handle decoding. WinINet strips the content-encoding header from the response when content decoding is successfully performed. Applications are expected to handle content decoding regardless of whether the decoding option is enabled or disabled when the content-encoding header is present in the response.
When decoding is enabled, the application must specify the list of supported encodings in the Accept-Encoding header of the request. The Accept-Encoding header, however, does not obligate the server to send an encoded response. WinINet will send responses that do not match the list of acceptable encodings back to the application.
The following list describes the conditions under which WinINet will perform content decoding when the option is enabled:
The decoding option can be set on the session handle, the request handle or the connection handle. The handle on which the decoding option is set, defines the scope of the decoding option. For example, setting decoding on the session will enable decoding an all connections and requests created under that handle.
To set the decoding option, the application calls InternetSetOption with the handle returned from InternetOpen, InternetConnect, or HttpOpenRequest. The INTERNET_OPTION_HTTP_DECODING option is specified in the dwOption parameter, and the lpBuffer parameter points to a boolean variable set to true. To disable decoding, the application calls InternetSetOption with the INTERNET_OPTION_HTTP_DECODING option and the boolean variable set to false.
When the decoding option is set, WinINet performs decoding on the request when the application calls InternetReadFile. If WinINet encounters an error while performing content decoding, the call to InternetReadFile fails with an ERROR_INTERNET_DECODING_FAILED. When decoding fails, the application has two options: it can remove the Accept-Encoding header and resend the request, or it can set the INTERNET_OPTION_HTTP_DECODING option on the request to false and then resend the request. If the decoding option is set to false, the application must check the Content-Encoding header and perform any decoding at the application level.
Note
WinINet does not support server implementations. In addition, it should not be used from a service. For server implementations or services use Microsoft Windows HTTP Services (WinHTTP).
Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!