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.
views:
184answers:
2
+1
Q:
Why does HTTP::Response::decoded_content sometimes return undef even when content() return data?
+2
A:
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
2010-01-31 23:55:26
+3
A:
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
2010-02-01 03:54:09