您的位置:首页 > 理论基础 > 计算机网络

http请求协议

2019-06-12 20:21 1151 查看
http遵循请求(Request)/应答(Response)模型
  1. http请求
    POST /login.php HTTP/1.1 //请求头
    HOST:www.xxser.com //请求头
    User-Agent:……
    //空白行,代表请求头结束
    username=admin&password=admin //请求正文(可不需要)
  2. 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消息

由请求头、响应头、普通头和实体头组成

  1. 请求头
      Host
    • User-Agent
    • Referer
    • Cookie
    • Range
    • x-forwarded-for
    • Accept
    • Accept-Charset
  2. 响应头
      Server
    • Set-Cookie
    • Last-Modified
    • Location
    • Refresh
  3. 普通头
  4. 实体头
      Content-Type
    • Content-Encoding
    • Content-Length
    • Last-Modified
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: