-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RedditBridge] Typo and checking subreddit existence #1345
Conversation
… into RedditBridge
// If in CLI mode with no root certificates defined, skip the url verification | ||
if(php_sapi_name() !== 'cli' || !empty(ini_get('curl.cainfo'))) { | ||
// We must test if the subreddit exists before gathering the content | ||
$ch = curl_init(); | ||
curl_setopt($ch, CURLOPT_URL, $url); | ||
curl_setopt($ch, CURLOPT_USERAGENT, ini_get('user_agent')); | ||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | ||
curl_exec($ch); | ||
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); | ||
curl_close($ch); | ||
|
||
if($httpcode !== 403 && $httpcode !== 302) { | ||
$this->collectExpandableDatas($url); | ||
} | ||
} else { | ||
$this->collectExpandableDatas($url); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Referring to your last comment: #1213 (comment)
RSS-Bridge is supposed to return an error if the resource doesn't exist. This is the intended way to let users know that they provided incorrect input data. In either case, a bridge should never circumvent the API. If you think it doesn't work as intended, don't hesitate to open an issue for further discussion.
With the queriedContext
fix from above, my machine correctly responds with
Reddit Bridge was unable to receive or process the
remote website's content!
Error message: `The requested resource cannot be found!
Please make sure your input parameters are correct!
cUrl error: (0)
PHP error: `
Query string: `action=display&bridge=Reddit&context=single&r=react&format=Atom`
Version: `git.master.3bc8c94`
Am I missing something?
Closing because #1383 brought in the necessary fix for |
I made a small typo (
$this->queriedcontext
instead of$this->queriedContext
)I also add a test to verify the HTTP Response from Reddit. This test will prevent the invalidation of the whole feed if any of the subreddit doesn't exists