Index: trunk/extensions/Collection/Collection.body.php |
— | — | @@ -1233,12 +1233,17 @@ |
1234 | 1234 | |
1235 | 1235 | static function post( $url, $postFields, &$errorMessage, &$headers, |
1236 | 1236 | $timeout=true, $toFile=null ) { |
1237 | | - global $wgHTTPTimeout, $wgHTTPProxy, $wgVersion, $wgTitle; |
| 1237 | + global $wgHTTPTimeout, $wgHTTPProxy, $wgVersion, $wgTitle, $wgRequest; |
1238 | 1238 | global $wgCollectionMWServeCert; |
1239 | 1239 | |
1240 | 1240 | $c = curl_init( $url ); |
1241 | 1241 | curl_setopt($c, CURLOPT_PROXY, $wgHTTPProxy); |
1242 | | - curl_setopt( $c, CURLOPT_USERAGENT, "MediaWiki/$wgVersion" ); |
| 1242 | + $userAgent = $wgRequest->getHeader('User-agent'); |
| 1243 | + if ( $userAgent ) { |
| 1244 | + curl_setopt( $c, CURLOPT_USERAGENT, $userAgent . " (via MediaWiki/$wgVersion)" ); |
| 1245 | + } else { |
| 1246 | + curl_setopt( $c, CURLOPT_USERAGENT, "Unknown user agent (via MediaWiki/$wgVersion)" ); |
| 1247 | + } |
1243 | 1248 | curl_setopt( $c, CURLOPT_POST, true ); |
1244 | 1249 | curl_setopt( $c, CURLOPT_POSTFIELDS, $postFields ); |
1245 | 1250 | curl_setopt( $c, CURLOPT_HTTPHEADER, array( 'Expect:' ) ); |