sspmod_metarefresh_MetaLoader::createContext PHP Method

createContext() private method

Create HTTP context, with any available caches taken into account
private createContext ( $source )
    private function createContext($source)
    {
        $context = NULL;
        $config = SimpleSAML_Configuration::getInstance();
        $name = $config->getString('technicalcontact_name', NULL);
        $mail = $config->getString('technicalcontact_email', NULL);
        $rawheader = "User-Agent: SimpleSAMLphp metarefresh, run by {$name} <{$mail}>\r\n";
        if (isset($source['conditionalGET']) && $source['conditionalGET']) {
            if (array_key_exists($source['src'], $this->state)) {
                $sourceState = $this->state[$source['src']];
                if (isset($sourceState['last-modified'])) {
                    $rawheader .= 'If-Modified-Since: ' . $sourceState['last-modified'] . "\r\n";
                }
                if (isset($sourceState['etag'])) {
                    $rawheader .= 'If-None-Match: ' . $sourceState['etag'] . "\r\n";
                }
            }
        }
        return array('http' => array('header' => $rawheader));
    }