发布于 4年前

升级到Parsoid 0.9.0 带来的406 Not Acceptable docserver error

Some of my mediawiki instances broke when editing a page with VisualEditor on REL_30 today bringing HTTP 416 Errors related to Parsoid.
今天在使用VisualEditor REL_30编辑页面时,出现了mediawiki实例崩溃问题,导致与Parsoid相关的链接HTTP
416错误。

Strangely this error only occured when editing existing pages, simplyfied as curl below:
奇怪的是,这个错误只发生在编辑已有页面时才发生,简单描述如下:

curl "http://NAME_OF_WIKI_HERE/api.php?action=visualeditor&format=json&paction=parse&page=Main_Page&uselang=en"
{"error":{"code":"apierror-visualeditor-docserver-http","info":"HTTP 406","*":"See http://NAME_OF_WIKI_HERE/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."}}%

After a while I found that parsoid announced the behavoiur on there github rep:
过了一会儿我发现Parsoid在Github的代表发表了公告

This release requires clients (VE, etc.) to return a 1.6.0 and greater HTML version string in the header. If not, Parsoid will return a HTTP 406. This can be fixed by updating VE (or relevant clients) to a more recent version.
该版本更新要求客户端(VE等)返回1.6.0以上的HTML版本串在头部.如果没有的话,Parsoid将会返回一个HTTP 406.在您更新VE(或相关客户端)到更新的版本时将会修复.

Unfortunately I used their .deb repository releases.wikipedia.org which didn’t provide the 0.8.0 package for reverting the update. And since I’ve already updated -marking it on hold in apt was no longer an option.
不幸的是,我使用了他们releases.wikipedia.org的.deb存储库,而该库中没有提供用于恢复更新到0.8.0的软件包。而且自从我更新后,-marking在apt中不再是可选项.

After reading a bit through the source code the solution I found until the next mediawiki stable versions arrives can be followed by editing the:
在阅读源代码后,我发现了一个在下次Mediawiki更新前可以临时解决的方案.通过编辑:

lib/config/ParsoidConfig.js

and switch this line:
查找这一行:

ParsoidConfig.prototype.strictAcceptCheck = true;

to that
改为

ParsoidConfig.prototype.strictAcceptCheck = false; //true;

It’s not pretty, but for now it solved my issues.
这不是好的做法,但他现在解决了我的问题.


相关文章

©2020 edoou.com   京ICP备16001874号-3