diff options
author | Timo Tijhof <krinklemail@gmail.com> | 2015-05-24 14:31:11 +0200 |
---|---|---|
committer | Krinkle <krinklemail@gmail.com> | 2015-06-04 02:27:30 +0000 |
commit | f57b6af45b1cea7f93857b63716a685d2f55c2bf (patch) | |
tree | db0c6d8285d97f1deeb71e6227e1649f49e3368a /thumb.php | |
parent | 7b835dd12649b7c474d4c9f42875a8a2b23eb032 (diff) | |
download | mediawikicore-f57b6af45b1cea7f93857b63716a685d2f55c2bf.tar.gz mediawikicore-f57b6af45b1cea7f93857b63716a685d2f55c2bf.zip |
WebResponse: Implement statusHeader() using the new HttpStatus::header()
* Convert existing use of WebResponse::header() for HTTP status headers
to use this new statusHeader() method.
* Extend unit test forFauxResponse.
I'm not calling HttpStatus::header directly in code. We keep the abstraction
layer of WebResponse so that responses can continue to be mocked/fauxed without
affecting the outer HTTP response.
Change-Id: I8a536e16659fa88b54cffa1457efb889efa5fcd6
Diffstat (limited to 'thumb.php')
-rw-r--r-- | thumb.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/thumb.php b/thumb.php index 051c39ea9dcc..b163a7fbcee0 100644 --- a/thumb.php +++ b/thumb.php @@ -204,7 +204,7 @@ function wfStreamThumb( array $params ) { if ( $redirectedLocation ) { // File has been moved. Give redirect. $response = RequestContext::getMain()->getRequest()->response(); - $response->header( "HTTP/1.1 302 " . HttpStatus::getMessage( 302 ) ); + $response->statusHeader( 302 ); $response->header( 'Location: ' . $redirectedLocation ); $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + 12 * 3600 ) . ' GMT' ); @@ -270,7 +270,7 @@ function wfStreamThumb( array $params ) { } elseif ( rawurldecode( $rel404 ) === $img->getThumbRel( $thumbName2 ) ) { // Request for the "long" thumbnail name; redirect to canonical name $response = RequestContext::getMain()->getRequest()->response(); - $response->header( "HTTP/1.1 301 " . HttpStatus::getMessage( 301 ) ); + $response->statusHeader( 301 ); $response->header( 'Location: ' . wfExpandUrl( $img->getThumbUrl( $thumbName ), PROTO_CURRENT ) ); $response->header( 'Expires: ' . |