Awesome; thanks for the analysis, Krinkle.
Do we want to change this behaviour? From my point of view the answer is 'yes, not setting any kind of user agent is a violation of our API etiquette and we should be taking steps to alert people that it is' but if other people have different perspectives on this I'd love to hear them.
On 1 September 2015 at 13:18, Krinkle krinklemail@gmail.com wrote:
I've confirmed just now that whatever requirement there was, it doesn't seem to be in effect.
Both omitting the header entirely, sending it with empty string, and sending with "-"; – all three result in a response from the MediaWiki API.
$ curl -A '' --include -v 'https://en.wikipedia.org/w/api.php?action=query&format=json' https://en.wikipedia.org/w/api.php?action=query&format=json'
GET /w/api.php?action=query&format=json HTTP/1.1 Host: en.wikipedia.org Accept: */*
< HTTP/1.1 200 OK .. {"batchcomplete":""}
$ curl -A '-' --include -v 'https://en.wikipedia.org/w/api.php?action=query&format=json' https://en.wikipedia.org/w/api.php?action=query&format=json'
GET /w/api.php?action=query&format=json HTTP/1.1 User-Agent: - Host: en.wikipedia.org http://en.wikipedia.org/ Accept: */*
< HTTP/1.1 200 OK .. {"batchcomplete":""}
In the past (2012?) these were definitely being blocked. (Ran into it from time to time on Toolserver) It seems php file_get_contents('http://...api..' http://...api..') is also working fine now, without having to init_set a user_agent value first.
-- Krinkle _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l