开启辅助访问 切换到宽版

精易论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

用微信号发送消息登录论坛

新人指南 邀请好友注册 - 我关注人的新帖 教你赚取精币 - 每日签到


求职/招聘- 论坛接单- 开发者大厅

论坛版规 总版规 - 建议/投诉 - 应聘版主 - 精华帖总集 积分说明 - 禁言标准 - 有奖举报

查看: 3693|回复: 5
收起左侧

[图文教程] Porting WinINet Applications to WinHTTP

[复制链接]

结帖率:60% (3/5)
发表于 2013-1-13 12:07:22 | 显示全部楼层 |阅读模式   广东省揭阳市
5 out of 6 rated this helpful - Rate this topic

Microsoft Windows HTTP Services (WinHTTP) is targeted at middle-tier and back-end server applications that require access to an HTTP client stack. Microsoft Windows Internet (WinINet) provides an HTTP client stack for client applications, as well as access to the File Transfer Protocol (FTP), SOCKSv4, and Gopher protocols. This overview can help determine whether porting your WinINet applications to WinHTTP would be beneficial. It also describes specific conversion requirements.


Things to Consider Before Porting Your WinINet Application

Consider porting your WinINet application to WinHTTP if your application would benefit from:

  • A server-safe HTTP client stack.
  • Minimized stack usage.
  • The scalability of a server application.
  • Fewer dependencies on platform-related APIs.
  • Support for thread impersonation.
  • A service-friendly HTTP stack.
  • Access to the scriptable WinHttpRequest object.

Do not consider porting your WinINet application to WinHTTP if it must support one or more of the following:

  • The FTP or Gopher protocol from the HTTP stack.
  • Support for SOCKSv4 protocol for communicating with SOCKS proxies.
  • Automatic dial-up services.

If you decide to port your application to WinHTTP, the following sections guide you through the conversion process.

For a sample application for both WinINet and WinHTTP, compare the AsyncDemo sample for WinINet with the AsyncDemo sample for WinHTTP.

WinHTTP Equivalents to WinINet Functions

The following table lists WinINet functions related to the HTTP client stack together with the WinHTTP equivalents.

If your application requires WinINet functions that are not listed, do not port your application to WinHTTP.

WinINet functionWinHTTP equivalentNotable changes
HttpAddRequestHeadersWinHttpAddRequestHeadersNone.
HttpEndRequestWinHttpReceiveResponseThe context value is set with WinHttpSendRequestor WinHttpSetOption. Request options are set withWinHttpOpenRequest. WinHttpReceiveResponsemust be called after sending a request.
HttpOpenRequestWinHttpOpenRequestThe context value is set with WinHttpSendRequestor WinHttpSetOption.
HttpQueryInfoWinHttpQueryHeadersNone.
HttpSendRequestWinHttpSendRequestThe context value can be set withWinHttpSendRequest.
HttpSendRequestExWinHttpSendRequestBuffers cannot be provided.
InternetCanonicalizeUrlNo equivalentURLs are now put in canonical form inWinHttpOpenRequest.
InternetCheckConnectionNo equivalentNot implemented in WinHTTP.
InternetCloseHandleWinHttpCloseHandleClosing a parent handle in WinHTTP does not recursively close child handles.
InternetCombineUrlNo equivalentURLs can be assembled with the WinHttpCreateUrlfunction.
InternetConfirmZoneCrossingNo equivalentNot implemented in WinHTTP.
InternetConnectWinHttpConnectThe context value is set with WinHttpSendRequestor WinHttpSetOption. Request options are set withWinHttpOpenRequest. User credentials are set withWinHttpSetCredentials.
InternetCrackUrlWinHttpCrackUrlOpposite behavior of the ICU_ESCAPE flag: withInternetCrackUrl, this flag causes escape sequences (%xx) to be converted to characters, but withWinHttpCrackUrl, it causes characters that must be escaped from in an HTTP request to be converted to escape sequences.
InternetCreateUrlWinHttpCreateUrlNone.
InternetErrorDlgNo equivalentBecause WinHTTP is targeted at server-side applications, it does not implement any user interface.
InternetGetCookieNo equivalentWinHTTP does not persist data between sessions and cannot access WinINet cookies.
InternetOpenWinHttpOpenNone.
InternetOpenUrlWinHttpConnect,WinHttpOpenRequest,WinHttpSendRequest,WinHttpReceiveResponseThis functionality is available in the WinHTTP functions listed.
InternetQueryDataAvailableWinHttpQueryDataAvailableNo reserved parameters.
InternetQueryOptionWinHttpQueryOptionWinHTTP offers a different set of options from WinINet. For more information and options offered by WinHTTP, see Option Flags.
InternetReadFileWinHttpReadDataNone.
InternetReadFileExWinHttpReadDataRather than a structure, the buffer is a region of memory addressed with a pointer.
InternetSetOptionWinHttpSetOptionNone.
InternetSetStatusCallbackWinHttpSetStatusCallbackFor more information, see "Different Handling of Asynchronous Requests" in this topic.
InternetTimeFromSystemTimeWinHttpTimeFromSystemTimeNone.
InternetTimeToSystemTimeWinHttpTimeToSystemTimeNone.
InternetWriteFileWinHttpWriteDataNone.

转自 msdn 有删节




结帖率:89% (8/9)
发表于 2013-9-15 04:23:54 | 显示全部楼层   河南省信阳市
北凡 发表于 2013-1-13 22:25
主要写的是使用WinINet和WinHTTP来进行http访问  WinHTTP和WinINet的调用方法对比 以及移植 异步处理 回 ...

   琢磨了好久WinHttpApi   终于搞懂了
回复 支持 反对

使用道具 举报

结帖率:100% (1/1)
发表于 2013-1-13 22:25:49 | 显示全部楼层   河北省廊坊市
胆小的老虎 发表于 2013-1-13 12:09
哎呀!妈呀 啥玩意

主要写的是使用WinINet和WinHTTP来进行http访问  WinHTTP和WinINet的调用方法对比 以及移植 异步处理 回调对比  认证 安全性   看来是个蛮新鲜的东西 去MSDN看了下 12年10月份更新的

点评

琢磨了好久WinHttpApi 终于搞懂了   河南省信阳市  详情 回复 发表于 2013-9-15 04:23
回复 支持 反对

使用道具 举报

结帖率:95% (36/38)
发表于 2013-1-13 12:27:10 | 显示全部楼层   广东省揭阳市
看芣慬               
回复 支持 反对

使用道具 举报

结帖率:90% (35/39)

签到天数: 21 天

发表于 2013-1-13 12:23:27 | 显示全部楼层   福建省泉州市

VC....
回复 支持 反对

使用道具 举报

结帖率:100% (13/13)

签到天数: 1 天

发表于 2013-1-13 12:09:15 | 显示全部楼层   广东省河源市
哎呀!妈呀 啥玩意
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 致发广告者

发布主题 收藏帖子 返回列表

sitemap| 易语言源码| 易语言教程| 易语言论坛| 易语言模块| 手机版| 广告投放| 精易论坛
拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论,本站内容均为会员发表,并不代表精易立场!
论坛帖子内容仅用于技术交流学习和研究的目的,严禁用于非法目的,否则造成一切后果自负!如帖子内容侵害到你的权益,请联系我们!
防范网络诈骗,远离网络犯罪 违法和不良信息举报电话0663-3422125,QQ: 793400750,邮箱:wp@125.la
Powered by Discuz! X3.4 揭阳市揭东区精易科技有限公司 ( 粤ICP备12094385号-1) 粤公网安备 44522102000125 增值电信业务经营许可证 粤B2-20192173

快速回复 返回顶部 返回列表