On 1/4/08, catrope@svn.wikimedia.org catrope@svn.wikimedia.org wrote:
Revision: 29261 . . .
- Unbroke Special:Userrights for wikis without pretty URLs
** This probably shouldn't be hard-coded the way I did it . . .
$form .= Xml::hidden( 'title', 'Special:Userrights' );
Strange. I'm not sure how to fix this more correctly. You would think that action="http://example.com/w/index.php?title=Special:Userrights" plus a parameter user=Username would give a URL of http://example.com/w/index.php?title=Special:Userrights&user=Username, appending the parameters to the URL correctly, but you're right, it seems to give http://example.com/w/index.php?user=Username. Maybe that's why it was POSTed in the first place.
Perhaps the best thing to do would be to just always use non-pretty URLs for this, the way we do all the other times we use URL parameters. I don't have time to implement that this minute, unfortunately. Maybe later, if no one else does it first.
Simetrical schreef:
On 1/4/08, catrope@svn.wikimedia.org catrope@svn.wikimedia.org wrote:
Revision: 29261 . . .
- Unbroke Special:Userrights for wikis without pretty URLs
** This probably shouldn't be hard-coded the way I did it . . .
$form .= Xml::hidden( 'title', 'Special:Userrights' );
Strange. I'm not sure how to fix this more correctly. You would think that action="http://example.com/w/index.php?title=Special:Userrights" plus a parameter user=Username would give a URL of http://example.com/w/index.php?title=Special:Userrights&user=Username, appending the parameters to the URL correctly, but you're right, it seems to give http://example.com/w/index.php?user=Username. Maybe that's why it was POSTed in the first place.
Why was it changed from POST to GET then?
BTW, it's kind of weird that this works with pretty URLs, but not with regular ones. One of the advantages of having PHP as a CGI on a Windows box, I guess (if not the only advantage).
Roan Kattouw (Catrope)
On 1/4/08, Roan Kattouw roan.kattouw@home.nl wrote:
Why was it changed from POST to GET then?
Because GET should be used for idempotent requests such as searches, as specified by the HTTP and HTML standards. There are a variety of reasons for that. A couple directly applicable here are
1) The URL to change the rights for a given user can now be easily copied and linked to directly (e.g., for adding a link in the toolbox of user pages). 2) Refreshing the page won't give an annoying and unnecessary warning.
In general, user agents treat GET requests as idempotent and POST requests as non-idempotent, as the standard specifies, and it's overall a good thing to do what user agents expect.
Simetrical wrote:
On 1/4/08, catrope@svn.wikimedia.org catrope@svn.wikimedia.org wrote:
Revision: 29261 . . .
- Unbroke Special:Userrights for wikis without pretty URLs
** This probably shouldn't be hard-coded the way I did it . . .
$form .= Xml::hidden( 'title', 'Special:Userrights' );
Strange. I'm not sure how to fix this more correctly. You would think that action="http://example.com/w/index.php?title=Special:Userrights" plus a parameter user=Username would give a URL of http://example.com/w/index.php?title=Special:Userrights&user=Username, appending the parameters to the URL correctly, but you're right, it seems to give http://example.com/w/index.php?user=Username.
I'm not sure if the spec says anything on this, but in practice any query string on the form action URL gets stripped on GET requests, replaced with the newly constructed one.
GET-based forms that aim to a specific page thus should point at $wgScript as the action and put in the title separately as a hidden field.
(I fixed the fix for this in my last commit.)
In theory we could change the behavior to check if an submission article path is in 'pretty' style and split up the title appropriately between the action URL and the form contents. If we do so it might also be wise to start using action=submit more consistently, and/or give the option of a separate submit path in $wgActionPaths.
Just thinking out load. :)
-- brion
wikitech-l@lists.wikimedia.org