Context:
The Parsoid extension implements a REST endpoints for retrieving page content. This API is not exposed publically on WMF sites, but only used internally by RESTbase. It is not considered a stable API.
Current situation:
If the request only specifies the page, the endpoint will respond with a redirect to a URL that also specifies the latest revision. E.g.
https://mywiki.example/w/rest.php/test.wikipedia.org/v3/page/pagebundle/Dog
will redirect to
https://mywiki.example/w/rest.php/test.wikipedia.org/v3/page/pagebundle/Dog/12345
This is good for caceability, but bad for the performance of individual requests, since it requires two round trips instead of one.
Problem:
This is getting in the way of running parsoid restbase code in proxy mode (i.e. storage disabled, T344945): when serving a request for e.g. /test.wikipedia.org/v3/page/html/Dog, restbase has to make two calls to the backend - one based on the title, and the another one to follow the redirect. It would be simpler and more efficient if /w/rest.php/test.wikipedia.org/v3/page/html/Dog would just return the current content.
Proposed solution:
In ParsoidHandler::tryToCreatePageConfig, remove the following code:
if ( !$html2WtMode && $wikitextOverride === null && !$hasOldId ) { // Redirect to the latest revid throw new ResponseException( $this->createRedirectToOldidResponse( $pageConfig, $attribs ) ); }