From 1c455a5fb872ebb2787f61ef1cf3228e7a72db37 Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Wed, 30 Mar 2016 01:05:50 +0100 Subject: [PATCH] Set User-Agent in server-side VRS requests to RESTBase/Parsoid Bug: T131171 Change-Id: I385ef1f3efb674c4ad3ffb334c0ff5b830f89a37 --- ApiVisualEditor.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ApiVisualEditor.php b/ApiVisualEditor.php index b49108d3a1..494e2f12b8 100644 --- a/ApiVisualEditor.php +++ b/ApiVisualEditor.php @@ -86,6 +86,7 @@ class ApiVisualEditor extends ApiBase { } private function requestRestbase( $method, $path, $params, $reqheaders = [] ) { + global $wgVersion; $request = [ 'method' => $method, 'url' => '/restbase/local/v1/' . $path @@ -97,6 +98,7 @@ class ApiVisualEditor extends ApiBase { } // Should be synchronised with modules/ve-mw/init/ve.init.mw.ArticleTargetLoader.js $reqheaders['Accept'] = 'text/html; charset=utf-8; profile="mediawiki.org/specs/html/1.2.0"'; + $reqheaders['User-Agent'] = 'VisualEditor-MediaWiki/' . $wgVersion; $request['headers'] = $reqheaders; $response = $this->serviceClient->run( $request ); if ( $response['code'] === 200 && $response['error'] === "" ) {