Skip to content

Add curl user-agent to retrieve favicon#1385

Merged
Alkarex merged 6 commits intoFreshRSS:devfrom
Alkarex:favicon-user-agent
Dec 21, 2016
Merged

Add curl user-agent to retrieve favicon#1385
Alkarex merged 6 commits intoFreshRSS:devfrom
Alkarex:favicon-user-agent

Conversation

@Alkarex
Copy link
Copy Markdown
Member

@Alkarex Alkarex commented Nov 28, 2016

@Alkarex Alkarex added this to the 1.7.0 milestone Nov 28, 2016
@Alkarex Alkarex mentioned this pull request Nov 28, 2016
@Alkarex Alkarex changed the title Add curl user-agent to retrive favicon Add curl user-agent to retrieve favicon Nov 28, 2016
curl_setopt($c, CURLOPT_HEADER, false);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
curl_setopt($c, CURLOPT_BINARYTRANSFER, true);
curl_setopt($c, CURLOPT_USERAGENT, 'FreshRSS/' . FRESHRSS_VERSION . ' (' . PHP_OS . '; ' . FRESHRSS_WEBSITE . ')');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably doesn't hurt, but I am against exposing the operating system of the webserver.
Could that line be in the config file to allow users to overwrite the value?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there are some pros and cons. One of the considerations I have is that I see some sites banning some user-agents (e.g. due to abuses) or even IPs, and I hope that having a bit of diversity can help. Same for debugging. It is worth noting that Web browsers also expose the operating system they run on.
But yes, it could indeed be good to make that a constant. There are a couple of different user-agent strings used by FreshRSS, e.g. when going through SimplePie or not.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well my comment was indeed without any background knowledge how FreshRSS handles this in all the other requests. Probably that should be streamlined (and configurable for the future).
Actually I just thought I give a little back to a great open source project by doing a code review ...
I know that browsers spread the useragent information even further (that why I use extensions to switch them) but leaking server side information to other sites is probably not the best idea. Every admin/devop I know (me included) tries to hide every possible information about server-side OS and software versions (like type of webserver, php version and so on).
Just my 2 cents - like in every code review - sharing thoughts is the most important part :)

global $favicons_dir, $default_favicon;

syslog(LOG_DEBUG, 'FreshRSS Favicon discovery GET ' . $website);
syslog(LOG_INFO, 'FreshRSS Favicon discovery GET ' . $website);
Copy link
Copy Markdown
Contributor

@kevinpapst kevinpapst Dec 4, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one could stay debug, as there is already one info log for the same procedure below

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but not with the same address (two distinct requests) :-)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just imagined what happens in your log when you import an OPML with 200+ feeds ;-)
In most cases the favicon will be hosted on the same domain like the feed, so I would say this information is likely redundant - but you are right - these are two different urls. And this action won't happen to often^^

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should indeed improve the logging options. I think it is important to have logs for the outgoing queries.

@Alkarex Alkarex modified the milestones: 1.7.0, 1.6.2 Dec 21, 2016
@Alkarex Alkarex merged commit 7ae60ff into FreshRSS:dev Dec 21, 2016
@Alkarex Alkarex deleted the favicon-user-agent branch December 21, 2016 16:17
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