Page MenuHomePhabricator

Correctly redirect in Parsoid /transform/wikitext/to/lint endpoint
Closed, ResolvedPublic

Description

In Parsoid /transform/wikitext/to/lint endpoint, if I provide just the page title and no revision ID or wikitext body parameter, the endpoint 302 redirects me to the URI with the latest page revision. However, 302 redirects instruct clients to change the request method from POST to GET, while Parsoid doesn't support GET for that endpoint. So the correct way of redirecting would be 307 redirect that doesn't allow the client to change the request method.

Alternatively, Parsoid should support GET for that endpoint, or make the revision parameter required if no body is provided.

Details

Related Gerrit Patches:
mediawiki/services/parsoid : masterRedirect to the right path

Related Objects

Event Timeline

Pchelolo created this task.Jun 27 2017, 6:17 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 27 2017, 6:17 PM
ssastry moved this task from Backlog to Parsoid on the MediaWiki-extensions-Linter board.
ssastry moved this task from Backlog to Linter on the Parsoid board.Sep 18 2017, 5:11 PM

Change 395880 had a related patch set uploaded (by Arlolra; owner: Arlolra):
[mediawiki/services/parsoid@master] T169006: Preserve request method when redirecting to oldid

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

Interesting, I didn't know about this 302/307 distinction .. it appears (based on a quick read) that browsers de-facto handle 302s incorrectly which led to introduction of 307 for stricter compliance.

Change 395880 merged by jenkins-bot:
[mediawiki/services/parsoid@master] T169006: Preserve request method when redirecting to oldid

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

Arlolra closed this task as Resolved.Dec 8 2017, 8:19 PM
Arlolra claimed this task.
Pchelolo reopened this task as Open.Feb 22 2018, 1:29 PM

Right now a POST to /v3/transform/wikitext/to/lint/{title} returns a 307 redirect to /en.wikipedia.org/v3/page/lint/{title}/{revision}, but the former URI doesn't exist - POST to it returns a 404, GET returns an error that {"error":"Invalid page format: lint"}.

The 307 redirect is preserving the request method, so it should point to /v3/transform/wikitext/to/lint/{title}/{revision}

Reopening.

Change 413425 had a related patch set uploaded (by Arlolra; owner: Arlolra):
[mediawiki/services/parsoid@master] Redirect to the right path

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

Change 413425 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Redirect to the right path

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

Arlolra closed this task as Resolved.Feb 26 2018, 9:09 PM