HTTP 内容编码,base64 [英] HTTP content encoding, base64

查看:47
本文介绍了HTTP 内容编码,base64的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法知道 HTTP 响应的消息体是否使用 Base64 编码?

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

我了解到内容传输编码不是 HTTP 标头的一部分.

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

那么,哪个 HTTP 标头表明内容是使用 Base64 编码的?我认为内容编码仅用于压缩.

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

推荐答案

据我了解,一个 HTTP 正文可能没有用 Base64 编码:

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

HTTP 不使用 RFC 的 Content-Transfer-Encoding (CTE) 字段2045. 从符合 MIME 的协议到 HTTP 的代理和网关必须删除任何非身份 CTE(quoted-printable"或base64")编码在将响应消息传递给 HTTP 客户端之前.

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.

身份:

默认(身份)编码;使用无转换无论如何.

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

当然,您可以使用 HTTP 传输 Base64 编码的数据,但这应该是双方(客户端和服务器)都同意的,而且似乎没有标题来描述这种行为.

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.

这篇关于HTTP 内容编码,base64的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆