X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fhttp%2FCurlHttpRequest.php;h=44bdddbaab77057ebbb3aa795e3a11d678a485c1;hb=39f0f919c5708f4c672a8eb7e0891f50bf16883e;hp=f58c3a9a5b7783008f655d6309893d96fbcbeda9;hpb=61898ad28ed69c5b391eb43e0db9386279b9612c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/http/CurlHttpRequest.php b/includes/http/CurlHttpRequest.php index f58c3a9a5b..44bdddbaab 100644 --- a/includes/http/CurlHttpRequest.php +++ b/includes/http/CurlHttpRequest.php @@ -37,12 +37,17 @@ class CurlHttpRequest extends MWHttpRequest { return strlen( $content ); } + /** + * @see MWHttpRequest::execute + * + * @throws MWException + * @return Status + */ public function execute() { - - parent::execute(); + $this->prepare(); if ( !$this->status->isOK() ) { - return $this->status; + return Status::wrap( $this->status ); // TODO B/C; move this to callers } $this->curlOptions[CURLOPT_PROXY] = $this->proxy; @@ -102,18 +107,18 @@ class CurlHttpRequest extends MWHttpRequest { $curlHandle = curl_init( $this->url ); if ( !curl_setopt_array( $curlHandle, $this->curlOptions ) ) { - throw new MWException( "Error setting curl options." ); + throw new InvalidArgumentException( "Error setting curl options." ); } if ( $this->followRedirects && $this->canFollowRedirects() ) { - MediaWiki\suppressWarnings(); + Wikimedia\suppressWarnings(); if ( !curl_setopt( $curlHandle, CURLOPT_FOLLOWLOCATION, true ) ) { $this->logger->debug( __METHOD__ . ": Couldn't set CURLOPT_FOLLOWLOCATION. " . "Probably open_basedir is set.\n" ); // Continue the processing. If it were in curl_setopt_array, // processing would have halted on its entry } - MediaWiki\restoreWarnings(); + Wikimedia\restoreWarnings(); } if ( $this->profiler ) { @@ -140,7 +145,7 @@ class CurlHttpRequest extends MWHttpRequest { $this->parseHeader(); $this->setStatus(); - return $this->status; + return Status::wrap( $this->status ); // TODO B/C; move this to callers } /**