Content-Transfer-Encoding in file uploading request

后端 未结 2 1002
暖寄归人
暖寄归人 2021-02-09 06:23

I\'m trying to upload file, using XMLHTTPRequest, and sending this headers:

Content-Type:multipart/form-data, boundary=xxxxxxxxx

--xxxxxxxxx
Content-Disposition         


        
相关标签:
2条回答
  • 2021-02-09 06:29

    Xavier's answer doesn't sound right. RFC2616 also has this to say (section 3.7):

    In general, HTTP treats a multipart message-body no differently than
    any other media type: strictly as payload. The one exception is the
    "multipart/byteranges"

    It seems to me that section 19.4 of RFC2616 is talking about HTTP as a whole, in the sense that it uses a syntax similar to MIME (like headers format), but is not MIME-compliant.

    Also, there is RFC2388. In section 3, last paragraph, it says:

    Each part may be encoded and the "content-transfer-encoding" header
    supplied if the value of that part does not conform to the default
    encoding.

    Section 4.3 elaborates on this:

    4.3 Encoding

    While the HTTP protocol can transport arbitrary binary data, the default for mail transport is the 7BIT encoding. The value supplied for a part may need to be encoded and the "content-transfer-encoding" header supplied if the value does not conform to the default encoding. [See section 5 of RFC 2046 for more details.]

    0 讨论(0)
  • 2021-02-09 06:39

    My previous answer was wrong

    Content-Transfer-Encoding may appear in the a composite body

    http://www.ietf.org/rfc/rfc2616.txt

    There are several consequences of this. The entity-body for composite types MAY contain many body-parts, each with its own MIME and HTTP headers (including Content-MD5, Content-Transfer-Encoding, and Content-Encoding headers).

    0 讨论(0)
提交回复
热议问题