http遵循请求(Request)/应答(Response)模型
- http请求
POST /login.php HTTP/1.1 //请求头
HOST:www.xxser.com //请求头
User-Agent:……
//空白行,代表请求头结束
username=admin&password=admin //请求正文(可不需要) - http响应
HTTP/1.1 200 OK //响应行
Data:… //响应头
Server:…
//空白行,代表响应头结束
<html(右括号) //响应正文
……
http请求方法
GET
POST
HEAD
PUT
OPTIONS
注:还有例如WebDAV的通信协议,除上面几个方法外还添加了一些新方法
可直接对Web Server进行读写,并支持文件锁定和解锁,文件复制,文件移动,文件版本控制等
- http状态码
200
302
404
400
401
403
500
503
http消息
由请求头、响应头、普通头和实体头组成
- 请求头
- Host
- User-Agent
- Referer
- Cookie
- Range
- x-forwarded-for
- Accept
- Accept-Charset
- 响应头
- Server
- Set-Cookie
- Last-Modified
- Location
- Refresh
- 普通头
- 实体头
- Content-Type
- Content-Encoding
- Content-Length
- Last-Modified