Bug - Fixed Relay Browser doesn't work in Chrome now

psly4mne

Member
When I open the relay browser in Chrome (on Mac), I get redirected to the login page. I believe it works in Safari and Firefox. Reverting to r15471 fixes the behavior.
 

psly4mne

Member
No log of any kind was generated when I did this, just a clean logged out page in the browser. My charpane loads, then I get redirected to login.php. Is there a way I can generate a log?
 

Veracity

Developer
Staff member
So, I set Preferences/External Programs/Browsers to Chrome
nothing.

I set it to Google Chrome
nothing.

It's not worth my time to try to figure out how to make the Relay Browser to open Chrome. Safari and Firefox are easy. Chrome requires ... something .. different.

I'm willing to try it myself to figure out your issue, but I am not willing to spend (who-knows-how-many) hours of effort trying to figure out how to reproduce it.

Instructions, and a DEBUG log, please?

Thanks.
 

Veracity

Developer
Staff member
No log of any kind was generated when I did this, just a clean logged out page in the browser. My charpane loads, then I get redirected to login.php. Is there a way I can generate a log?
Yes. Turn on debug logging, exactly the same way you'd do it any other time you want to force a debug log.

> debug on
(click the icon to start the Relay Browser)
> debug off
 

psly4mne

Member
I similarly can't get the relay browser to open in Chrome through the setting. I have Chrome set as my OS default browser, but you could also paste http://127.0.0.1:60080/game.php into the address bar in Chrome.

Like I said, doing this didn't generate a debug log. I'll gladly try it again if there is a setting that will cause it to log something.

...

I'm now seeing inconsistent behavior (on 15477). Sometimes it works normally, but usually the relay browser gets a redirect as reported. Sometimes waiting a few minutes are reopening the relay browser fixes it.
 
Last edited:

Veracity

Developer
Staff member
"gets a redirect as reported"

That would show up in the debug log - if you had started the debug log before starting the Relay Browser. I told you exactly how to do that; it is not "a setting which will cause it to log something". It is you, explicitly, telling it to "start logging", using the technique I told you.

I am not going to make Chrome my default browser. Perhaps I will try again later - but a debug log would sure help...
 

psly4mne

Member
View attachment DEBUG_20150225.txt

Sorry, I didn't see your second reply before I replied as I was trying to figure out what was going on. Debug log attached.

I did mention another way to open the relay browser in Chrome though - pasting the address into the address bar works fine.
 
Last edited:
Just to add a data point, I use chrome via that setting = "chrome" (w/o quotes) (default browser is IE). I haven't experienced the problem described here. Currently at r15477, but I don't run every build, so I wouldn't see all possibilities.

Anyway, hopefully this helps a bit with general direction.
 

Veracity

Developer
Staff member
Well, I, like psly, have a Mac, so things are probably different.

I vaguely remember seeing instructions on how to start Chrome, but all the energy drains out of me when I think about trying to search for those instructions.

I looked at the log and I see that somewhere it decided it needed to log out. I don't see any indication of WHY it decided that. I expect that if I could reproduce it on my system I could debug it, but for the moment, I am stumped.
 

Bale

Minion
For what it is worth (very little) I tried opening KoL in Chrome on my PC. No problem at all.
 

lostcalpolydude

Developer
Staff member
Going from memory (never mind, found my post from 4 years ago), what's needed is "-b com.google.Chrome" (without quotes?) to tell OS X to open Chrome as the relay browser. I no longer have a mac to test that on though.

On the other hand, I think BrowserLauncher may have been completely replaced since then, so that might not work anyway.
 
Last edited:

Lxndr

Member
For what it is worth (very little) I tried opening KoL in Chrome on my PC. No problem at all.

For some reason, my PC began having trouble this morning with opening chrome as the relay browser. It's worked before. But after downloading r15479, it will not launch chrome, nor will it open a tab.
 

Veracity

Developer
Staff member
What's needed is "-b com.google.Chrome" (without quotes?) to tell OS X to open Chrome as the relay browser.
That worked. Thanks.

Chrome also worked fine as my Relay Browser.

Looking again at psly's log:

Code:
-----From Browser-----
GET /account_combatmacros.php HTTP/1.1
Host: 127.0.0.1:60080
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Cookie: frcm_style=3; chatpwd=250; [appserver=www11]; appserver=www9; charpwd=266
----------

Requesting: http://www.kingdomofloathing.com/account_combatmacros.php
2 request properties
Field: Cookie = [frcm_style=3; chatpwd=250; [appserver=www11]; appserver=www9; charpwd=266; appserver=www9; PHPSESSID=f2k5lris0phd4ju6bu144jlig5]
Field: User-Agent = [Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36]

Retrieved: http://www.kingdomofloathing.com/account_combatmacros.php
10 header fields
Field: null = [HTTP/1.1 200 OK]
Field: Cache-Control = [no-store, no-cache, must-revalidate, post-check=0, pre-check=0]
Field: Server = [nginx/1.0.15]
Field: Connection = [keep-alive]
Field: Pragma = [no-cache]
Field: Expires = [Thu, 19 Nov 1981 08:52:00 GMT]
Field: Content-Length = [2889]
Field: Date = [Wed, 25 Feb 2015 05:39:45 GMT]
Field: X-Powered-By = [PHP/5.3.3]
Field: Content-Type = [text/html; charset=UTF-8]
-----To Browser-----
HTTP/1.1 200 OK
Server: nginx/1.0.15
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Date: Wed, 25 Feb 2015 05:39:45 GMT
X-Powered-By: PHP/5.3.3
Content-Type: text/html; charset=UTF-8
Content-Length: 3029
Cache-Control: no-cache, must-revalidate
Pragma: no-cache
I see that the browser supplied the following cookies:

Cookie: frcm_style=3; chatpwd=250; [appserver=www11]; appserver=www9; charpwd=266

Those appserver cookies are just wacko - especially since when you connect via the relay browser, we do not propagate those down from KoL. You must have logged in without KoLmafia a few times in the past and Chrome retained, or something.

We sent them up to KoL:

Field: Cookie = [frcm_style=3; chatpwd=250; [appserver=www11]; appserver=www9; charpwd=266; appserver=www9; PHPSESSID=f2k5lris0phd4ju6bu144jlig5]

Notice that we took the browser-supplied list and then appended the ones that we were using to communicate with KoL. It responded and didn't seem to mind. Perhaps I should trim out any "appserver" cookies from the Browser...

Later in the log:

Code:
-----From Browser-----
GET /newchatmessages.php?aa=0.590283774305135&j=1&lasttime=1397264456 HTTP/1.1
Host: 127.0.0.1:60080
Connection: keep-alive
Accept: application/json, text/javascript, */*; q=0.01
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36
Referer: http://127.0.0.1:60080/mchat.php
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Cookie: frcm_style=3; chatpwd=250; [appserver=www11]; appserver=www9; charpwd=266
----------
class net.sourceforge.kolmafia.request.ChatRequest
Connecting to newchatmessages.php...

Requesting: http://www.kingdomofloathing.com/newchatmessages.php?j=1&lasttime=1397264456
2 request properties
Field: Cookie = [appserver=www9; PHPSESSID=f2k5lris0phd4ju6bu144jlig5]
Field: User-Agent = [Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36]

Retrieving server reply...

Retrieved: http://www.kingdomofloathing.com/newchatmessages.php?j=1&lasttime=1397264456
10 header fields
Field: null = [HTTP/1.1 200 OK]
Field: Cache-Control = [no-store, no-cache, must-revalidate, post-check=0, pre-check=0]
Field: Server = [nginx/1.0.15]
Field: Connection = [keep-alive]
Field: Pragma = [no-cache]
Field: Expires = [Thu, 19 Nov 1981 08:52:00 GMT]
Field: Content-Length = [44]
Field: Date = [Wed, 25 Feb 2015 05:39:48 GMT]
Field: X-Powered-By = [PHP/5.3.3]
Field: Content-Type = [text/html; charset=UTF-8]

Retrieving server reply
ResponseText has 44 characters.
{"msgs":[],"last":"1397264459","delay":3000}
-----To Browser-----
HTTP/1.1 200 OK
Date: Wed Feb 25 00:39:48 EST 2015
Server: KoLmafia v16.8
Content-Type: text/html; charset=UTF-8
Cache-Control: no-cache, must-revalidate
Pragma: no-cache
Connection: close
{"msgs":[],"last":"1397264459","delay":3000}
----------
Even though the Browser requested newchatmessages.php, we internally converted that into a ChatRequest and, therefore, did not include the browser-supplied cookies.

This was immediately followed by:

Code:
Loading window: LoginFrame
Logout in progress (interface will be unresponsive)...
Preparing for logout...
Sharing mall price data with other users...
You have no updated price data to submit.
Requests complete.

Sending logout request...
class net.sourceforge.kolmafia.request.LogoutRequest
Connecting to logout.php...

Requesting: http://www.kingdomofloathing.com/logout.php
1 request properties
Field: User-Agent = [Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36]

Retrieving server reply...

Retrieved: http://www.kingdomofloathing.com/logout.php
8 header fields
Field: null = [HTTP/1.1 302 Found]
Field: Server = [nginx/1.0.15]
Field: Connection = [keep-alive]
Field: Content-Length = [0]
Field: Date = [Wed, 25 Feb 2015 05:39:49 GMT]
Field: Location = [loggedout.php]
Field: X-Powered-By = [PHP/5.3.3]
Field: Content-Type = [text/html; charset=UTF-8]
KoLmafia logged you out. I did a grep for "Logout in progress" and found it in KoLmafia.quit.

Code:
./chat/ChatManager.java:584:					KoLmafia.quit();
./request/LoginRequest.java:348:			KoLmafia.quit();
./swingui/LoginFrame.java:163:			KoLmafia.quit();
./swingui/SystemTrayFrame.java:262:			KoLmafia.quit();
./textui/command/ExitCommand.java:49:		KoLmafia.quit();
./webui/RelayServer.java:162:				KoLmafia.quit();
1) If you are a buffbot, any one in your clan can tell you to log off, using chat
2) If you are already logging in and we want to timein, we can't handle it
3) We can log you out from the login frame, somehow
4) You can exit via the System Tray
5) You can use the "exit" command
6) We can try to open a server socket, using port 60080 up to 60089, and not succeed in doing so.

None of those really make any sense.
 

Veracity

Developer
Staff member
For some reason, my PC began having trouble this morning with opening chrome as the relay browser. It's worked before. But after downloading r15479, it will not launch chrome, nor will it open a tab.
Nothing has changed in how we launch the Relay Browser.
 

psly4mne

Member
I tried clearing my cookies from kingdomofloathing.com, and I was able to open the relay browser successfully the first time, but after that I had the same weird cookies and logout.
This time I don't see "Logout in progress" in my debug log, and there are no requests to newchatmessages.php.
View attachment DEBUG_20150225.txt
 
Last edited:

Veracity

Developer
Staff member
I have to say its those cookies; you were really connected to www11, but the browser was passing up a www10 cookie and we were including it, along with the correct one, and KoL responded by saying you are not logged in.

Revision 15482 removes appserver cookies passed up from the browser.
Tell me if it works better for you.
 
Top