From: Tim Starling Date: Mon, 27 Feb 2012 01:37:06 +0000 (+0000) Subject: Make userAgent also work as an option to MWHttpRequest::factory() and MWHttpRequest... X-Git-Tag: 1.31.0-rc.0~24490 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/bilan.php?a=commitdiff_plain;h=7c44943ee45e5744238438b7fcedcfadbc9745d6;p=lhc%2Fweb%2Fwiklou.git Make userAgent also work as an option to MWHttpRequest::factory() and MWHttpRequest::__construct(), not just Http::request(). --- diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index 1018658450..23ea8df2cf 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -43,9 +43,6 @@ class Http { } $req = MWHttpRequest::factory( $url, $options ); - if( isset( $options['userAgent'] ) ) { - $req->setUserAgent( $options['userAgent'] ); - } $status = $req->execute(); if ( $status->isOK() ) { @@ -210,6 +207,9 @@ class MWHttpRequest { } else { $this->timeout = $wgHTTPTimeout; } + if( isset( $options['userAgent'] ) ) { + $this->setUserAgent( $options['userAgent'] ); + } $members = array( "postData", "proxy", "noProxy", "sslVerifyHost", "caInfo", "method", "followRedirects", "maxRedirects", "sslVerifyCert", "callback" );