News for hackers. Stuff that matters.
Re:Sherver: Bash lightweight web server by Tepix on Wednesday December 22, 2021 @08:38AM (#29649107)
I liked the story and the impromptu web server!

Two comments:

- using "ping -a" creates an audible ping so you can find the server if you're by yourself without having to look at the screen.

- No need for cat:

    while :; do nc -l 80 < conference.txt; done
Re:Sherver: Bash lightweight web server by _wldu on Wednesday December 22, 2021 @08:56AM (#29649304)
Interesting. I don't hear anything when I use the -a flag.
Re:Sherver: Bash lightweight web server by thanatos519 on Wednesday December 22, 2021 @09:15AM (#29649545)
Let's check with "reveal codes":

    $ ping -a 127.0.0.1 | less

    PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.

    64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.029 ms^G

    64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.023 ms^G
Looks like you need a terminal that has a BEL sound.
Re:Sherver: Bash lightweight web server by vesinisa on Wednesday December 22, 2021 @09:15AM (#29649559)
It just echoes a Bell character to your terminal. Make sure your terminal emulator supports it, and is configured properly: https://en.wikipedia.org/wiki/Bell_character
Re:Sherver: Bash lightweight web server by rzzzt on Wednesday December 22, 2021 @03:38PM (#29654829)
Windows Terminal shows a "visual bell" in the tab bar whenever BEL is emitted (even though I have it set to "audible" in advanced settings of the profile, hmm).

Edit: Uhm, right. I have also silenced all system sounds in Windows.

Re:Sherver: Bash lightweight web server by dormento on Wednesday December 22, 2021 @09:36AM (#29649872)
Whoa, nifty.

Why does firefox shows the "chose an application to open this link" when you access the http://localhost link, but shows the content correctly when you access the 127.0.0.1/0.0.0.0 ip-based version?

Re:Sherver: Bash lightweight web server by hericium on Wednesday December 22, 2021 @12:07PM (#29652078)
Browser expects to see some HTTP headers before the content. Adding HTTP version with response code, content type declaration and empty line dividing headers and content should do the trick:

    HTTP/1.1 200
    Content-Type: text/plan;

    1st line of content
Re:Sherver: Bash lightweight web server by vincnetas on Wednesday December 22, 2021 @08:45AM (#29649196)
TIL. thanx for -a.