libwww-perl / libwww-perl/HTTP-Message
decoded_content fails to gunzip content if encountering unexpected end of file
Nobody has claimed this yet.
- Dominant language
- Perl
- Stars
- 32
- Forks
- 63
- Avg merge
- 5h 14m
- Merged PRs (30d)
- 1
Description
If the server doesn't send the last chunk which contains the gzip footer, the response fails to decode. All major browsers can handle this case fine and properly gunzip the content.
When tracking this down I found the response was a 200 OK, but LWP added this header:
x-died => "EOF when chunk header expected at .../5.20/lib/site_perl/5.20.0/Net/HTTP/Methods.pm line 525.",
And decoded_content was returning undef. When I added the raise_error option, I saw the error:
Can't gunzip content: unexpected end of file at .../lib/site_perl/5.20.0/HTTP/Message.pm line 299.
This should not cause a failure. And there does not appear to be anyway for end users to work around this without having to monkeypatch IO::Uncompress::Gunzip::gunzip.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in HTTP/Message.pm around line 299, then inspect how decoded_content handles IO::Uncompress::Gunzip::gunzip errors and the reported x-died response condition. Reproduce a response missing its gzip footer and verify that decoded_content no longer fails while normal gzip decoding remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- perl
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100