http解析之客服端的实现

大家都很熟悉HTTP协议的应用,因为每天都在网络上浏览着不少东西,也都知道是HTTP协议是相当简单的。每次用thunder之类的下载软件下载网页,当用到那个“用thunder下载全部链接”时总觉得很神

大家都很熟悉HTTP协议的应用,因为每天都在网络上浏览着不少东西,也都 知道是HTTP协议是相当简单的。每次用thunder之类的下载软件下载网页, 当用到那个“用thunder下载全部链接”时总觉得很神奇。 后来想想,其实要实现这些下载功能也并不难,只要按照HTTP协议发送 request,然后对接收到的数据进行分析,如果页面上还有href之类的链接指 向标志就可以进行深一层的下载了。HTTP协议目前用的最多的是11版本,要 . 全面透彻地搞懂它就参考RFC2616文档吧。我是怕rfc文档了的,要看自己去 看吧^_^ 源代码如下: /******* http客户端程序 httpclient.c ************/ stdioh #<.> include stdlibh #<.> include h #<.> includestring systypesh #</.> include sysh #</.> includesocket h #<.> includeerrno unistdh #<.> include netinetinh #</.> include limitsh #<.> include netdbh #<.> include arpaineth #</.> include h #<.> includectype //////////////////////////////httpclient.c 开始 /////////////////////////////////////////// /******************************************** 功能:搜索字符串右边起的第一个匹配字符 ********************************************/ Rstrchr sx *(*,){ charcharchar is =(); int strlen s0 (!(*)); ifreturn si1 si 1x si 1i ([-])((+(-),))(+(-));--; whileifreturnelse strchr 0 ; return } /******************************************** 功能:把字符串转换为全小写 ********************************************/ ToLowerCase s (*){ voidchar ss sss (&&*){*=(*);++;} while tolower

腾讯文库http解析之客服端的实现