I've used LWP capability to handle gzip encoded content as described here, but in some cases I randomly get unexpected results at least for the one website I've tested: $response->decoded_content
could become undefined while $response->content
still returns original gzip encoded response. Tried even without internal charset decoding (decoded_content(charset => 'none')
) with the same result.
Asked
Active
Viewed 2,277 times
1
-
1Look at Accept-Encoding header - may be you set 'br' as acceptable, but LWP can't decode it. – Demiurg Apr 03 '23 at 06:47
-
@Demiurg This was the culprit in my case, thanks for the hint. – zb226 Jul 15 '23 at 12:20
2 Answers
3
Is the server perhaps not properly setting Content-Encoding in the response? In any case, take a look at the headers for both working and non-working responses and look for significant differences.

ysth
- 96,171
- 6
- 121
- 214
3
This doesn't directly answer your question, but when I encounter things like this I look at the source of the module to see what it is doing and debug the code just like any other code. Looking at the decoded_content
method in HTTP::Message
shows you exactly what it is expecting. Check that your response has all of the things it expects.

brian d foy
- 129,424
- 31
- 207
- 592