gasmask icon indicating copy to clipboard operation
gasmask copied to clipboard

Adding remote file fails

Open 2ndalpha opened this issue 8 years ago • 19 comments

Adding https://github.com/StevenBlack/hosts/raw/master/hosts fails

2ndalpha avatar Mar 16 '16 16:03 2ndalpha

Just wanted to ask, if you are going to fix this bug. With kind regards.

ghariib avatar Apr 19 '16 12:04 ghariib

Unfortunately I don't have time for it. If anyone else is up for the task I'm happy to merge the PR and do a release.

2ndalpha avatar Apr 19 '16 14:04 2ndalpha

Let's donate some bucks to this guy

Roccobot avatar Apr 26 '16 22:04 Roccobot

Let's donate some bucks to this guy +1😂

ifyour avatar Apr 26 '16 23:04 ifyour

Encountered the same problem with the OP.

It shows that Can't download the hosts file. It contains HTML page.

No idea about what to do.

Liam0205 avatar May 12 '16 15:05 Liam0205

It fails because of the way it fetches files. It's not capable of getting https links using the method it does.

HostsDownloader:sendRequestHeader will fail with https. Someone would need to rewrite how it fetches files to support https.

cjf avatar Sep 27 '16 18:09 cjf

As a temporary workaround, search for "Non GitHub mirror" on https://github.com/StevenBlack/hosts , the links are plain HTTP so they work with gasmask.

thepigeonoftime avatar Jan 21 '18 11:01 thepigeonoftime

I don't have the time or patience to download a 5.5GB Xcode image right now but I might have a go at fixing this later.

It appears there is a home-made HTTP client in HostsDownloader.m. Given the age of the code there may not have been a simple HTTP library available for Obj-C developers when this was written. My guess is it would be relatively easy to replace with with either a newer NSURL API or by using something like AFNetworking.

I'll try and remember to come back around to this when I have a little more time.

mmower avatar Jan 21 '18 13:01 mmower

Same issue here when trying to add a Hosts file from our internal GitLab server:

https://git.ourcompany.com/corporate/project/snippets/130/raw => Can't donwload the hosts file. It contains HTML page.

Would really appreciate a fix to support such Remote Hosts-file. Please also consider, that they may require a login (which is, what in this case might produce the - correct? - "Containt HTML page"-error, because the request will be forwarded to the authentication page which indeed contains HTML?)

oliveratgithub avatar Apr 05 '18 09:04 oliveratgithub

Hi, when this bug will be fixed? Also for example with other link the error says: object not recognizes or something similar, i think the problem in this case are all the space between two row. Is it possible to fix also this bug. Really many links are rejected for this problem. Thanks

michael1900 avatar Aug 24 '18 00:08 michael1900

@oliveratgithub @michael1900

for the moment it seems the only option is to use non https resources, if you happen to have a vps with nginx on it you can set up a reverse proxy that serves the https resource as plain http. There should be other ways to do ssl termination as well.

I may look into adding ssl support myself (no promises).

thepigeonoftime avatar Aug 27 '18 15:08 thepigeonoftime

We have now PR https://github.com/2ndalpha/gasmask/pull/155 thanks to @softwarebouwer, which fixes this issue and the related https://github.com/2ndalpha/gasmask/issues/154. I guess it also makes https://github.com/2ndalpha/gasmask/issues/149 obsolete for now. @2ndalpha, can you please merge that and make a release?

receptor avatar Oct 14 '18 12:10 receptor

I'm still having this problem with GM 0.8.6 and OS X 10.14.3. I tried an experiment:

Adding the Stephen Black file from the github URL: https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts

produces this error:

Bad content. Can't download the hosts file. It contains unknown content.

However, adding the same file from the non-github mirror: http://sbc.io/hosts/hosts

loads the file perfectly.

I don't know how that will help with the debugging process, but hopefully it will. I did notice that the github URL is HTTPS, whereas the non-github is HTTP...

papaGregor avatar Mar 25 '19 06:03 papaGregor

This is the latest binary built using Xcode 10.3. It should solve the problem. Gas Mask.app.zip

MuntashirAkon avatar Nov 03 '19 13:11 MuntashirAkon

Same problem here. Even if you go for the raw link, you'll get a "bad content" error.

https://raw.githubusercontent.com/x0uid/SpotifyAdBlock/master/hosts

JayBrown avatar Jan 10 '20 11:01 JayBrown

The build shared by @MuntashirAkon crashed on 10.14.6.

JayBrown avatar Jan 10 '20 11:01 JayBrown