Using a "hosts" file to ad-block

Interesting. So different behavior than Windows in that regards at least.
If this is case does Haiku wait too long for a response? I would think that is something that could be altered, because it should know if a certain port is open or not (thinking in netstat terms at least).

I don’t use poorman, but i do use a hosts file

Maybe the Haiku/Web+ behaviour has changed since I wrote that, but back then the delay without a webserver catching those redirects were quite drastic, IIRC.
I’ve been auto-launching Poorman ever since. I copied the Poorman binary and set its flags to “Background app” with the FileType addon, to avoid it clogging the Deskbar…

I think what changed was Stevenblacks’s host list. They no longer designate a “valid” adress like 127.0.0.1 but now use 0.0.0.0, which is unrouteable and should fail immidiently. This is all Afaik anyhow.

1 Like

Thank you for the tip about poorman, I’ll keep that it mind.

I’m using hblock, but I modified the number of sites that it makes it’s list from, as I found it seemed to bog down WebPositive. StevenBlacks was one of the one’s that I cut. I’ll have to try adding it again, and see what it does.

Edit:
As an added side bonus, on a fresh install of a development build, using hblock stopped WebPositve from crashing while trying to view the NFL scoreboard on nbcsports.com. I’ve had problems with WebPositve crashing when viewing some sites, so this helps a lot.

Your link to the hosts file doesn’t work.

I’ve updated the link to the hosts file. Thanks!

1 Like

Sorry I did not get it.
What to to with the link? Copy it and save it as…?
Which archive where to get it?
If I open the link there is nothing to download or clone?

Sorry this is not easy to follow for me

Edit:
I installed hblock from HaikuDepot. In terminal I started “hblock”… It generated the block-list file “hosts” as mime-text file in boot/system/settings/network/

This means I can just copy and paste the StevenBlack’s list into a text-file and overwrite the automatic generated file by hblock “hosts” in boot/system/settings/network/

The URL used to point to a zip archive, now it’s a link to the hosts file itself. I’ve updated the text and also made item 3, the starting of Poorman, optional.

2 Likes

Yes, it is that simple. You want to keep the header (eg this section) however, as it is required for the system to work correctly, so just put your customization after this section.
You probably should just copy the entries from the StevensBlacks list after the

# Start StevenBlack

line.

1 Like

Nice, it easy if you know what to do.
But one question I still have: Should I keep the automatic hblock entries too or should I keep only the one from StevenBlack?

Thanks all, very helpfull and nice to learn. Web+ feels faster now?! Is it?

It is your decision.

1 Like

Offtopic, but how do I send a PM to a user? I discovered Haiku a few weeks ago, and wanted to start translating. I connected my Github to i18n.kacperkasper.pl and need a mod to auth me. This interface is very confusing for me, can’t find the right buttons.

Just click on the avatar of the user and a window will pop up with a green “Message” button at the top right.

I am unable to download the file at https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
I right click on the link in this thread and select “Download Linked File” I then waited almost 2 hours and I have 0% downloaded. I have tried several times. Does anyone have this?

Try to download with wget or curl.

Alternatively you can just click on the link select all the text and copy and paste it to a new text file in Haiku.
right click on desktop =>new=>text file
and save this textfile as hosts.
Paste this textfile (hosts) to: boot/system/settings/network/

If there is already a hosts file you can add/apply/append the text you just copied to it. Read the above articles from extrowerk for how to do this.

Read my Edit:

1 Like

open a terminal and type:

wget -c https://github.com/StevenBlack/hosts/raw/master/hosts

This will download the hosts file. Web Positive seems to have an issue downloading this file.

1 Like

Sounds much easier, thanks.
But not easy to understand, anyway I tried it.

Is it possible to download it direct to:
System/settings/network/
?

wget -c -P /system/settings/network/ https://github.com/StevenBlack/hosts/raw/master/hosts

1 Like