[译]HTTP标头和源提取工具
By robot-v1.0
本文链接 https://www.kyfws.com/applications/http-header-and-source-extraction-tool-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 3 分钟阅读 - 1319 个词 阅读量 0[译]HTTP标头和源提取工具
原文地址:https://www.codeproject.com/Articles/4542/HTTP-header-and-source-extraction-tool
原文作者:Code4Food
译文由本站 robot-v1.0 翻译
前言
Tool to retrieve the header and source file from a URL.
用于从URL检索标头和源文件的工具.
介绍(Introduction)
我创建此工具是为了帮助简化使用Winsock2直接调用创建Web服务器的新项目.花了几个小时来创建它之后,我意识到我真的不需要这个工具.但是,它使我对从网站上的" GET"语句返回的标题有了更好的理解.为了娱乐,请尝试输入一些您知道的流行网站,然后查看该网站是否返回您觉得很奇怪的东西.例如,键入" www.redhat.com"并使"服务器"行返回" Microsoft/IIS".(I created this tool in order to help facilitate my new project of creating a web server using straight Winsock2 calls. After spending a couple of hours creating it, I realized I really did not need to have this tool. However, it has given me a better understanding of the headers returned from a ‘GET’ statement made to the website. For fun, try entering some popular website you know of and see if it returns anything you find odd. For example, typing in ‘www.redhat.com’ and having the Server line return “Microsoft/IIS”.)
用法(Usage)
在顶部的编辑框中输入URL,然后点击"获取数据"按钮.这将获取您输入的URL中的默认文档以及浏览器看到的标题信息以及服务器返回的内容.该工具对构建Web浏览器(而不是Web服务器)的人很有帮助,但是它确实使您可以很好地查看返回的标头信息.源文件与使用Internet Explorer并转到"查看源代码"所获得的文件相同.(Enter the URL in the top edit box and then hit the ‘Get Data’ button. This will get the default document in the URL you entered and the header information as seen by your browser, and what is returned by the server. This tool would be helpful for someone building a web browser, as opposed to a web server, but it does give you a good view of the header information returned. The source file is the same as you would get from using Internet Explorer and going to “view source”.)
信用(Credit)
- MSDN(MSDN)
- CodeProject的人从这里(CodeProject people from this) 线(thread) ,谁帮我整理了我的(, who helped me sort out my)\ r \ n(\r\n*)*问题(*problems*)
奇数(Oddities)
我最初尝试使用(I initially tried to use the) CHttpFile.Read()
成员函数,但它只想读取4KB数据.我尝试设置缓冲区,但无法读取所有数据以显示在HTML源框中.我不得不使用(member function but it only wanted to read in 4KB of data. I tried setting the buffer but could not get it to read in all the data to display in the HTML source box. I had to use the) ReadString()
相反,并继续将其附加到另一个数据(function instead and keep appending it to another data) CString
.如果有人能为我详细说明这一点,我将不胜感激.(. If anyone can elaborate on this for me, I would be much appreciative.)
未来(Future)
目前,我还没有计划编写此代码,因为我意识到我确实不需要它来编写Web服务器.如果您对如何升级代码有任何建议,对于您将要使用的工具,请告诉我,因为我愿意接受任何建议.(At this time I do not have any plans for this code just because I realized I really did not need it to write a web server. If you have any suggestions on how to upgrade the code, for a tool you would use, please let me know, as I am open to any suggestions.)
历史(History)
- 2003年7月14日-发布文章和代码(1.0版)(07/14/2003 - Released article and code (version 1.0))
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
C++ VC7.0 Windows WinXP MFC Visual-Studio Dev 新闻 翻译