Page MenuHomePhabricator

Parsoid/PHP HTML output for PageBundle should contain Content-Language and Vary headers
Closed, ResolvedPublic

Description

Spotted while testing RESTBase with Parsoid/PHP. When replying to pagebundle requests, the HTML sub-section of the response body differs between JS and PHP:

JS
'content-type': 'text/html; charset=utf-8; profile="https://www.mediawiki.org/wiki/Specs/HTML/2.1.0"',
'content-language': 'en',
vary: 'Accept'
PHP
'content-type': 'text/html; charset=utf-8; profile="https://www.mediawiki.org/wiki/Specs/HTML/2.1.0"'

It seems like this feature was left out during the port but RESTBase relies on these for language conversions and caching.

Additionally, while looking at the Parsoid code, I realised that [Parsoid/PHP forces content-language: en for all output](https://github.com/wikimedia/parsoid/blob/2035954f40a31c97a6a7051a6238113eb2b50976/extension/src/Rest/Handler/ParsoidHandler.php#L593-L595), but that shouldn't be the case (since not all content's language is en).

Event Timeline

mobrovac created this task.

I was mentioning this to @mobrovac on IRC, but looks like they need these headers independent of LC endpoints. Unless the LC endpoints are done, how difficult is it to pull out the code that sets these headers into a separate patch so we can merge that and unblock Marko?

Unless the LC endpoints are done, how difficult is it to pull out the code that sets these headers into a separate patch so we can merge that and unblock Marko?

It wouldn't be too difficult but the patch is nearly done.

mobrovac claimed this task.

@ssastry and I discussed this on IRC. Since language conversion will be merged before T229015: Tracking: Direct live production traffic at Parsoid/PHP, it is safe to work around this in RESTBase for now (BUT leave a todo and log it in case this ever happens), so I will do that.

Change 545391 had a related patch set uploaded (by Arlolra; owner: Arlolra):
[mediawiki/services/parsoid@master] Add language converter endpoints to the REST API

https://gerrit.wikimedia.org/r/545391

Change 545391 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Add language converter endpoints to the REST API

https://gerrit.wikimedia.org/r/545391