HTTP content encoding, base64

淺唱寂寞╮ 提交于 2019-12-10 13:43:29

问题


Is there any way to know if the message body of an HTTP response is encoded with Base64?

I learnt that content-transfer-encoding is not part of HTTP header.

So, which HTTP header indicates that the content is encoded with Base64? I think Content-encoding is only used for compressions.


回答1:


As far as I understand, an HTTP body may not be encoded in Base64:

HTTP does not use the Content-Transfer-Encoding (CTE) field of RFC 2045. Proxies and gateways from MIME-compliant protocols to HTTP MUST remove any non-identity CTE ("quoted-printable" or "base64") encoding prior to delivering the response message to an HTTP client.

Identity being:

The default (identity) encoding; the use of no transformation whatsoever.

Of course you're allowed to transport Base64-encoded data using HTTP, but that should be something both parties (client and server) agree on, and there doesn't seem to be a header to describe this behavior.



来源:https://stackoverflow.com/questions/13265902/http-content-encoding-base64

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!