zoukankan      html  css  js  c++  java
  • HTTP请求响应头信息

    HTTP请求响应头信息

    请求:(request)
        组成部分:
            请求行 请求头 请求体
    请求行:请求信息第一行
            格式:请求方式    访问的资源  协议/版本
            例如:GET  /day0801/1.html  HTTP/1.1
            请求方式:get和post
                get会把参数放在url的后面 post不会
                get参数大小有限制,post请求却没有限制
                get请求没有请求体;post请求有请求体 请求参数放在请求体中
    请求头:请求信息的第二行到空行结束
            格式:    key:value (value可以是多个值)
            常见的请求头:
                Accept: text/html,image/bmp        --支持数据类型    text/html text/css text/javascript 大类型/小类型 mime类型
                Accept-Charset: ISO-8859-1    --字符集
                Accept-Encoding: gzip        --支持压缩
                Accept-Language:zh-cn         --语言环境
                Host: www.itcast.cn:80        --访问主机
                If-Modified-Since: Tue, 11 Jul 2000 18:23:51 GMT      --缓存文件的最后修改时间
                Referer: http://www.itcast.com/index.jsp     --来自哪个页面、防盗链
                User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
                Cookie
                Connection:Keep-Alive       --链接状态

    掌握的头信息:Referer User-Agent Cookie If-Modified-Since

    请求体:空行以下的内容
            只有post才有请求体  get请求参数 http://xxxx?username=tom&password=123
            格式:username=tom&password=123
    响应:(response)
        组成部分:
            响应行 响应头 响应体
    响应行:响应信息的第一行
            格式:协议/版本 状态码 状态码说明
            例如:HTTP/1.1 200 OK
    状态码:
        200 正常响应成功
        302 重定向
        304 读缓存
        404 用户操作资源不存在
        500 服务器内部异常
    响应头:从响应信息的第二行到空行结束
            格式:    key:value(value可以是多个值)
            常见的头
                Location: http://www.it315.org/index.jsp     --跳转方向 和302一起使用的
                  Server:apache tomcat            --服务器型号
                Content-Encoding: gzip             --数据压缩
                Content-Length: 80             --数据长度
                Content-Language: zh-cn         --语言环境
                Content-Type: text/html; charset=GB2312         --数据类型
                Last-Modified: Tue, 11 Jul 2000 18:23:51 GMT    --最后修改时间
                Refresh: 1;url=http://www.it315.org        --定时刷新
                Content-Disposition: attachment; filename=aaa.zip    --下载
                Set-Cookie:SS=Q0=5Lb_nQ; path=/search
                Expires: -1                    --缓存
                Cache-Control: no-cache              --缓存
                Pragma: no-cache                   --缓存
                Connection: Keep-Alive               --连接
            掌握的头信息
                Content-Type Location  Last-Modified Refresh Content-Disposition Set-Cookie
    响应体:空行以下的内容
            页面上展示的内容
  • 相关阅读:
    Intent
    What should we do next in general after collecting relevant data
    NOTE FOR Secure Friend Discovery in Mobile Social Networks
    missing pcap.h
    after building Android Source code
    plot point(one column)
    When talking to someone else, don't infer that is has been talked with others at first. It may bring repulsion to the person who is talking with you.
    进程基本知识
    Python input和raw_input的区别
    强制 code review:reviewboard+svn 的方案
  • 原文地址:https://www.cnblogs.com/hejh/p/10935827.html
Copyright © 2011-2022 走看看