fix(subscriber): keep the POST body across the http to https redirect - #9
Merged
Merged
Conversation
rssCloud endpoints are usually advertised as `http` in the `<cloud>` element and answer with a permanent redirect to `https`. libcurl's default on 301/302/303 is to follow that as a bodyless GET, exactly as `curl -L` does, so the server received no `url1` and answered `No feed for url1.` — which is what made many servers show as permanently failed in the admin screen. On FreshRSS 1.29.0 and 1.29.1 this is the whole story: `httpGet()` sets `CURLOPT_FOLLOWLOCATION` and lets libcurl follow the redirect, so the body was always lost. Development builds follow redirects by hand and happen to preserve it, which is why the bug does not reproduce when tested against `edge` — and why the option below looks redundant there. Set `CURLOPT_POSTREDIR` so the POST survives the redirect, and extract the option assembly into `notifyCurlOptions()` so the behaviour can be pinned by a test rather than rediscovered. Verified against a redirecting echo server: without the option the request arrives as a GET with an empty body; with it, `url1` arrives intact. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
📝 WalkthroughWalkthrough
ChangesNotification redirect handling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Fixes the
Failed No feed for url1.errors showing against many rssCloud servers in the admin screen.Cause
The redirect, not the payload.
rssCloud endpoints are usually advertised as
httpin the<cloud>element and answer with a permanent redirect tohttps. libcurl's default on 301/302/303 is to follow it as a bodyless GET — exactly whatcurl -Ldoes. The server then sees nourl1and says so.On FreshRSS 1.29.0 and 1.29.1 this is the whole story:
httpGet()setsCURLOPT_FOLLOWLOCATIONand hands the following to libcurl, so the body was always lost. SettingCURLOPT_POSTREDIRkeeps the POST intact.Verified against a redirecting echo server:
url1+ CURLOPT_POSTREDIRA note for reviewers
This option looks redundant on
main/edgedevelopment builds, which follow redirects by hand and incidentally preserve the body. It is not — deleting it breaks every released version. The docblock says so at the call site, and a test pins it, because this is exactly the line someone removes during a cleanup.The option assembly moved into
notifyCurlOptions()purely so the behaviour is reachable from a test; there is no behaviour change beyondCURLOPT_POSTREDIR.Testing
php -lclean.Redirects.php:155, confirmed present with these changes stashed. It is themethod_exists()version-compat check, which reads as always-true only because phpstan analyses againstedge; it is load-bearing on 1.29.x.Known limitation, unrelated to this PR
WordPress.com's rssCloud cannot notify an https callback at all, and the protocol fallback merged in #8 does not rescue it:
https-postis rejected outright (Only http-post notifications are supported at this time.).http-postdoes not change the callback'sport, which is still443. WordPress.com then attemptshttp://example.com:443/path— plain HTTP against the TLS port — which fails with a different error.So a FreshRSS instance served over https cannot register with WordPress.com until the fix lands upstream there. Noted so the remaining failures are not mistaken for the bug this PR fixes.
🤖 Generated with Claude Code