예제 #1
0
파일: Response.php 프로젝트: optiva/xGlide
 /**
  * Sets the output for the response
  * @access public
  * @param $content
  * @param $last_modified
  * @param $type
  * @return array
  */
 public function set($content, $last_modified, $type = 'text/plain')
 {
     $this->output = $content;
     $this->headers['Content-Type'] = $type;
     $this->headers['Expires'] = $this->_time(time() + 31536000);
     $this->headers['Last-Modified'] = $this->_time($last_modified);
     $this->headers['Cache-Control'] = $this->options['cache_control'];
     if ($this->encoding !== false) {
         $this->output = $this->encoder->encode($content);
     }
     if ($this->options['set_etag'] === true) {
         $this->headers['ETag'] = $this->generate_etag($this->output);
     }
 }
예제 #2
0
 /**
  * Sets the output for the response
  * @access public
  * @param $content
  * @param $last_modified
  * @param $type
  * @return array
  */
 public function set($content, $last_modified, $type = 'text/plain')
 {
     $this->output = $content;
     $this->headers['Content-Type'] = $type;
     $this->headers['Expires'] = $this->_time(time() + 31536000);
     $this->headers['Last-Modified'] = $this->_time($last_modified);
     $this->headers['Cache-Control'] = $this->options['scope'];
     # If we're manually encoding the content
     if ($this->encoding !== false) {
         $this->output = $this->encoder->encode($content);
         $this->headers['Content-Encoding'] = $this->encoding;
         $this->headers['Vary'] = 'Accept-Encoding';
     }
     # If you're letting Apache doe the encoding, it will calculate this and override it
     # Sending Content-Length in CGI can result in unexpected behavior
     if ($this->options['set_content_length'] === true and stripos(PHP_SAPI, 'cgi') !== true) {
         $this->headers['Content-Length'] = strlen($content);
     }
     # You may want to set an etag
     if ($this->options['set_etag'] === true) {
         $this->headers['ETag'] = $this->generate_etag($last_modified, $this->headers['Content-Length'], $this->encoding);
     }
 }