/**
  * Initiates an new PHPCrawlerResponseHeader.
  *
  * @param string $header_string A complete response-header as it was send by the server
  * @param string $source_url The URL of the website the header was recevied from.
  * @internal
  */
 public function __construct($header_string, $source_url)
 {
     $this->header_raw = $header_string;
     $this->source_url = $source_url;
     $this->http_status_code = PHPCrawlerUtils::getHTTPStatusCode($header_string);
     $this->content_type = strtolower(PHPCrawlerUtils::getHeaderValue($header_string, "content-type"));
     $this->content_length = strtolower(PHPCrawlerUtils::getHeaderValue($header_string, "content-length"));
     $this->cookies = PHPCrawlerUtils::getCookiesFromHeader($header_string, $source_url);
     $this->transfer_encoding = strtolower(PHPCrawlerUtils::getHeaderValue($header_string, "transfer-encoding"));
     $this->content_encoding = strtolower(PHPCrawlerUtils::getHeaderValue($header_string, "content-encoding"));
 }
 /**
  * Checks whether the content of this page/file should be streamed directly to file.
  *
  * @param string $response_header The response-header
  * @return bool TRUE if the content should be streamed to TMP-file
  */
 protected function decideStreamToFile($response_header)
 {
     if (count($this->receive_to_file_content_types) == 0) {
         return false;
     }
     // Get Content-Type from header
     $content_type = PHPCrawlerUtils::getHeaderValue($response_header, "content-type");
     // No Content-Type given
     if ($content_type == null) {
         return false;
     }
     // Check against the given rules
     $receive = PHPCrawlerUtils::checkStringAgainstRegexArray($content_type, $this->receive_to_file_content_types);
     return $receive;
 }