Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GET requests #31

Open
nberger-git opened this issue Sep 21, 2015 · 3 comments
Open

GET requests #31

nberger-git opened this issue Sep 21, 2015 · 3 comments

Comments

@nberger-git
Copy link

A site maintainer asked if the requests for content could be sent as GET instead of POST, so I made a couple of minor changes in wikitools to support this.

In case you want to propagate something like this to the master, the patch files wrt the current package version are linked here: https://gist.github.com/nberger-git/7fa9bc527c21a11caba2

@nberger-git
Copy link
Author

An updated version of the api.py patch : https://gist.github.com/nberger-git/77f1d8091987eaa19c53
This has a fix to avoid 503 errors in GET mode, provided by @cariaso.

cariaso added a commit to cariaso/wikitools that referenced this issue Feb 25, 2016
@mzmcbride
Copy link
Collaborator

What's the motivation for using GET instead of POST in some cases? I'm not sure the additional code complexity is worth the benefit.

@cariaso
Copy link

cariaso commented Jun 9, 2016

There are 2 major benefits.

#1. Server performance. GET operations can be cached with Varnish and
similar tools, POST cannot. My site has dramatically more bot traffic than
humans, and this makes a big difference.

This is consistent with RFC1945
https://tools.ietf.org/html/rfc1945#section-8 which explicitly states

Applications must not cache responses to a POST request because the
application has no way of knowing that the server would return an
equivalent response on some future request.

See also http://stackoverflow.com/a/3477374

#2. Logging/Diagnostics. GET params are easily visible in a standard log

184.1.2.3 - - [09/Jun/2016:01:08:31 +0000] "GET
/api.php?inprop=protection%7Csubjectid&format=json&rvprop=content%7Cids%7Cflags%7Ctimestamp%7Cuser%7Ccomment%7Csize&rawcontinue=1&prop=revisions%7Cinfo&titles=Rs62033400&rvlimit=1&action=query
HTTP/1.1" 200 642 "-" "MediaWiki::Gateway/1.1.0"

is much more useful than

113.1.2.3 - - [08/Jun/2016:02:21:28 +0000] "POST /api.php HTTP/1.1" 200 917
"-" "python-wikitools/1.4"

For apache, getting these sorts of details from a POST requires installing
additional modules, and is discouraged except during brief, targeted
debugging.

https://httpd.apache.org/docs/current/mod/mod_dumpio.html

One possible implementation is at

cariaso@6b805c9

And I would be happy to make a pull request, or any requested changes.

On Jun 9, 2016 9:21 AM, "MZMcBride" [email protected] wrote:

What's the motivation for using GET instead of POST in some cases? I'm not
sure the additional code complexity is worth the benefit.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#31 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAHpkkmYrsSXP0p5-nSUD96tvIM6GbqSks5qJ1yMgaJpZM4GBDqs
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants