Jelajahi Sumber

Favicons : test pour améliorer le cache HTTP

Test d'utilisation de PATH_INFO plutôt que QUERY_STRING pour améliorer
la mise en cache.
À tester sur différents serveurs
Alexandre Alapetite 12 tahun lalu
induk
melakukan
2c57e7254d
2 mengubah file dengan 9 tambahan dan 2 penghapusan
  1. 1 1
      app/Models/Feed.php
  2. 8 1
      p/f.php

+ 1 - 1
app/Models/Feed.php

@@ -116,7 +116,7 @@ class FreshRSS_Feed extends Minz_Model {
 		@unlink($path . '.txt');
 	}
 	public function favicon () {
-		return Minz_Url::display ('/f.php?' . $this->hash());
+		return Minz_Url::display ('/f.php/' . $this->hash());
 	}
 
 	public function _id ($value) {

+ 8 - 1
p/f.php

@@ -36,7 +36,14 @@ function download_favicon ($website, $dest) {
 	return true;
 }
 
-$id = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '0';
+if (isset($_SERVER['PATH_INFO'])) {
+	$id = substr($_SERVER['PATH_INFO'], 1);
+} elseif (isset($_SERVER['QUERY_STRING'])) {
+	$id = $_SERVER['QUERY_STRING'];
+} else {
+	$id = '0';
+}
+
 if (!ctype_xdigit($id)) {
 	$id = '0';
 }