首页 > Web开发 > 详细

http协议基于socket接口实现

时间:2020-09-10 16:31:29      阅读:67      评论:0      收藏:0      [点我收藏+]

HTTP:REST架构,C/S模式,请求类型:GET、PUT、HEAD、POST。

1、client端发送get包:"GET /pub/WWW/TheProject.html HTTP/1.1\r\nHost: www.w3.org\r\n"

技术分享图片GET /hello.htm HTTP/1.1
技术分享图片Accept: */*
技术分享图片Accept-Language: zh-cn
技术分享图片Accept-Encoding: gzip, deflate
技术分享图片If-Modified-Since: Wed, 17 Oct 2007 02:15:55 GMT
技术分享图片If-None-Match: W/"158-1192587355000"
技术分享图片User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
技术分享图片Host: 192.168.2.162:8080
技术分享图片Connection: Keep-Alive
响应包:
技术分享图片HTTP/1.1 200 OK
技术分享图片ETag: W/"158-1192590101000"
技术分享图片Last-Modified: Wed, 17 Oct 2007 03:01:41 GMT
技术分享图片Content-Type: text/html
技术分享图片Content-Length: 158
技术分享图片Date: Wed, 17 Oct 2007 03:01:59 GMT
技术分享图片Server: Apache-Coyote/1.1/
 
 ------<body>-------
2、client端发送post包:
 POST /form/entry HTTP/1.1
    Host: hackr.jp
    Connection: keep-alive
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 16
    
 name=ueno&age=37
 响应包:
 HTTP/1.1 200 OK
 Date: Tue, 10 Jul 2012 06:20:15 GMT(响应首部字段)
 Content-Length: 362
 Content-Type: text/html
 
 <html>
 ...
3、client端发送head包:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

http协议基于socket接口实现

原文:https://www.cnblogs.com/mumubumu/p/13645619.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!