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

[TwitterBridge] Enable cookies with curl #1245

Merged
merged 2 commits into from
Sep 12, 2019
Merged

[TwitterBridge] Enable cookies with curl #1245

merged 2 commits into from
Sep 12, 2019

Conversation

triatic
Copy link
Contributor

@triatic triatic commented Jul 30, 2019

Enable cookies in curl, or fall back to file_get_contents if in CLI mode with no curl root certificates.

Fixes issues on some installations where allow_url_fopen is disabled. #1231

Credit @Roliga for curl method.

Enable cookies in curl, or fall back to `file_get_contents` if in CLI mode with no curl root certificates.
@teromene
Copy link
Member

teromene commented Sep 7, 2019

This really seems like a workaround that we can't use everywhere...
Maybe we could check that the curl.cainfo setting is set during "Installation"

@triatic
Copy link
Contributor Author

triatic commented Sep 7, 2019

I'm not sure I understand your point. This PR is purely about enabling cookies with cURL for for TwitterBridge so that file_get_contents() can be avoided, since some people have allow_url_fopen disabled.

@teromene
Copy link
Member

I guess my question was more: Why do we still have file_get_contents in cli while we no longer use it in web mode ?

@triatic
Copy link
Contributor Author

triatic commented Sep 11, 2019

For my particular use-case which might be shared by others. Unlike file_get_contents(), the cUrl module does not use the OS's root certificate store.

I'm not sure how Linux handles things, but on Windows this means downloading cacert.pem from https://curl.haxx.se/docs/caextract.html and keeping it up to date.

Personally I'd much rather use the root certificates which Windows automatically keeps up to date, which is what file_get_contents() does, rather than download and keep updating an arbitrary certificate store from haxx.se.

I added this in PR #962 which @logmanoriginal merged.

@teromene
Copy link
Member

All right. Though I believe that we should, later, remove entirely the dependency to file_get_contents in getCookie (same in FB2Bridge) so that we don't need this type of workaround.

@teromene teromene merged commit 50c971d into RSS-Bridge:master Sep 12, 2019
@triatic
Copy link
Contributor Author

triatic commented Sep 12, 2019

I would like file_get_contents() support to remain for the condition:

if(php_sapi_name() === 'cli' && empty(ini_get('curl.cainfo')))

I don't even have the cUrl module enabled at the moment and everything works fine, including certificate verification.

As for FB2Bridge, how about reusing the code from this PR, so that file_get_contents() is only used in rare circumstances?

@triatic
Copy link
Contributor Author

triatic commented Sep 13, 2019

On further testing, it seems it's only Windows which the cUrl module is unable to use the system's root certificates.

Another proposal is to leave Linux alone and do:

if(strpos(php_uname(), 'Windows') === 0 && empty(ini_get('curl.cainfo')))

infominer33 pushed a commit to web-work-tools/rss-bridge that referenced this pull request Apr 17, 2020
* [TwitterBridge] Enable cookies with curl

Enable cookies in curl, or fall back to `file_get_contents` if in CLI mode with no curl root certificates.
@triatic triatic deleted the patch-6 branch April 21, 2020 01:07
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.

None yet

2 participants