From: Gabriel Wicke Date: Tue, 10 Jan 2012 18:16:38 +0000 (+0000) Subject: Support If-modified-since for RawPage, fixes bug #10023. X-Git-Tag: 1.31.0-rc.0~25367 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=a521795ebbfd0cca3cb5f40813e44987300c0c02;p=lhc%2Fweb%2Fwiklou.git Support If-modified-since for RawPage, fixes bug #10023. The check to WikiPage::getTouched will load the latest revision data, which is not ideal for performance. In a quick test using ab -c 100 -n 1000 and without MemCached enabled, the request rate for plain GET requests drops slightly from 108 to 104 req/second. As described in my comment https://bugzilla.wikimedia.org/show_bug.cgi?id=10023#c9, this could certainly be improved on. Overall, a few unmodified responses should still make the server-side performance impact of this patch positive, while improving client-side performance considerably for unmodified content. --- diff --git a/includes/actions/RawAction.php b/includes/actions/RawAction.php index 019d53839a..2dcc3875a3 100644 --- a/includes/actions/RawAction.php +++ b/includes/actions/RawAction.php @@ -42,6 +42,10 @@ class RawAction extends FormlessAction { return; } + if ( $this->getOutput()->checkLastModified( $this->page->getTouched() ) ) { + return; // Client cache fresh and headers sent, nothing more to do. + } + # special case for 'generated' raw things: user css/js # This is deprecated and will only return empty content $gen = $request->getVal( 'gen' );