MultiHttpClient: Don't use "MW" in User-Agent
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 6 Oct 2015 19:45:03 +0000 (12:45 -0700)
committerTimo Tijhof <krinklemail@gmail.com>
Tue, 6 Oct 2015 20:02:21 +0000 (13:02 -0700)
Follows-up 6f51037d680ce.

Change-Id: I5e404c3a6ab9c3d1126676ee5fc22149422aa51f

includes/libs/MultiHttpClient.php

index 49966cf..b6aeda5 100644 (file)
@@ -55,8 +55,6 @@ class MultiHttpClient {
        protected $maxConnsPerHost = 50;
        /** @var string|null proxy */
        protected $proxy;
-       /** @var string */
-       protected $userAgent = 'MW-MultiHttpClient';
 
        /**
         * @param array $options
@@ -347,7 +345,7 @@ class MultiHttpClient {
                }
 
                if ( !isset( $req['headers']['user-agent'] ) ) {
-                       $req['headers']['user-agent'] = $this->userAgent;
+                       $req['headers']['user-agent'] = self::userAgent();
                }
 
                $headers = array();
@@ -418,4 +416,12 @@ class MultiHttpClient {
                        curl_multi_close( $this->multiHandle );
                }
        }
+
+       /**
+        * The default User-Agent for requests.
+        * @return string
+        */
+       public static function userAgent() {
+               return 'wikimedia/multi-http-client v1.0';
+       }
 }