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