Page MenuHomePhabricator

External Data: should POST web requests be cached like GET?
Closed, ResolvedPublicFeature

Description

Should POST web requests be cached like GET?

Comments requested. Perhaps, caching should be allowed, if cache seconds is set, but not enforced, if even $edgCacheExpireTime is above zero.

Event Timeline

What is the argument against caching data from a POST request?

Yaron_Koren renamed this task from Should POST web request be cached like GET? to External Data: should POST web request be cached like GET?.Oct 13 2021, 7:18 PM
ashley added a subscriber: ashley.

Removing MediaWiki-extensions-Comments and Social-Tools tags because as far as I can see, this task is related to the External Data extension and not to the Comments extension and/or other extensions of the social tools family of MediaWiki extensions.

What is the argument against caching data from a POST request?

At first, I presumed that a POST request is supposed to change the state of the server, so withholding an HTTP request by caching will not be correct.

Now that I have used POST variables for the first time in {{#get_web_data:}} (there is a patch waiting, BTW), I realised that {{#get_web_data:}} does not use POST request type, but abuses it, following the data source. Technically, a request is POST, effectively, it is GET. Unless I am unaware of some use cases that confirm my original hypothesis, now I thin that POST and GET requests should be treated equally regarding caching. This also will enable us to simplify the class hierarchy.

alex-mashin renamed this task from External Data: should POST web request be cached like GET? to External Data: should POST web requests be cached like GET?.Oct 14 2021, 5:48 AM
alex-mashin updated the task description. (Show Details)

That makes sense - I don't think anyone should be (or is) using External Data to modify an outside system.

Then there is another question: now POST requests are tried only once, while GET requests can be re-tried several times. The reason was similar: POST requests are not necesserily idempotent. Perhas, this should be unified, too?

Maybe - there's probably no harm to doing that.

Change 789891 had a related patch set uploaded (by Alex Mashin; author: mashin):

[mediawiki/extensions/ExternalData@master] Simplify EDConnectorHttp hierarchy

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

Change 789891 merged by jenkins-bot:

[mediawiki/extensions/ExternalData@master] Simplify EDConnectorHttp hierarchy

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

alex-mashin claimed this task.