From e4f0c1f57b16ebc15cda6fd810e55f03f58b71da Mon Sep 17 00:00:00 2001 From: Aaron Date: Tue, 8 May 2012 15:18:10 -0700 Subject: [PATCH] HTTP: Fix ded6170bd2072971f72db794f3ab1625a8e13475, which broke all HTTP calls. * respHeaders contains arrays for each header (should've been respHeaders['content-length'][0] instead of respHeaders['content-length']) using getResponseHeader() instead. * This also fixes InstantCommons, which was broken by this (bug 36653). * Also cleaned up a bit of w/s in foreign repo code while in the area. Change-Id: I429b0a36618cc2b873077516e9c1023dc5b7d693 --- includes/HttpFunctions.php | 2 +- includes/filerepo/ForeignAPIRepo.php | 4 ++-- includes/filerepo/file/ForeignAPIFile.php | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index 054a836c04..d76b37f1e5 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -757,7 +757,7 @@ class CurlHttpRequest extends MWHttpRequest { $this->setStatus(); if ( isset( $this->respHeaders['content-length'] ) ) { - if ( strlen( $this->content ) < $this->respHeaders['content-length'] ) { + if ( strlen( $this->content ) < $this->getResponseHeader( 'content-length' ) ) { $this->status->fatal( 'http-truncated-body' ); } } diff --git a/includes/filerepo/ForeignAPIRepo.php b/includes/filerepo/ForeignAPIRepo.php index 4f515a915c..5fab3ab75d 100644 --- a/includes/filerepo/ForeignAPIRepo.php +++ b/includes/filerepo/ForeignAPIRepo.php @@ -130,8 +130,8 @@ class ForeignAPIRepo extends FileRepo { $query = array_merge( $query, array( - 'format' => 'json', - 'action' => 'query', + 'format' => 'json', + 'action' => 'query', 'redirects' => 'true' ) ); if ( $this->mApiBase ) { diff --git a/includes/filerepo/file/ForeignAPIFile.php b/includes/filerepo/file/ForeignAPIFile.php index a5b8582f17..ef9c3a5ec9 100644 --- a/includes/filerepo/file/ForeignAPIFile.php +++ b/includes/filerepo/file/ForeignAPIFile.php @@ -54,9 +54,9 @@ class ForeignAPIFile extends File { */ static function newFromTitle( Title $title, $repo ) { $data = $repo->fetchImageQuery( array( - 'titles' => 'File:' . $title->getDBKey(), - 'iiprop' => self::getProps(), - 'prop' => 'imageinfo', + 'titles' => 'File:' . $title->getDBKey(), + 'iiprop' => self::getProps(), + 'prop' => 'imageinfo', 'iimetadataversion' => MediaHandler::getMetadataVersion() ) ); -- 2.20.1