aboutsummaryrefslogblamecommitdiffstats
path: root/Zotlabs/Module/Sslify.php
blob: 9dd5c4a0b2cc25c36f234560ab1ab901ebc645ea (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11










                                                        



                                                                
                                                                                           
                                                           
                         

                                                                    
                                                                                 
                                                                     
                                                                                   
                                                                     
                                                                                   
                                                               
                                                                       
 
 



                                        
         
 
<?php
namespace Zotlabs\Module;


class Sslify extends \Zotlabs\Web\Controller {

	function init() {
		$x = z_fetch_url($_REQUEST['url']);
		if($x['success']) {
			$h = explode("\n",$x['header']);
			foreach ($h as $l) {
				if (strpos($l, ':') === false) {
					continue;
				}

				list($k,$v) = array_map("trim", explode(":", trim($l), 2));
				$hdrs[strtolower($k)] = $v;
			}

			if (array_key_exists('content-type', $hdrs))
				header('Content-Type: ' . $hdrs['content-type']);
			if (array_key_exists('last-modified', $hdrs))
				header('Last-Modified: ' . $hdrs['last-modified']);
			if (array_key_exists('cache-control', $hdrs))
				header('Cache-Control: ' . $hdrs['cache-control']);
			if (array_key_exists('expires', $hdrs))
				header('Expires: ' . $hdrs['expires']);


			echo $x['body'];
			killme();
		}
		killme();
	}
}