summaryrefslogtreecommitdiff
path: root/it_url.class
diff options
context:
space:
mode:
authorChristian Schneider2011-02-25 17:04:59 +0000
committerChristian Schneider2011-02-25 17:04:59 +0000
commit49370a62c09c1615b422c491d59258b810a5b4a0 (patch)
treefdc607a7c931a4a77278d643970b3ec81d5a263e /it_url.class
parent18d130ab98c55594cc9b01d76292e2be140c5f4e (diff)
downloaditools-49370a62c09c1615b422c491d59258b810a5b4a0.tar.gz
itools-49370a62c09c1615b422c491d59258b810a5b4a0.tar.bz2
itools-49370a62c09c1615b422c491d59258b810a5b4a0.zip
Also consider HTTP headers when calculating cache filename and document headers parameter for get_cache()
Diffstat (limited to 'it_url.class')
-rw-r--r--it_url.class3
1 files changed, 2 insertions, 1 deletions
diff --git a/it_url.class b/it_url.class
index 4c05877..76d9203 100644
--- a/it_url.class
+++ b/it_url.class
@@ -369,7 +369,7 @@ function get_cache_filename($p)
$p = array('url'=>$p);
$p['cachedir'] = it_url::get_cache_dir($p);
- $filename = md5(T_lang() . $p['url']);
+ $filename = md5(T_lang() . $p['url'] . ($p['headers'] ? serialize($p['headers']) : ""));
return $p['cachedir'] . "/" . substr($filename, 0, 2) . "/$filename";
}
@@ -379,6 +379,7 @@ function get_cache_filename($p)
* Store contents of url in a file and return file name. Threadsafe: Provides locking. Called statically.
* Requires webserver writeable directory in $p['cachdedir']. Params in associative array p:
* @param $p['url'] url to get
+ * @param $p['headers'] optional array of HTTP headers to send
* @param $p['cachedir'] directory to store cache files in, @see get_cache_dir
* @param $p['id'] If you need more than one type of cache (e.g. different maxage) you can specify an id
* @param $p['timeout'] timeout in seconds, default 10. fractions allowed