WinHTTP解压缩功能? [英] WinHTTP Decompression function?

查看:160
本文介绍了WinHTTP解压缩功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我在c ++中使用winhttp api从服务器获取数据。服务器可以支持各种压缩格式。所以目前我想用winhttp获取压缩格式(例如gzip)并解压缩。是否可以使用winhttp解压缩数据?

Presently I am using winhttp api in c++ to get data from a server. The server can support various compression formats. So presently I want to use winhttp to get the compressed format (eg gzip) and decompress it. Is it possible to decompress the data using winhttp?

推荐答案

当然可以。

来自此处


要设置解码选项,应用程序使用从InternetOpen,InternetConnect或InternetConnect返回的句柄调用InternetSetOption

HttpOpenRequest。 INTERNET_OPTION_HTTP_DECODING选项在dwOption参数中指定为
,lpBuffer参数指向设置为true的
布尔变量。要禁用解码,应用程序
使用INTERNET_OPTION_HTTP_DECODING选项
调用InternetSetOption,并将布尔变量设置为false。

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.

因此,http压缩是用户代码的转换,您只需要一次调用 InternetSetOption ,您的流量就会被压缩。

So http compression is transprent for user code, you just need one call to InternetSetOption and your traffic will be compressed.

这篇关于WinHTTP解压缩功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆