Arlolra has uploaded a new change for review.
https://gerrit.wikimedia.org/r/212836
Change subject: Use the proxy passed to ConfigRequest
......................................................................
Use the proxy passed to ConfigRequest
* The default constructed wikiConfig *didn't* have the proxy set!
* Broken in 923b64a5b7cef6c5a9efd4c36d23176da6992d55
Change-Id: Ibf571bc1531fb3ad77db7b3c78b8d5a18ebd25ae
---
M lib/mediawiki.ApiRequest.js
M lib/mediawiki.parser.environment.js
2 files changed, 17 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid
refs/changes/36/212836/1
diff --git a/lib/mediawiki.ApiRequest.js b/lib/mediawiki.ApiRequest.js
index aa39129..b542a90 100644
--- a/lib/mediawiki.ApiRequest.js
+++ b/lib/mediawiki.ApiRequest.js
@@ -107,6 +107,10 @@
this.title = title;
this.queueKey = title;
this.reqType = "Page Fetch";
+
+ // Proxy to the MW API. Set to null for subclasses going somewhere else.
+ // ie. ParsoidCacheRequest
+ this.proxy = env.conf.wiki.apiProxy;
}
// Inherit from EventEmitter
@@ -114,7 +118,7 @@
ApiRequest.prototype.request = function( options, callback ) {
var env = this.env;
- var proxy = env.conf.wiki.apiProxy;
+ var proxy = this.proxy;
// this is a good place to put debugging statements
// if you want to watch network requests.
// console.log('ApiRequest', options);
@@ -666,6 +670,9 @@
this.queueKey = title + '?oldid=' + oldid;
this.reqType = "Parsoid cache request";
+ // Don't use MW API proxy.
+ this.proxy = null;
+
var apiargs = {
oldid: oldid
};
@@ -683,9 +690,6 @@
headers: {
'x-parsoid-request': 'cache'
},
- // Don't use MW API proxy.
- // XXX add option for parsoid cache proxy?
- proxy: null,
};
var timeouts = env.conf.parsoid.timeouts;
@@ -734,6 +738,10 @@
this.queueKey = uri;
this.reqType = "Config Request";
+ // Use the passed in proxy to the mw api. The default proxy set in
+ // the ApiRequest constructor might not be the right one.
+ this.proxy = proxy;
+
if (!uri) {
this.retries = env.conf.parsoid.retries.mwApi.configInfo;
this._requestCB(new Error('There was no base URI for the API we
tried to use.'));
diff --git a/lib/mediawiki.parser.environment.js
b/lib/mediawiki.parser.environment.js
index 7932c33..9f7d177 100644
--- a/lib/mediawiki.parser.environment.js
+++ b/lib/mediawiki.parser.environment.js
@@ -75,7 +75,11 @@
if ( !wikiConfig ) {
// Local things, per-wiki
- wikiConfig = new WikiConfig( this, null, options.prefix );
+ wikiConfig = new WikiConfig(
+ this, null, options.prefix,
+ parsoidConfig.mwApiMap.get(options.prefix).uri,
+ this.getAPIProxy(options.prefix)
+ );
}
this.conf.wiki = wikiConfig;
--
To view, visit https://gerrit.wikimedia.org/r/212836
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf571bc1531fb3ad77db7b3c78b8d5a18ebd25ae
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits