Make userAgent also work as an option to MWHttpRequest::factory() and MWHttpRequest...
authorTim Starling <tstarling@users.mediawiki.org>
Mon, 27 Feb 2012 01:37:06 +0000 (01:37 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Mon, 27 Feb 2012 01:37:06 +0000 (01:37 +0000)
includes/HttpFunctions.php

index 1018658..23ea8df 100644 (file)
@@ -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" );