summaryrefslogtreecommitdiff
path: root/it_url.class
diff options
context:
space:
mode:
authorChristian Helbling2016-01-08 14:40:41 +0100
committerChristian Helbling2016-01-08 14:40:41 +0100
commitf7abbe808fcbe761f869e116e499f0e8fe8d631b (patch)
treeca5f21bc5fde418090cf05cd331ba6f69d9d80c1 /it_url.class
parent5af90e3f1f13a964e950e4379492b68c2d8f2487 (diff)
parent7c4ad5b54006acc27b6dc22d3d746d15a2d14520 (diff)
downloaditools-f7abbe808fcbe761f869e116e499f0e8fe8d631b.tar.gz
itools-f7abbe808fcbe761f869e116e499f0e8fe8d631b.tar.bz2
itools-f7abbe808fcbe761f869e116e499f0e8fe8d631b.zip
Merge branch 'master' into cs/php7
Diffstat (limited to 'it_url.class')
-rw-r--r--it_url.class6
1 files changed, 3 insertions, 3 deletions
diff --git a/it_url.class b/it_url.class
index fb5a1ff..ab1f90f 100644
--- a/it_url.class
+++ b/it_url.class
@@ -529,10 +529,10 @@ 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['id'] RECOMMENDED: If you need more than one type of cache (e.g. different maxage) you should specify an id
* @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
* @param $p['maxage'] maximum age of cache entries in seconds, default 86400
* @param $p['cleanbefore'] maximum daytime when attempting cleanup, default 7200
@@ -793,8 +793,8 @@ static function absolute($url=null)
function redirect($url = null, $type = "temporary")
{
$codes = array('permanent' => 301, 'temporary' => 303); # NOTE: HTTP 303 is called "See Other", rather than Temporary (which would be HTTP 307), but is the behaviour one usually wants for temporary redirects
- if (!($code = $codes[$type]))
- it::fatal("Invalid redirect type '$type', must be 'permanent' or 'temporary'");
+ if (!($code = $codes[$type]) || !$url)
+ it::fatal("invalid redirect type or missing redirect url");
$url = preg_replace("/[\r\n].*/", '', it_url::absolute($url)); # Security: cut after CR/LF