public function getHeaders()
 {
     $headers = array();
     if (!$this->shouldStopForDebugging()) {
         $headers[] = array('Location', $this->uri);
     }
     $headers = array_merge(parent::getHeaders(), $headers);
     return $headers;
 }
Пример #2
0
 /**
  * Write an entire @{class:AphrontResponse} to the output.
  *
  * @param AphrontResponse The response object to write.
  * @return void
  */
 public final function writeResponse(AphrontResponse $response)
 {
     // Do this first, in case it throws.
     $response_string = $response->buildResponseString();
     $all_headers = array_merge($response->getHeaders(), $response->getCacheHeaders());
     $this->writeHTTPStatus($response->getHTTPResponseCode(), $response->getHTTPResponseMessage());
     $this->writeHeaders($all_headers);
     $this->writeData($response_string);
 }
 public function getHeaders()
 {
     $headers = array();
     if (!$this->shouldStopForDebugging()) {
         $uri = self::getURIForRedirect($this->uri, $this->isExternal);
         $headers[] = array('Location', $uri);
     }
     $headers = array_merge(parent::getHeaders(), $headers);
     return $headers;
 }
 public function getHeaders()
 {
     $headers = array(array('Content-Type', 'application/json'));
     if ($this->getClientURI()) {
         $headers[] = array('Location', $this->getFullURI());
     }
     // TODO -- T844 set headers with X-Auth-Scopes, etc
     $headers = array_merge(parent::getHeaders(), $headers);
     return $headers;
 }
Пример #5
0
 public function getHeaders()
 {
     $headers = array(array('Content-Type', $this->getMimeType()));
     if (strlen($this->getDownload())) {
         $headers[] = array('X-Download-Options', 'noopen');
         $filename = $this->getDownload();
         $headers[] = array('Content-Disposition', 'attachment; filename=' . $filename);
     }
     $headers = array_merge(parent::getHeaders(), $headers);
     return $headers;
 }
Пример #6
0
 public function getHeaders()
 {
     $headers = array(array('Content-Type', $this->getMimeType()), array('Content-Length', strlen($this->buildResponseString())));
     if ($this->rangeMin || $this->rangeMax) {
         $len = strlen($this->content);
         $min = $this->rangeMin;
         $max = $this->rangeMax;
         $headers[] = array('Content-Range', "bytes {$min}-{$max}/{$len}");
     }
     if (strlen($this->getDownload())) {
         $headers[] = array('X-Download-Options', 'noopen');
         $filename = $this->getDownload();
         $headers[] = array('Content-Disposition', 'attachment; filename=' . $filename);
     }
     if ($this->allowOrigins) {
         $headers[] = array('Access-Control-Allow-Origin', implode(',', $this->allowOrigins));
     }
     $headers = array_merge(parent::getHeaders(), $headers);
     return $headers;
 }
Пример #7
0
 public function getHeaders()
 {
     $headers = array(array('Content-Type', 'text/plain; charset=UTF-8'));
     $headers = array_merge(parent::getHeaders(), $headers);
     return $headers;
 }
 public function getHeaders()
 {
     $headers = array(array('Location', $this->uri));
     $headers = array_merge(parent::getHeaders(), $headers);
     return $headers;
 }
Пример #9
0
 public function getHeaders()
 {
     $headers = array(array('Content-Type', $this->getMimeType()), array('Accept-Ranges', 'bytes'));
     if ($this->rangeMin || $this->rangeMax) {
         $len = $this->getContentLength();
         $min = $this->rangeMin;
         $max = $this->rangeMax;
         $headers[] = array('Content-Range', "bytes {$min}-{$max}/{$len}");
         $content_len = $max - $min + 1;
     } else {
         $content_len = $this->getContentLength();
     }
     $headers[] = array('Content-Length', $this->getContentLength());
     if (strlen($this->getDownload())) {
         $headers[] = array('X-Download-Options', 'noopen');
         $filename = $this->getDownload();
         $filename = addcslashes($filename, '"\\');
         $headers[] = array('Content-Disposition', 'attachment; filename="' . $filename . '"');
     }
     if ($this->allowOrigins) {
         $headers[] = array('Access-Control-Allow-Origin', implode(',', $this->allowOrigins));
     }
     $headers = array_merge(parent::getHeaders(), $headers);
     return $headers;
 }
Пример #10
0
 /**
  * Write an entire @{class:AphrontResponse} to the output.
  *
  * @param AphrontResponse The response object to write.
  * @return void
  */
 public final function writeResponse(AphrontResponse $response)
 {
     // Build the content iterator first, in case it throws. Ideally, we'd
     // prefer to handle exceptions before we emit the response status or any
     // HTTP headers.
     $data = $response->getContentIterator();
     $all_headers = array_merge($response->getHeaders(), $response->getCacheHeaders());
     $this->writeHTTPStatus($response->getHTTPResponseCode(), $response->getHTTPResponseMessage());
     $this->writeHeaders($all_headers);
     $abort = false;
     foreach ($data as $block) {
         if (!$this->isWritable()) {
             $abort = true;
             break;
         }
         $this->writeData($block);
     }
     $response->didCompleteWrite($abort);
 }
 public function getHeaders()
 {
     $headers = array(array('Content-Type', 'text/plain'));
     return array_merge(parent::getHeaders(), $headers);
 }
Пример #12
0
 public function getHeaders()
 {
     $headers = array(array('Content-Type', 'application/json'));
     $headers = array_merge(parent::getHeaders(), $headers);
     return $headers;
 }
 public function getHeaders()
 {
     $headers = array(array('Content-Type', 'application/mercurial-0.1'));
     return array_merge(parent::getHeaders(), $headers);
 }
 public function getHeaders()
 {
     $this->readRequestHeaders();
     return array_merge(parent::getHeaders(), $this->headers, array(array('X-Phabricator-Proxy', 'true')));
 }
 public function getHeaders()
 {
     $headers = array(array('Content-Type', 'application/vnd.git-lfs+json'));
     return array_merge(parent::getHeaders(), $headers);
 }
Пример #16
0
 public function getHeaders()
 {
     return array_merge(parent::getHeaders(), $this->headers);
 }
Пример #17
0
 /**
  * Write an entire @{class:AphrontResponse} to the output.
  *
  * @param AphrontResponse The response object to write.
  * @return void
  */
 public final function writeResponse(AphrontResponse $response)
 {
     $all_headers = array_merge($response->getHeaders(), $response->getCacheHeaders());
     $this->writeHTTPStatus($response->getHTTPResponseCode());
     $this->writeHeaders($all_headers);
     $this->writeData($response->buildResponseString());
 }