Hey,
I'm making a post request to the ApiEditPage module, and for some reason the WebRequest class decides to go change the value of the title parameter to the path to the api entry point.
This is the request I'm making: http://wiki.bn2vs.com/smw/api.php?action=edit&title=Push&format=json...
Evil line of code causing modification of the title parameter: Line 147 at http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/WebRequest.p...
This appears to go wrong only on wikis rewriting urls.
Why is the parameter being changed?! And how can I now edit a page via the API?
Cheers
-- Jeroen De Dauw http://blog.bn2vs.com Don't panic. Don't be evil. --
On Thu, Dec 9, 2010 at 5:28 PM, Jeroen De Dauw jeroendedauw@gmail.com wrote:
This appears to go wrong only on wikis rewriting urls.
You are rewriting into the root of the domain. This is guaranteed to go wrong and therefore an unsupported rewrite mode for MediaWiki.
Bryan
On Thu, Dec 9, 2010 at 10:47 AM, Bryan Tong Minh bryan.tongminh@gmail.comwrote:
On Thu, Dec 9, 2010 at 5:28 PM, Jeroen De Dauw jeroendedauw@gmail.com wrote:
This appears to go wrong only on wikis rewriting urls.
You are rewriting into the root of the domain. This is guaranteed to go wrong and therefore an unsupported rewrite mode for MediaWiki.
Traditionally I've shared the fervor to just say "don't do that", but since a lot of folks do it anyway, here's some advice that may help in this configuration. :)
As Bryan noted, it looks like what's happening is that your system has $wgScriptPath and $wgArticlePath pointing at the same place. Your rewrite rules at the web server level are excluding files such as api.php, but MediaWiki doesn't know about that exclusion; it sees an incoming URL in the $wgArticlePath space and ends up thinking it has an article title that it needs to extract.
Try setting $wgUsePathInfo = false in your LocalSettings.php. This should bypass these checks, and will avoid interfering with your input variables.
Of course this requires that your rewrite rules in the web server are using the title query string parameter, not appending it to the path.
-- brion
On 12/10/2010 12:39 AM, Brion Vibber wrote:
On Thu, Dec 9, 2010 at 10:47 AM, Bryan Tong Minh bryan.tongminh@gmail.comwrote:
On Thu, Dec 9, 2010 at 5:28 PM, Jeroen De Dauwjeroendedauw@gmail.com wrote:
This appears to go wrong only on wikis rewriting urls.
You are rewriting into the root of the domain. This is guaranteed to go wrong and therefore an unsupported rewrite mode for MediaWiki.
Traditionally I've shared the fervor to just say "don't do that", but since a lot of folks do it anyway, here's some advice that may help in this configuration. :)
As Bryan noted, it looks like what's happening is that your system has $wgScriptPath and $wgArticlePath pointing at the same place. Your rewrite rules at the web server level are excluding files such as api.php, but MediaWiki doesn't know about that exclusion; it sees an incoming URL in the $wgArticlePath space and ends up thinking it has an article title that it needs to extract.
Try setting $wgUsePathInfo = false in your LocalSettings.php. This should bypass these checks, and will avoid interfering with your input variables.
Of course this requires that your rewrite rules in the web server are using the title query string parameter, not appending it to the path.
This must be a relatively recent[1] regression: I use a similar setup on my wiki, and it worked just fine until I upgraded to svn trunk HEAD recently. It also seems to be only affecting api.php; normal requests work just fine.
Officially supported or not, I vote we fix it.
[1] "Relatively recent" here meaning since the 1.16 branch or so.
On 12/10/2010 03:47 AM, Ilmari Karonen wrote:
On 12/10/2010 12:39 AM, Brion Vibber wrote:
As Bryan noted, it looks like what's happening is that your system has $wgScriptPath and $wgArticlePath pointing at the same place. Your rewrite rules at the web server level are excluding files such as api.php, but MediaWiki doesn't know about that exclusion; it sees an incoming URL in the $wgArticlePath space and ends up thinking it has an article title that it needs to extract.
Try setting $wgUsePathInfo = false in your LocalSettings.php. This should bypass these checks, and will avoid interfering with your input variables.
Of course this requires that your rewrite rules in the web server are using the title query string parameter, not appending it to the path.
This must be a relatively recent[1] regression: I use a similar setup on my wiki, and it worked just fine until I upgraded to svn trunk HEAD recently. It also seems to be only affecting api.php; normal requests work just fine.
Officially supported or not, I vote we fix it.
[1] "Relatively recent" here meaning since the 1.16 branch or so.
OK, it seems I was mistaken, this was an old bug. Not sure why I hadn't noticed it before. Here's a report from 2008:
https://bugzilla.wikimedia.org/show_bug.cgi?id=16019
Anyway, it turned out to be easy enough to fix, as I've done in r78209. The patch is simple enough that it should probably apply cleanly to old MW versions too.
wikitech-l@lists.wikimedia.org