Document how other user agents handle empty "compressed" responses

This commit is contained in:
Jan Verbeek 2025-03-09 13:26:51 +01:00
parent 6bc87b3974
commit 4dc314b920

View File

@ -60,8 +60,11 @@ pub fn get_compression_type(headers: &HeaderMap) -> Option<CompressionType> {
/// of an empty input. This is behavior we inherited from HTTPie.
///
/// It's load-bearing in the case of HEAD requests, where responses don't have a
/// body but may declare a Content-Encoding. We also treat other requests like this,
/// perhaps unwisely.
/// body but may declare a Content-Encoding.
///
/// We also treat other empty response bodies like this, regardless of the request
/// method. This matches all the user agents I tried (reqwest, requests/HTTPie, curl,
/// wget, Firefox, Chromium) but I don't know if it's prescribed by any RFC.
///
/// As a side benefit we make I/O errors more focused by stripping decoding errors.
///