Menu

#178 getprojectfile script sometimes pretends to succeed

workingwiki
open
None
5
2013-05-07
2012-05-04
Lee Worden
No

sometimes is correctly says "401 unauthorized" when it doesn't have the right password to log in to the wiki, but in other cases it downloads and saves the HTML text of the "you must log in" wiki page, which is not desired.

Discussion

  • Lee Worden

    Lee Worden - 2012-05-05

    The difference has to do with the setting of $wgWhitelistRead, the list of pages that are allowed even to non-logged-in users. By default it's only the login page and FAQ page. WorkingWiki.php adds Special:GetProjectFile to the list, and then has Special:GetProjectFile check whether the user is logged in and return a 401 Unauthorized if not. This allows S:GPF urls for images to work like any other images, and allows the getprojectfile script to detect the problem.

    But getprojectfile should probably try to do something sane even if wiki admins decide not to allow Special:GetProjectFile to be whitelisted. Unfortunately, in that case, MediaWiki produces a normal-looking wiki page that just happens to include text telling the user to log in. What's a robust way to detect it?

    Maybe there's a hook I can use to add something unmistakeable to the page?

     
  • Lee Worden

    Lee Worden - 2012-05-05

    Nope, there doesn't seem to be any hooks. Also, the text is internationalized, and I can't assume the error text will be in English.

     
  • Lee Worden

    Lee Worden - 2012-05-05

    I guess I could do the reverse, and have Special:GetProjectFile return a special header so I can detect its absence...

     
  • Lee Worden

    Lee Worden - 2012-05-05

    have sucessfully added 'X-Generator: WorkingWiki' header to Special:GetProjectFile output, I think. Still need to make getprojectfile script check for it.

     

Anonymous
Anonymous

Add attachments
Cancel