Bug - Fixed Corrupted Content Error (Relay Browser-Firefox)

ashmodel

New member
First, I'd like to say that KoLmafia has always been super user friendly, these forums are very helpful whenever I've had an issue, and in the several years I've been using mafia I've never had any reason to even consider posting a bug report, so this is not at all a complaint.
For the past several days I've been having an issue where the first time I load virtually any page in the relay browser (using firefox), it gives me a grey page with an error message saying "Corrupted Content Error
The page you are trying to view cannot be shown because an error in the data transmission was detected. Please contact the website owners to inform them of this problem." and gives me the option to try again. If I click try again, it usually immediately loads up the page correctly and then I can continue normally, but every change of location, fight, change of inventory tabs, etc. causes this same error to generate, seemingly every page refresh. Typically the chat/update news pane at the right loads properly and when the chat is running, it updates properly and doesn't display this error, but the adventure window, top menu and char pane all seem to have issues. I had the issue initially with build 15477, didn't think much of it as sometimes things just act a little buggy. Continued having the issue after downloading mafia 6.8 and have had it again this evening using build 15486. When I attempt to open the relay in chrome I run into a similar issue where it won't properly load a page but it gives a different error message. I have tried clearing cookies and cached files to attempt to correct the issue and haven't had any luck.
I've tried searching the forums but haven't found any posts about this same issue, so I hope this is not redundant.
I would appreciate any assistance you could provide, or if anyone has run into this issue before and has sage advice on how to fix it, that would be wonderful.
Thanks for your time.
 

Attachments

  • DEBUG_20150225.txt
    218.6 KB · Views: 1,132

Veracity

Developer
Staff member
Set the following "extra debugging" options:

- Verbosely log communication between KoLmafia and browser
- Log decorated responses in debug log

and get another debug log, please.
 

ashmodel

New member
Absolutely.
Here is the new log.
I tried to move around and do a few different tasks while the debug log was being created to try and catch a few different instances. I know I got the error while entering combat, when changing zone to the mysterious island as well as when entering the underworld, each time I had to click the try again button before the page would load properly, when it occurs when entering combat and I use the try again button, it loads the combat page with the message "you twiddle your thumbs" as if I've clicked a non-valid option.
 

Attachments

  • DEBUG_20150225.txt
    1.8 MB · Views: 302

Veracity

Developer
Staff member
OK, this is a bit wacko. I extracted the following from your "visit the island", which you said failed.

Code:
-----From Browser-----
GET /island.php HTTP/1.1
Host: 127.0.0.1:60080
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.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
DNT: 1
Referer: http://127.0.0.1:60080/awesomemenu.php
Cookie: chatpwd=233; inventory=56
Connection: keep-alive
----------
class net.sourceforge.kolmafia.request.RelayRequest
Connecting to island.php...

Requesting: http://www.kingdomofloathing.com/island.php
2 request properties
Field: Cookie = [chatpwd=233; inventory=56; PHPSESSID=fd16ri7hkfs1rmfl31gic2p770; appserver=www9]
Field: User-Agent = [KoLmafia v16.8]

Retrieving server reply...
Retrieved: http://www.kingdomofloathing.com/island.php
12 header fields
Field: null = [HTTP/1.1 302 Found]
Field: X-TurboPage = [Direct]
Field: Date = [Thu, 26 Feb 2015 02:33:38 GMT]
Field: Content-Length = [1063]
Field: Expires = [Thu, 19 Nov 1981 08:52:00 GMT]
Field: Location = [bigisland.php]
Field: Connection = [Close]
Field: Content-Type = [text/html; charset=UTF-8]
Field: X-Powered-By = [PHP/5.3.3]
Field: Server = [nginx/1.0.15]
Field: Pragma = [no-cache]
Field: Cache-Control = [no-store, no-cache, must-revalidate, post-check=0, pre-check=0]

-----To Browser-----
HTTP/1.1 302 Found
Date: Wed Feb 25 21:33:52 EST 2015
Server: KoLmafia v16.8
Location: bigisland.php
Connection: close
--------------------------------
-----From Browser-----
GET /bigisland.php HTTP/1.1
Host: 127.0.0.1:60080
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.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
DNT: 1
Referer: http://127.0.0.1:60080/awesomemenu.php
Cookie: chatpwd=233; inventory=56
Connection: keep-alive
----------
class net.sourceforge.kolmafia.request.RelayRequest
Connecting to bigisland.php...

Requesting: http://www.kingdomofloathing.com/bigisland.php
2 request properties
Field: Cookie = [chatpwd=233; inventory=56; PHPSESSID=fd16ri7hkfs1rmfl31gic2p770; appserver=www9]
Field: User-Agent = [KoLmafia v16.8]

Retrieving server reply...

Retrieved: http://www.kingdomofloathing.com/bigisland.php
11 header fields
Field: null = [HTTP/1.1 200 OK]
Field: CONTENT-LENGTH = [00011302]
Field: X-TurboPage = [Prefetch]
Field: Date = [Thu, 26 Feb 2015 02:33:38 GMT]
Field: Expires = [Thu, 19 Nov 1981 08:52:00 GMT]
Field: Connection = [Close]
Field: Content-Type = [text/html; charset=UTF-8]
Field: X-Powered-By = [PHP/5.3.3]
Field: Server = [nginx/1.0.15]
Field: Cache-Control = [no-store, no-cache, must-revalidate, post-check=0, pre-check=0]
Field: Pragma = [no-cache]

Retrieving server reply
ResponseText has 11302 characters.
...
-----To Browser-----
HTTP/1.1 200 OK
CONTENT-LENGTH: 00011302
X-TurboPage: Prefetch
Date: Thu, 26 Feb 2015 02:33:38 GMT
Expires: Thu, 19 Nov 1981 08:52:00 GMT
X-Powered-By: PHP/5.3.3
Server: nginx/1.0.15
Content-Type: text/html; charset=UTF-8
Content-Length: 11294
Cache-Control: no-cache, must-revalidate
Pragma: no-cache
...
1) The browser submitted a request to island.php. It included "inventory=56", which SHOULD only be needed for the inventory, but, whatever. Probably, we should strip out any such cookie from the browser, since KoLmafia itself saves the correct inventory cookie and will submit it, when necessary.
2) The request redirected to "bigisland.php". We sent the redirect down to the browser, and it submitted a request to that. Cool.
3) When the request came back, KoL included the following header:

Code:
CONTENT-LENGTH: 00011302
and we added our own (correct) header:
Code:
Content-Length: 11294
Well, isn't that special. I have never, ever, seen KoL include a header like that - but, I use the "use Browser's User Agent" and you clearly do not; requests from your browser say:

Code:
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0
but we tell the following to KoL:

Code:
Field: User-Agent = [KoLmafia v16.8]
It looks like KoL itself tailors its responses based on what browser it thinks is making the request. With MY Browser (where I send up the actual browser's User-Agent, whether it is a Relay Request or an internal request), I get "Transfer-Type: chunked". With the user agent = KoLmafia v16.8, it decides to include a CONTENT-LENGTH field - all upper case like that.

I will do the following:

1) ignore "inventory" cookies from the browser, since we include the correct one, exactly when it is needed.
2) Ignore any "Content-Length" (case insensitive) from KoL, since we will generate the correct one ourself.

Stay tuned.
 

Veracity

Developer
Staff member
OK, revision 15487 should correctly suppress CONTENT-LENGTH headers from KoL, rather than just Content-Length headers.

Tell me if it works better for you. Thanks.
 

ashmodel

New member
It's working perfectly.
Thank you so much!
I figured I might get a work around or some setting I needed to change to fix the issue, I wasn't expecting a whole build release just to fix my (what seems to be totally isolated) issue. It made me feel very special.
Thanks again.
 

Veracity

Developer
Staff member
There is a Rule of Network Protocol Implementation (something I have been involved in since 1980, believe it or not; I have personally implemented the entire TCP/IP stack 2.5 times, on 3 different OS's).

Be Strict in what you generate and Lenient in what you accept.

KoL - and its web server, as we can see from your issue - are Sloppy in what they generate. So, I loosened our Leniency in coping with that sloppiness and tightened our Strictness in what we give the browser. I recently changed KoLmafia to be a better HTTP proxy, but I tested with only my configuration, and there have been multiple examples - of which you are the latest - of people with different configurations getting things I did not expect. I COULD have told you "check the 'Use Last Browser User Agent' setting", but, why should you have to do that? We should work correctly with every setting that we make available to you.

Which is not intended to burst your bubble of specialness, since, although I didn't do it just for you, your bug report was important. It warranted - and received - prompt attention and fixing.

Thank you for your bug report.
 
Top