PURGE other hostnames
This commit is contained in:
parent
41c2b29a55
commit
d4aff84741
@ -665,6 +665,7 @@
|
||||
// you can configure Tinyboard to PURGE files when they're written to
|
||||
//$config['purge'] = Array(
|
||||
// Array('127.0.0.1', 80)
|
||||
// Array('127.0.0.1', 80, 'example.org')
|
||||
//);
|
||||
// Connection timeout, in seconds
|
||||
$config['purge_timeout'] = 3;
|
||||
|
@ -221,11 +221,13 @@
|
||||
function purge($uri) {
|
||||
global $config;
|
||||
$uri = (str_replace('\\', '/', dirname($_SERVER['REQUEST_URI'])) == '/' ? '/' : str_replace('\\', '/', dirname($_SERVER['REQUEST_URI'])) . '/') . $uri;
|
||||
$request = "PURGE {$uri} HTTP/1.0\r\nHost: {$_SERVER['HTTP_HOST']}\r\nUser-Agent: Tinyboard\r\nConnection: Close\r\n\r\n";
|
||||
|
||||
|
||||
foreach($config['purge'] as &$purge) {
|
||||
$host = $purge[0];
|
||||
$port = $purge[1];
|
||||
$http_host = isset($purge[2]) ? $purge[2] : $_SERVER['HTTP_HOST'];
|
||||
$request = "PURGE {$uri} HTTP/1.0\r\nHost: {$http_host}\r\nUser-Agent: Tinyboard\r\nConnection: Close\r\n\r\n";
|
||||
if($fp = fsockopen($host, $port, $errno, $errstr, $config['purge_timeout'])) {
|
||||
fwrite($fp, $request);
|
||||
fclose($fp);
|
||||
|
Loading…
Reference in New Issue
Block a user