<?php
+/**
+ * @file
+ * @ingroup Ajax
+ */
+
if( !defined( 'MEDIAWIKI' ) ) {
die( 1 );
}
/**
- * @todo document
- * @addtogroup Ajax
+ * Handle responses for Ajax requests (send headers, print
+ * content, that sort of thing)
+ *
+ * @ingroup Ajax
*/
class AjaxResponse {
/** HTTP header Content-Type */
private $mContentType;
- /** @todo document */
+ /** Disables output. Can be set by calling $AjaxResponse->disable() */
private $mDisabled;
/** Date for the HTTP header Last-modified */
$this->mText = '';
$this->mResponseCode = '200 OK';
$this->mLastModified = false;
- $this->mContentType= 'text/html; charset=utf-8';
+ $this->mContentType= 'application/x-wiki';
if ( $text ) {
$this->addText( $text );
if ( $this->mCacheDuration ) {
- # If squid caches are configured, tell them to cache the response,
+ # If squid caches are configured, tell them to cache the response,
# and tell the client to always check with the squid. Otherwise,
# tell the client to use a cached copy, without a way to purge it.
wfDebug( "$fname: -- client send If-Modified-Since: " . $modsince . "\n", false );
wfDebug( "$fname: -- we might send Last-Modified : $lastmod\n", false );
if( ($ismodsince >= $timestamp ) && $wgUser->validateCache( $ismodsince ) && $ismodsince >= $wgCacheEpoch ) {
+ ini_set('zlib.output_compression', 0);
$this->setResponseCode( "304 Not Modified" );
$this->disable();
$this->mLastModified = $lastmod;
return true;
}
}
-