Exemplo n.º 1
0
Arquivo: HTTP.php Projeto: techart/tao
 public function __construct($file, $cache = false, $cache_lifetime = Net_HTTP::DEFAULT_CACHE_LIFETIME)
 {
     parent::__construct();
     $this->file = IO_FS::File($file);
     $this->cache = $cache;
     $this->cache_lifetime = $cache_lifetime;
     $this->setup();
 }
Exemplo n.º 2
0
 /**
  * @param Net_HTTP_Response $response
  *
  * @return Net_HTTP_Response
  */
 public function dump(Net_HTTP_Response $response)
 {
     $response->header('X-Wf-Protocol-1', 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2')->header('X-Wf-1-Plugin-1', 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3')->header('X-Wf-1-Structure-1', 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1');
     $response->headers($this->convert_to_headers());
     return $response;
 }
Exemplo n.º 3
0
Arquivo: HTTP.php Projeto: techart/tao
 protected function inspect($id, $options)
 {
     $options[CURLOPT_CUSTOMREQUEST] = 'HEAD';
     $options[CURLOPT_HEADER] = 1;
     $options[CURLOPT_NOBODY] = 1;
     curl_setopt_array($id, $options);
     $header = curl_exec($id);
     $body = '';
     $res = Net_HTTP_Response::from_string($body, $header);
     $len = (int) $res->headers['Content-Length'];
     if ($len > 0) {
         $limit = $this->get_memory_limit();
         if ($limit <= 0) {
             return;
         }
         $allowed_memory = $limit - memory_get_usage();
         if (2.1 * $len >= $allowed_memory) {
             throw new RuntimeException('HTTPAgent: not enough memory to download');
         }
     }
 }