Skip to content
This repository has been archived by the owner on Jul 21, 2021. It is now read-only.

Need to restore old version of asset if updating them is failed.. #15

Closed
harshanvn opened this issue Oct 26, 2014 · 5 comments
Closed

Comments

@harshanvn
Copy link

Did a forced update on host files.
After update saw blocked host name count reduced from 62k to 44k. Upon closed inspection saw, below error in the console..

Failed to load resource: the server responded with a status of 503 (Service Unavailable) http://hosts-file.net/.%5Cad_servers.txt

And looking at the host file count..saw below..
host file count

@gorhill
Copy link
Owner

gorhill commented Oct 26, 2014

Strange. I can not repro, and code reviewing I can't see where this could happen. The only thing I can think of is that 503 is not considered as an error when using a XHR, and thus the error path was not taken by uMatrix, and thus it ended up loading a 503 web page as a hosts file.

@gorhill
Copy link
Owner

gorhill commented Oct 26, 2014

Fixed with b946a96.

I need to also import the fix in uBlock, this might actually explain why some users report uBlock stopped blocking ads: if EasyList could not be downloaded the same way it happened above to hpHosts, that would cause uBlock to not see the failed request and interpret the error page as a valid EasyList file.

@gorhill gorhill closed this as completed Oct 26, 2014
gorhill added a commit to uBlock-LLC/uBlock that referenced this issue Oct 26, 2014
@harshanvn
Copy link
Author

I may be completely wrong here. Just throwing my 2 cents here...

if ( typeof this.status === 'number' && this.status >= 200 && this.status < 300 ) {

In the above line of code, i don't see why we need a first condition here. As http status code will always be of type number. Below condition itself may be enough..Sorry if am wrong here..

if ( this.status >= 200 && this.status < 300 ) {

Please see the link below for list of status codes-
* http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

@gorhill
Copy link
Owner

gorhill commented Oct 26, 2014

It's just to be on the safe side in case it is undefined, in which case typeof this.status would return 'undefined'.

Of course I went to look at 503 code spec before the fix...

@harshanvn
Copy link
Author

hmm...ok. I am just thinking whether this situation can occur ever, as property type of status should never change. Anywayz, better safe than sorry :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants