New Content - Implemented Relay browser not loading

CherryJ

New member
Hi I have an issue with the relay browser. Currently I can log into KoL through mafia and everything is ok until I try to turn on the relay browser. I just doesn't load and shows a blank page. Also I don't get any debug logs.
I'm currently running the newest mafia build (17179) and I had the same issue after downloading 17178 version. Anybody has any idea what to do?
 

CherryJ

New member
Okay, after a few tries to open the relay browser it finally showed something. I noticed in gCLI that it was sending a log in request every time I tried to open the relay browser, is this normal?
 

lostcalpolydude

Developer
Staff member
Okay, after a few tries to open the relay browser it finally showed something. I noticed in gCLI that it was sending a log in request every time I tried to open the relay browser, is this normal?

No, that's KoL logging you out each time, and mafia having to log back in. If it happened 100% of the time, then it could be a KoL change that mafia has to adapt to, but in this case it looks like an intermittent KoL issue.
 

ereinion

Member
I'm having the same problem with the game not loading in the relay browser. r17179 and Firefox 48.0.2. Didn't try loading it to many times since the only thing I do there is read my kmail and check announcements, which I strictly speaking can do from kolmafia anyway. Later on in the evening the problem was gone. Could just as easily be a kol as a mafia issue :p
 

fronobulax

Developer
Staff member
I ran one character this morning with no problems. Have not been able to get the relay browser to work normally with the others. I did manage to open the relay browser in a private window which supports the cookie name changed hypothesis.
 

lostcalpolydude

Developer
Staff member
Clearing cookies apparently allows the relay browser to open. I don't think I know enough about cookies to figure out how to fix this.
 

Veracity

Developer
Staff member
Code:
Retrieved: https://www.kingdomofloathing.com/login.php
Field: Set-Cookie = [PHPSESSID=i9tr5te1hhk7084d7do6s877h3; path=/, AWSALB=1HOUaMRO89JYkb8nBfrsK6maRGcdoJpTOmxa/LEVbQsBnwi1jPq7jvG2jw1m4p1SR7Y35Wq/dUKVBG5RcvMu7Zw89U1RAeBkZlIkGP/8hVnXCmkWUxfEvuveJZfB; Expires=Fri, 16-Sep-2016 15:43:04 GMT; Path=/]

Requesting: https://www.kingdomofloathing.com/actionbar.php?action=fetch
Field: Cookie = [PHPSESSID=i9tr5te1hhk7084d7do6s877h3; AWSALB=1HOUaMRO89JYkb8nBfrsK6maRGcdoJpTOmxa/LEVbQsBnwi1jPq7jvG2jw1m4p1SR7Y35Wq/dUKVBG5RcvMu7Zw89U1RAeBkZlIkGP/8hVnXCmkWUxfEvuveJZfB]

Retrieved: https://www.kingdomofloathing.com/actionbar.php?action=fetch
Field: Set-Cookie = [AWSALB=V4c03V6GLYrGmSitogQrJu2feuDxvRmeW6sFdN/ABUhwbUdou8pV9GEnYz/I4l5fYs7i0jeRqwcQD8wa1jTqmzK4Jea1c+JKmesbDC0HK9sYTAGP4Ay8wwu1Nnfc; Expires=Fri, 16-Sep-2016 15:43:05 GMT; Path=/]

Requesting: https://www.kingdomofloathing.com/main.php
Field: Cookie = [PHPSESSID=i9tr5te1hhk7084d7do6s877h3; AWSALB=1HOUaMRO89JYkb8nBfrsK6maRGcdoJpTOmxa/LEVbQsBnwi1jPq7jvG2jw1m4p1SR7Y35Wq/dUKVBG5RcvMu7Zw89U1RAeBkZlIkGP/8hVnXCmkWUxfEvuveJZfB]

Retrieved: https://www.kingdomofloathing.com/main.php
Field: Set-Cookie = [AWSALB=JCauxk6DlvPxf1rUq0GcQDO30KVSywyCikajRODMRA3CrhC67AVen5Lt5KBAeCTw4+d/JDXtyFznG6fGsyg2cEzPUerg0TEMDcY9+7mnHS3CkPQc+IxCLkEjnR3O; Expires=Fri, 16-Sep-2016 15:43:06 GMT; Path=/]

Requesting: https://www.kingdomofloathing.com/topmenu.php
Field: Cookie = [PHPSESSID=i9tr5te1hhk7084d7do6s877h3; AWSALB=1HOUaMRO89JYkb8nBfrsK6maRGcdoJpTOmxa/LEVbQsBnwi1jPq7jvG2jw1m4p1SR7Y35Wq/dUKVBG5RcvMu7Zw89U1RAeBkZlIkGP/8hVnXCmkWUxfEvuveJZfB]
Notice that we get PHPSESSID and save it, as always.
We are also given AWSALB and save it - and give it back with every request.
Every response seems to give us a new value for that cookie, but we don't seem to overwrite our saved copy; we continue to give the original one back.

Opening the Relay Browser:

Code:
GET /game.php HTTP/1.1
Cookie: AWSALB=jbflV9ajOq+M2tOjt9+kT7U8149q0KRRJjWgx41SSPwql1gbaAnrw5n3fQivBlb75sIU0qRInjXGfK5kV+SsF4OOdYWE2JOWQiprmReE4xrOkuiJGWWWrMaHBMVB

Requesting: https://www.kingdomofloathing.com/game.php
Field: Cookie = [AWSALB=jbflV9ajOq+M2tOjt9+kT7U8149q0KRRJjWgx41SSPwql1gbaAnrw5n3fQivBlb75sIU0qRInjXGfK5kV+SsF4OOdYWE2JOWQiprmReE4xrOkuiJGWWWrMaHBMVB; PHPSESSID=i9tr5te1hhk7084d7do6s877h3; AWSALB=1HOUaMRO89JYkb8nBfrsK6maRGcdoJpTOmxa/LEVbQsBnwi1jPq7jvG2jw1m4p1SR7Y35Wq/dUKVBG5RcvMu7Zw89U1RAeBkZlIkGP/8hVnXCmkWUxfEvuveJZfB]

Retrieved: https://www.kingdomofloathing.com/game.php
Field: null = [HTTP/1.1 302 Moved Temporarily]
Field: Location = [login.php?notloggedin=1]
Field: Set-Cookie = [AWSALB=AEgGAIbZ3iyU906pXyBdQHIDnRJX0SxNLWiCjSUB6ZO9vxbGgMBAr2k3zQg/ym6xtGDfLl/p/K7jyR1y7+tLolLxAQ7Ei7GMI6LpEWKDh54TuFZpc9rRqBidFFLa; Expires=Fri, 16-Sep-2016 15:43:25 GMT; Path=/]
The Browser does a GET and passes up its saved value of the AWSALB cookie.
KoLmafia puts that in the cookie string - and appends its PHPSESSID and its originally save AWSALB cookie.

KoL responds with a redirect to login.php and a new AWSALB cookie.

1) We should update AWSALB every time we get a new one.
2) We should ignore the browser's AWSALB (and PHPSESSID) and just use our own.

The result of the current situation, for me, is that, after multiple retries, we pass down the notloggedin to the browser and Firefox asks me what to do with the "php" file it wants.

The issue seems to be that LoginRequest.processLoginRequest looks at the Set-Cookie header and assumes that everything there is the "serverCookie". When the only thing there was PHPSESSID, yes. But now there is ALSO a AWSALB cookie there.

Perhaps we should save serverCookie to exclude the AWSALB cookie and save that one separately - and also reparse every time we get a Set-Cookie. Or something.

I'm out for the rest of the afternoon. Perhaps I can look at this again in the evening.
 

lostcalpolydude

Developer
Staff member
We will probably want a new release after this. I can't make all the new files for that, but I ran all the check commands and updated data files.
 

Honesty

New member
Load in Web Browser not working

Hi, I wonder if anyone can help. I have a problem that has manifested itself only in the last couple of days. No matter what I do - logging out, reinstalling the very latest build of Mafia, etc - the 'load web browser' command opens a blank window in my web browser. I use Chrome in Windows 10. I've used Mafia for ages and haven't had a problem before. Any ideas? It's driving me mad, because I can't play the game! I can't go back to the plain old un-Mafia-ed Kingdom!
 

fronobulax

Developer
Staff member
Hi, I wonder if anyone can help. I have a problem that has manifested itself only in the last couple of days. No matter what I do - logging out, reinstalling the very latest build of Mafia, etc - the 'load web browser' command opens a blank window in my web browser. I use Chrome in Windows 10. I've used Mafia for ages and haven't had a problem before. Any ideas? It's driving me mad, because I can't play the game! I can't go back to the plain old un-Mafia-ed Kingdom!

Merged. Known problem. Now that I have merged this, feel free to look at the rest of the thread. Try deleting cookies or reloading the relay browser in a private window.
 

Veracity

Developer
Staff member
Revision 17184 seems to work for me. I'll give it a day or two to shake out issues and then spin a release.
Thanks for the data fixes, lost.
 

Veracity

Developer
Staff member
And there is now strange behavior when a script wants to look at an external site. Here's a debug log:

Code:
-----From Browser-----
GET /relay_PVP_Bookkeeper.ash HTTP/1.1
Host: 127.0.0.1:60080
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:48.0) Gecko/20100101 Firefox/48.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://127.0.0.1:60080/topmenu.php
Cookie: AWSALB=HX09DA+pZkkeWzJ72Fza/fb53WMC6bRZWbhFmFeB/oJigUyW/z+gKjW+AT8wMhIf1zNLIeMiFPKQzDkn6ADMzZ7pqIi4rRBCfqotaV2gFW8tKZdEzOy0wLwx3biR
Connection: keep-alive
Upgrade-Insecure-Requests: 1
----------
Starting relay script: relay_PVP_Bookkeeper.ash
class net.sourceforge.kolmafia.request.RelayRequest
Connecting to http://kolmafia.us/showthread.php...

Requesting: http://www.kingdomofloathing.com/http://kolmafia.us/showthread.php?t=10762-Vhaeraun-s-Glorious-PVP-Bookkeeper
2 request properties
Field: User-Agent = [Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:48.0) Gecko/20100101 Firefox/48.0]
Field: Content-Type = [application/x-www-form-urlencoded]

Retrieving server reply...

Retrieved: http://www.kingdomofloathing.com/http://kolmafia.us/showthread.php?t=10762-Vhaeraun-s-Glorious-PVP-Bookkeeper
10 header fields
Field: Transfer-Encoding = [chunked]
Field: null = [HTTP/1.1 200 OK]
Field: CF-RAY = [2e0bf24ee4f05a44-BOS]
Field: Server = [cloudflare-nginx]
Field: Cache-Control = [private]
Field: Connection = [keep-alive]
Field: Set-Cookie = [bb_lastactivity=0; expires=Mon, 11-Sep-2017 14:50:39 GMT; Max-Age=31536000; path=/; domain=.kolmafia.us, bb_lastvisit=1473605439; expires=Mon, 11-Sep-2017 14:50:39 GMT; Max-Age=31536000; path=/; domain=.kolmafia.us, bb_; path=/; domain=.kolmafia.us; HttpOnly, __cfduid=d5bcb83b1881f63999aa957fec0d380781473605578; expires=Mon, 11-Sep-17 14:52:58 GMT; path=/; domain=.kolmafia.us; HttpOnly]
Field: Pragma = [private]
Field: Date = [Sun, 11 Sep 2016 14:52:58 GMT]
Field: Content-Type = [text/html; charset=ISO-8859-1]
And at this point, KoLmafia just runs and runs.

I would expect the script to start looking at my PVP history, but I see nothing.

1) Script requests "http://kolmafia.us/showthread.php?t=10762-Vhaeraun-s-Glorious-PVP-Bookkeeper"
2) KoLmafia requests "http://www.kingdomofloathing.com/http://kolmafia.us/showthread.php?t=10762-Vhaeraun-s-Glorious-PVP-Bookkeeper"
Whu?
3) It seems to actually connect. Notice the cookies kolmafia.us returns:

Field: Set-Cookie = [bb_lastactivity=0; expires=Mon, 11-Sep-2017 14:50:39 GMT; Max-Age=31536000; path=/; domain=.kolmafia.us, bb_lastvisit=1473605439; expires=Mon, 11-Sep-2017 14:50:39 GMT; Max-Age=31536000; path=/; domain=.kolmafia.us, bb_; path=/; domain=.kolmafia.us; HttpOnly, __cfduid=d5bcb83b1881f63999aa957fec0d380781473605578; expires=Mon, 11-Sep-17 14:52:58 GMT; path=/; domain=.kolmafia.us; HttpOnly]

(We are not handling "domain". We need to.)
4) At this point KoLmafia is pegging CPU
5) And notice that there is no -----To Browser----- showing we sent the response down.

I will investigate.
 

Veracity

Developer
Staff member
Actually, it hasn't sent a response to the browser since the relay script didn't finish executing yet. So, duh.

Still investigating.
 

Veracity

Developer
Staff member
Yeah. Infinite loop if the cookie as a monadic attribute like "HttpOnly". Also, don't bother parsing and saving cookies for external requests; only ones from KoL itself are interesting. With that, we probably don't care about "domain".

Revision 17186.
 

Bale

Minion
OH! So that's what happened to me last night. I disabled part of my script to allow it to run and resolved to take a closer look later since it didn't make sense to me. Glad you fixed it before I got crazy.
 
Top