#36 Add proper support for proxies

Merged
fox merged 3 commits from binfalse/master into fox/master 2 years ago
binfalse commented 2 years ago

There are situations where you want tt-rss to use a proxy (e.g. because of network restrictions or privacy concerns).

tt-rss already comes with an undocumented _CURL_HTTP_PROXY variable (see eg https://binfalse.de/2015/05/06/ttrss-with-proxy/), however that won't have an effect when, for example, php-curl is not installed, see https://git.tt-rss.org/git/tt-rss/src/c30f5e18119d1935e8fe6d422053b127e8f4f1b3/include/functions.php#L377 In this case it would use the file_get_contents with a stream context without a proxy definition: https://git.tt-rss.org/git/tt-rss/src/c30f5e18119d1935e8fe6d422053b127e8f4f1b3/include/functions.php#L487

Here I propose to properly support proxies, and I introduced a PROXY variable, that is respected in both scenarios, with and without curl installed.

There are situations where you want tt-rss to use a proxy (e.g. because of network restrictions or privacy concerns). tt-rss already comes with an undocumented `_CURL_HTTP_PROXY` variable (see eg https://binfalse.de/2015/05/06/ttrss-with-proxy/), however that won't have an effect when, for example, php-curl is not installed, see https://git.tt-rss.org/git/tt-rss/src/c30f5e18119d1935e8fe6d422053b127e8f4f1b3/include/functions.php#L377 In this case it would use the `file_get_contents` with a stream context without a proxy definition: https://git.tt-rss.org/git/tt-rss/src/c30f5e18119d1935e8fe6d422053b127e8f4f1b3/include/functions.php#L487 Here I propose to properly support proxies, and I introduced a `PROXY` variable, that is respected in both scenarios, with and without curl installed.
fox commented 2 years ago
Owner

i would prefer not to officially support proxies because of reasons, but in general i'm not against adding an undocumented/unsupported knob for proxies while not using curl.

your patch looks okay, if you can rework this to use a hidden define i'll merge it. something like _HTTP_PROXY would be good, replacing the old _CURL... one.

i would prefer not to officially support proxies because of reasons, but in general i'm not against adding an undocumented/unsupported knob for proxies while not using curl. your patch looks okay, if you can rework this to use a hidden define i'll merge it. something like _HTTP_PROXY would be good, replacing the old _CURL... one.
binfalse commented 2 years ago
Poster

I removed the documentation from config.php-dist again and switched to _HTTP_PROXY, as you suggested. :)

I removed the documentation from `config.php-dist` again and switched to `_HTTP_PROXY`, as you suggested. :)
fox commented 2 years ago
Owner

thanks!

thanks!
This pull request has been merged successfully!
Sign in to join this conversation.
No Label
No Milestone
No assignee
2 Participants
Loading...
Cancel
Save
There is no content yet.