Explorar el Código

Remove SimplePie name from HTTP User-Agent string

https://github.com/FreshRSS/FreshRSS/issues/1622#issuecomment-334928486
https://github.com/FreshRSS/FreshRSS/issues/1627
https://github.com/FreshRSS/FreshRSS/issues/1607
Alexandre Alapetite hace 8 años
padre
commit
4058ff3ff4
Se han modificado 5 ficheros con 10 adiciones y 6 borrados
  1. 5 3
      CHANGELOG.md
  2. 1 1
      app/Models/Feed.php
  3. 2 0
      constants.php
  4. 1 1
      lib/favicons.php
  5. 1 1
      lib/lib_rss.php

+ 5 - 3
CHANGELOG.md

@@ -2,13 +2,15 @@
 
 ## 2017-1X-XX FreshRSS 1.8.1-dev
 
+* SimplePie
+	* Remove "SimplePie" name from HTTP User-Agent string [#1656](https://github.com/FreshRSS/FreshRSS/pull/1656)
 * Misc.
 	* Travis translation validation tool [#1653](https://github.com/FreshRSS/FreshRSS/pull/1653)
 
 
 ## 2017-10-01 FreshRSS 1.8.0
 
-* Compatibility:
+* Compatibility
 	* Minimal PHP version increased to PHP 5.3.8+ to fix sanitize bug [#1604](https://github.com/FreshRSS/FreshRSS/issues/1604)
 	* Add support for PHP 7.1 in the API [#1584](https://github.com/FreshRSS/FreshRSS/issues/1584), [#1594](https://github.com/FreshRSS/FreshRSS/pull/1594)
 * UI
@@ -36,7 +38,7 @@
 
 ## 2017-06-03 FreshRSS 1.7.0
 
-* Features:
+* Features
 	* Deferred insertion of new articles, for better chronological order [#530](https://github.com/FreshRSS/FreshRSS/issues/530)
 	* Better search:
 		* Possibility to use multiple `intitle:`, `inurl:`, `author:` [#1478](https://github.com/FreshRSS/FreshRSS/pull/1478)
@@ -44,7 +46,7 @@
 			* Examples: `!intitle:unwanted`, `-intitle:unwanted`, `-inurl:unwanted`, `-author:unwanted`, `-#unwanted`, `-unwanted`
 		* Allow double-quotes, such as `author:"some name"`, in addition to single-quotes such as `author:'some name'` [#1478](https://github.com/FreshRSS/FreshRSS/pull/1478)
 	* Multi-user tokens (to access RSS outputs of any user) [#1390](https://github.com/FreshRSS/FreshRSS/issues/1390)
-* Compatibility:
+* Compatibility
 	* Add support for PHP 7.1 [#1471](https://github.com/FreshRSS/FreshRSS/issues/1471)
 	* PostgreSQL is not experimental anymore [#1476](https://github.com/FreshRSS/FreshRSS/pull/1476)
 * Bug fixing

+ 1 - 1
app/Models/Feed.php

@@ -484,7 +484,7 @@ class FreshRSS_Feed extends Minz_Model {
 				CURLOPT_URL => $hubJson['hub'],
 				CURLOPT_FOLLOWLOCATION => true,
 				CURLOPT_RETURNTRANSFER => true,
-				CURLOPT_USERAGENT => 'FreshRSS/' . FRESHRSS_VERSION . ' (' . PHP_OS . '; ' . FRESHRSS_WEBSITE . ')',
+				CURLOPT_USERAGENT => FRESHRSS_USERAGENT,
 				CURLOPT_POSTFIELDS => http_build_query(array(
 					'hub.verify' => 'sync',
 					'hub.mode' => $state ? 'subscribe' : 'unsubscribe',

+ 2 - 0
constants.php

@@ -3,6 +3,8 @@ define('FRESHRSS_VERSION', '1.8.1-dev');
 define('FRESHRSS_WEBSITE', 'https://freshrss.org');
 define('FRESHRSS_WIKI', 'https://freshrss.github.io/FreshRSS/');
 
+define('FRESHRSS_USERAGENT', 'FreshRSS/' . FRESHRSS_VERSION . ' (' . PHP_OS . '; ' . FRESHRSS_WEBSITE . ')');
+
 // PHP text output compression http://php.net/ob_gzhandler (better to do it at Web server level)
 define('PHP_COMPRESSION', false);
 

+ 1 - 1
lib/favicons.php

@@ -35,7 +35,7 @@ function downloadHttp(&$url, $curlOptions = array()) {
 			CURLOPT_MAXREDIRS => 10,
 			CURLOPT_RETURNTRANSFER => true,
 			CURLOPT_TIMEOUT => 15,
-			CURLOPT_USERAGENT => 'FreshRSS/' . FRESHRSS_VERSION . ' (' . PHP_OS . '; ' . FRESHRSS_WEBSITE . ')',
+			CURLOPT_USERAGENT => FRESHRSS_USERAGENT,
 		));
 	if (defined('CURLOPT_ENCODING')) {
 		curl_setopt($ch, CURLOPT_ENCODING, '');	//Enable all encodings

+ 1 - 1
lib/lib_rss.php

@@ -174,7 +174,7 @@ function customSimplePie() {
 	$system_conf = Minz_Configuration::get('system');
 	$limits = $system_conf->limits;
 	$simplePie = new SimplePie();
-	$simplePie->set_useragent('FreshRSS/' . FRESHRSS_VERSION . ' (' . PHP_OS . '; ' . FRESHRSS_WEBSITE . ') ' . SIMPLEPIE_NAME . '/' . SIMPLEPIE_VERSION);
+	$simplePie->set_useragent(FRESHRSS_USERAGENT);
 	$simplePie->set_syslog($system_conf->simplepie_syslog_enabled);
 	$simplePie->set_cache_location(CACHE_PATH);
 	$simplePie->set_cache_duration($limits['cache_duration']);