zoukankan      html  css  js  c++  java
  • http请求的post提交数据的四种格式form-data,row,binary,urlencode

    https://www.cnblogs.com/softidea/p/5745369.html

    我们知道,HTTP 协议是以 ASCII 码传输,建立在 TCP/IP 协议之上的应用层规范。
    规范把 HTTP 请求分为三个部分:状态行、请求头、消息主体。类似于下面这样:

    BASH<method> <request-URL> <version>           状态行
    <headers>                                                                 请求头
    
    <entity-body>                                                           消息主体

    HTTP 1.1协议规定post提交的数据必须放在消息主体内 ,但协议没有规定数据必须使用什么编码方式,只要最后发送的http请求满足上面的格式就可以。

    客户端通过 enctype 属性规定在发送到服务器之前应该如何对表单数据进行编码。若没有设置enctype属性值,则enctype属性默认值为application/x-www-form-urlencoded
    application/x-www-form-urlencoded 在发送前编码所有字符(默认)
    multipart/form-data

    不对字符编码。

    在使用包含文件上传控件的表单时,必须使用该值。

    text/plain 空格转换为 "+" 加号,但不对特殊字符编码。







    服务端通过headers中的Content-Type来判断消息主体中的内容使用来什么编码。

    当content-type的值为 application/x-www-form-urlencoded 时
  • 相关阅读:
    Car HDU
    Defeat the Enemy UVALive
    Alice and Bob HDU
    Gone Fishing POJ
    Radar Installation POJ
    Supermarket POJ
    Moo Volume POJ
    Text Document Analysis CodeForces
    checkbox全选与反选

  • 原文地址:https://www.cnblogs.com/Ting-light/p/13094192.html
Copyright © 2011-2022 走看看