Skip to content
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

Closed
wants to merge 8 commits into from
Closed

[RedditBridge] Typo and checking subreddit existence #1345

wants to merge 8 commits into from

Conversation

Leomaradan
Copy link
Contributor

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

Comment on lines +39 to +55
// 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);
}
Copy link
Contributor

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?

@logmanoriginal
Copy link
Contributor

Closing because #1383 brought in the necessary fix for queriedContext. As mentioned before, bridges are not supposed to do curl requests directly. This is part of the core API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants