POST vs GET

3 views
Skip to first unread message

Mike Cariaso

unread,
Jul 18, 2011, 3:20:15 PM7/18/11
to perlw...@googlegroups.com
A lot of my traffic comes via bots and I've noticed that pywikipedia
traffic uses easily cached GETs while MediaWiki::Bot requests are all
uncacheable POSTs. This is making it impossible for Varnish to cache
effective and adding noticable load on my server.

1. Is there a recent change in the codebase which might explain what I
think I'm observing?

2. Is there any reason I might not be able to contribute edits to
Mediawiki::Bot to use GETs where possible?

3. Does anyone who knows the codebase feel inclined to do it sooner
and better than I might?

via pywikipedia I'd usually see something like

http://www.snpedia.com/api.php?inprop=protection%7Ctalkid%7Csubjectid%7Curl%7Creadable&format=json&rvprop=content%7Cids%7Cflags%7Ctimestamp%7Cuser%7Ccomment%7Csize&prop=revisions%7Cinfo&titles=Rs67368147%28G%3BG%29&rvlimit=1&action=query


but with MediaWiki::Bot it's a very similar post.


--
--
Mike Cariaso
http://www.cariaso.com

Mike.lifeguard

unread,
Jul 18, 2011, 4:08:52 PM7/18/11
to perlw...@googlegroups.com, Jools Wills
Hi Mike,

There haven't been many changes recently, so I doubt that's the problem.
I would look at MediaWiki::API for whether the requests are POST vs GET,
as MediaWiki::Bot doesn't craft any requests itself - everything is done
through that lower-level module. I've CCed Jools in case they know the
answer to this problem.

-Mike

Jools Wills

unread,
Jul 18, 2011, 7:10:44 PM7/18/11
to Mike.lifeguard, perlw...@googlegroups.com
On 18/07/11 21:08, Mike.lifeguard wrote:
> Hi Mike,
>
> There haven't been many changes recently, so I doubt that's the problem.
> I would look at MediaWiki::API for whether the requests are POST vs GET,
> as MediaWiki::Bot doesn't craft any requests itself - everything is done
> through that lower-level module. I've CCed Jools in case they know the
> answer to this problem.

not wanting to quote the manual *cough* but i recently (well. within the
last year or so) documented this after it was requested as a feature:

config option:

use_http_get = Boolean 0 or 1 (defaults to 0). If set to 1, the perl
module will use http GET method for accessing the api. By default it
uses the POST method. Note that the module will still use POST for the
api calls that require POST no matter what the value of this
configuration option. Currently the following actions will work with
GET: query, logout, purge, paraminfo.

so if enabled its still limited to these methods. if there are others
compatible with a get method ill add em. cheers :)

Best Regards

Jools

Mike.lifeguard

unread,
Jul 18, 2011, 7:17:02 PM7/18/11
to perlw...@googlegroups.com, Jools Wills
On 11-07-18 08:10 PM, Jools Wills wrote:
> use_http_get = Boolean 0 or 1 (defaults to 0). If set to 1, the perl
> module will use http GET method for accessing the api. By default it
> uses the POST method.

Well it sure is a good thing someone knows what's going on O_o

Why don't I go ahead and fix that!

-Mike

Jools Wills

unread,
Jul 19, 2011, 12:14:43 AM7/19/11
to Mike.lifeguard, perlw...@googlegroups.com
> Well it sure is a good thing someone knows what's going on O_o
>
> Why don't I go ahead and fix that!

perhaps it makes a good default, but the config was a later addition so
i made it opt in rather than opt out, and because all calls work via
post, when writing the module it seemed the better option (I still need
a whitelist of calls that work via get, or a blacklist that don't - the
whitelist is currently simpler).

Of course with your module you could make it the default. im unsure what
would be best, it does seem as though it's good for those that run wikis
with caches the current default aint great, but then the "whitelist"
needs to be kept up to date if they introduce new calls that are
available via get..

Thoughts ?

Best Regards

Jools

Reply all
Reply to author
Forward
0 new messages