Accept-Encoding defaults
Bill Moseley <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.lwp |
|---|---|
| Message-ID | <[email protected]> |
HTTP::Message has a decoded_content() method that will attempt
to uncompress based on the Content-Encoding header in the response.
It's wrapped in an eval which will trap exceptions when trying to
require the modules used to uncompress the content.
It would make sense that I would set Accept-Encoding based on if I
have those modules installed.
Since the list of modules (Compress::Zlib and Compress::Bzip2) is
internal to HTTP::Message, would it make sense to provide a method
that could set the Accept-Encoding based on what HTTP::Message uses?
Something like:
$req->set_default_accept_encoding;
I'm not clear if there's a need to also specify a quality for the
encodings in the Accept-Encoding header.
This can't be the default as it would break existing users.
I often notice code that uses $res->content instead of
$res->decoded_content. Most of the time it seems like users really
want the decoded content.
I kind of wonder why $res->content is not decoded by default (and
provide $res->raw_content for those that need it).
--
Bill Moseley
[email protected]
Sent from my iMutt