2ndalpha / gasmask

Hosts file manager for OS X
3.73k stars 252 forks source link

Adding remote file fails #90

Open 2ndalpha opened 8 years ago

2ndalpha commented 8 years ago

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

ghariib commented 8 years ago

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

2ndalpha commented 8 years ago

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.

Roccobot commented 8 years ago

Let's donate some bucks to this guy

ifyour commented 8 years ago

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

Liam0205 commented 8 years ago

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.

cjf commented 8 years ago

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.

thepigeonoftime commented 6 years ago

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.

mmower commented 6 years ago

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.

oliveratgithub commented 6 years ago

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?)

michael1900 commented 6 years ago

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

thepigeonoftime commented 6 years ago

@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).

receptor commented 6 years ago

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?

papaGregor commented 5 years ago

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...

MuntashirAkon commented 5 years ago

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

JayBrown commented 4 years ago

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 commented 4 years ago

The build shared by @MuntashirAkon crashed on 10.14.6.

JayHoltslander commented 1 year ago

So am I understanding correctly that the feature is looking for a .txt file at the destination but that it must be http and not https?

2ndalpha commented 1 year ago

I don't have time to actively develop it. I'm happy to review and merge PR-s and create releases.

JayHoltslander commented 1 year ago

I don't have time to actively develop it. I'm happy to review and merge PR-s and create releases.

You should put a “Help wanted” note at the top of the readme to advertise this a bit more. Just an idea.