Last modified: 2009-12-09 15:04:47 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T11981, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 9981 - Bot keeps losing session cookie
Bot keeps losing session cookie
Status: RESOLVED INVALID
Product: Wikimedia
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-05-20 17:08 UTC by Sebastian Moleski
Modified: 2009-12-09 15:04 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Sebastian Moleski 2007-05-20 17:08:15 UTC
For about a week now my bots keep losing session information. Until now, the bot would open special:userlogin at the start of a run, keep the cookie it gets and send it with each edit. For some reason, this doesn't seem to always work anymore. A good example of what happens can be shown here:
1.) logged on: http://de.wikipedia.org/w/index.php?title=Spezial:Beitr%C3%A4ge&dir=prev&offset=20070520165517&limit=6&contribs=user&target=Sebbot
2.) suddenly logged off: 
http://de.wikipedia.org/w/index.php?title=Spezial:Beitr%C3%A4ge&dir=prev&offset=20070520164842&limit=10&target=85.178.200.216

There are no IP changes and a delay of no more than 20 seconds between the edit with and without login information. Is there something I should do differently so this doesn't happen anymore?
Comment 1 Marco 2007-06-15 19:37:22 UTC
You have to request Spezial:Anmelden twice.

1) a normal HTTP request to http://de.wikipedia.org/wiki/Spezial:Anmelden *without* sending any form of cookies, POST or GET data
2) you get a session cookie. formed like this:
 Set-Cookie: dewiki_session=blablablablubblub; path=/
3) Take the cookie and remember it.
4) Send a HTTP POST request to  http://de.wikipedia.org/w/index.php?title=Spezial:Anmelden&action=submitlogin&type=login with following details
- Take care of the action=submitlogin&type=login in the URI
- Send the dewiki_session cookie you just got
- The POST data: wpRemember=1&wpName=USER&wpPassword=PASSWORD&wpLoginattempt=Anmelden
- Of course replace the placeholders; do not forget to urlencode() them.
5) You get three additional cookies back with the success message:
Set-Cookie: dewikiUserID=blub; expires=Sun, 15-Jul-2007 19:15:55 GMT; path=/
Set-Cookie: dewikiUserName=blub; expires=Sun, 15-Jul-2007 19:15:55 GMT; path=/
Set-Cookie: dewikiToken=blubblubblabla; expires=Sun, 15-Jul-2007 19:15:55 GMT; path=/
6) Include these cookies AND the dewiki_session cookie you got in 2) at *EVERY* request you do, regardless if you read only or submit a edit. Note you *must not* take care of the EXPIRES attribute!

Marco
Comment 2 Chad H. 2009-12-09 15:04:47 UTC
Marking INVALID because A) partly seems like user error, B) WFM, C) because you should be using the API for bots by now and D) bugs in the API would go elsewhere.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links