apc.php / gzdecode rss - #601
Closed
SailorMax wants to merge 1 commit into
Closed
Conversation
decode rss content if it compressed
madmajestro
reviewed
Nov 15, 2025
madmajestro
left a comment
Collaborator
There was a problem hiding this comment.
I'm not a maintainer, but quite familiar with the code.
It doesn't feel right to implement something like this, but since the server seems to ignore the Accept-Encoding: identity header, I don't see a better solution.
If anyone has a better idea / more elegant approach, please let me know.
Closes #600
Comment on lines
+1120
to
+1122
| if ($rss[0] !== '<') { | ||
| $rss = gzdecode($rss); | ||
| } |
Collaborator
There was a problem hiding this comment.
Suggested change
| if ($rss[0] !== '<') { | |
| $rss = gzdecode($rss); | |
| } | |
| if (ord($rss[0]) === 0x1f && ord($rss[1]) === 0x8b) { | |
| $rss = gzdecode($rss); | |
| } |
- I propose to check for the magic numbers 0x1f and 0x8b to identify the data as a gzip stream. Imho, this is more precise and it allows us to pick different decompression algorithms if necessary someday.
- A decompression failure (if gzdecode() returns false) should be handled properly. Perhaps it makes sense to do this a few lines earlier (before line 1115)?
Collaborator
There was a problem hiding this comment.
Agree that it's better to check the magic numbers. (Even better would probably to check for the content-encoding response header.)
Collaborator
|
And just a suggestion to adapt the commit title: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
decode rss content if it compressed