amate / Proxydomo

ローカルで動作するプロクシフィルタリングソフトです
http://www31.atwiki.jp/lafe/pages/37.html
GNU General Public License v2.0
74 stars 12 forks source link

Proxydomo has problems with very large files #45

Closed WRFan closed 5 years ago

WRFan commented 7 years ago

It seems Domo has problems when dealing with very large files. E.g., the page twitch.tv will throw unless https://web-cdn.ttvnw.net/emberapp.js (over 7mb in size!) is bypassed by clicking the bypass button in Domo, or by loading the page directly, without a proxy. If this large file is loaded from cache or the file is downloaded and the call to the file on the server is redirected to the downloaded file on harddisk, or the file address is added to the bypass list, the browser does NOT throw either. But if cache is cleared and you attempt to load the page and Domo downloads the javascript include file off the server, browser throws. Tested on both IE 11 (11.0.10240.16603, Win10) and firefox 52.0a1 (52.0.0.6128) with ALL filters disabled (Domo version 1.96)

Now, I tested what causes the error. It's caused by https://web-cdn.ttvnw.net/global.js which tries to query the style property of elements inside self.document.body. If Domo is bypassed, the element queried is ALWAYS a valid object. But if Domo is NOT bypassed, the 3rd call to this function will throw, because the element is null, and the null object doesn't have any properties, so browsers throw. The code looks approximately like this (the site changes code blocks on the fly while serving the page, so variable names are random): ` lt = function(e, t, n) { var i, r, o, s, a = e.style;

//etc } `

"e" variable is the element queried (browser throws on a specific DIV element it cannot find, because Domo breaks something. "e" is invalid, so e.style query means automatic error, browser throws, the entire script processing chain is interrupted, so half the pages on the site won't load.

I fixed the problem for this particular site like this:

if (!e) { return }

This stops the error, pages load correctly. But what about the other pages? Admitted, I haven't seen such large files on any page before, but there are 6 billion pages on the internet, so Domo has to deal with all kinds of idiotic pages

amate commented 7 years ago

I can't reproduce the error. The file size of emberapp.js was 1.4 MBytes in my environment.