diff options
Diffstat (limited to 'framework/Web/THttpResponse.php')
-rw-r--r-- | framework/Web/THttpResponse.php | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/framework/Web/THttpResponse.php b/framework/Web/THttpResponse.php index ea41ab16..d51c0cf2 100644 --- a/framework/Web/THttpResponse.php +++ b/framework/Web/THttpResponse.php @@ -274,24 +274,25 @@ class THttpResponse extends TModule implements ITextWriter */
public function flush()
{
- $header = $this->getContentTypeHeader();
- $this->appendHeader($header);
+ Prado::trace("Flushing output",'System.Web.THttpResponse');
+ $this->sendContentTypeHeader();
if($this->_bufferOutput)
ob_flush();
- Prado::trace("Flushing output $header",'System.Web.THttpResponse');
}
/**
- * @return string content type and charset header
+ * Sends content type header if charset is not empty.
*/
- protected function getContentTypeHeader()
+ protected function sendContentTypeHeader()
{
- $app = $this->getApplication()->getGlobalization();
$charset = $this->getCharset();
- if(empty($charset))
- $charset = !is_null($app) ? $app->getCharset() : 'UTF-8';
- $type = $this->getContentType();
- return "Content-Type: $type; charset=$charset";
+ if(empty($charset) && ($globalization=$this->getApplication()->getGlobalization())!==null)
+ $charset = $globalization->getCharset();
+ if(!empty($charset))
+ {
+ $header='Content-Type: '.$this->getContentType().';charset='.$charset;
+ $this->appendHeader($header);
+ }
}
/**
@@ -310,14 +311,10 @@ class THttpResponse extends TModule implements ITextWriter */
public function appendHeader($value)
{
+ Prado::trace("Sending header '$value'",'System.Web.THttpResponse');
header($value);
}
- public function sendContentTypeHeader($type=null)
- {
-
- }
-
/**
* Writes a log message into error log.
* This method is simple wrapper of PHP function error_log.
|