Skip to content

Instantly share code, notes, and snippets.

@fl64
Created July 24, 2024 16:04
Show Gist options
  • Save fl64/3448e625905e89e844de18340796541c to your computer and use it in GitHub Desktop.
Save fl64/3448e625905e89e844de18340796541c to your computer and use it in GitHub Desktop.
bash http server
#!/bin/bash
data=$(date $T)
echo "content-type: text/plain"
echo "content-length: $(echo ${data} | wc -c)"
echo
echo ${data}
#!/bin/bash
while true; do
{ echo -ne "HTTP/1.1 200 OK\r\n"; sh data.sh; } | nc -l -k -q 1 8080;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment