r44117 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44116‎ | r44117 | r44118 >
Date:16:48, 1 December 2008
Author:jojo
Status:resolved (Comments)
Tags:
Comment:
submit user agent information to mw-serve
Modified paths:
  • /trunk/extensions/Collection/Collection.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Collection/Collection.body.php
@@ -1233,12 +1233,17 @@
12341234
12351235 static function post( $url, $postFields, &$errorMessage, &$headers,
12361236 $timeout=true, $toFile=null ) {
1237 - global $wgHTTPTimeout, $wgHTTPProxy, $wgVersion, $wgTitle;
 1237+ global $wgHTTPTimeout, $wgHTTPProxy, $wgVersion, $wgTitle, $wgRequest;
12381238 global $wgCollectionMWServeCert;
12391239
12401240 $c = curl_init( $url );
12411241 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+ }
12431248 curl_setopt( $c, CURLOPT_POST, true );
12441249 curl_setopt( $c, CURLOPT_POSTFIELDS, $postFields );
12451250 curl_setopt( $c, CURLOPT_HTTPHEADER, array( 'Expect:' ) );

Comments

#Comment by Aaron Schulz (talk | contribs)   06:17, 3 December 2008

Use wfGetAgent()

#Comment by 😂 (talk | contribs)   15:39, 3 December 2008

Cleaned up in r44175

Status & tagging log