HTTP content encoding, base64

2019-06-19 01:40发布

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条回答
ゆ 、 Hurt°
2楼-- · 2019-06-19 02:17

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.

查看更多
登录 后发表回答