Always listen on port 80

This commit is contained in:
Kroese 2023-05-11 20:22:27 +02:00 committed by GitHub
parent daad343eec
commit 34ded91c12

View File

@ -33,9 +33,12 @@ if [[ "$2" != "/"* ]]; then
HTML=$(html "$BODY")
printf '%b' "HTTP/1.1 200 OK\nContent-Length: ${#HTML}\nConnection: close\n\n$HTML" > "$TMP_FILE"
socat TCP4-LISTEN:80,reuseaddr,fork,crlf SYSTEM:"cat ${TMP_FILE}" 2> /dev/null &
socat TCP4-LISTEN:"${1:-5000}",reuseaddr,fork,crlf SYSTEM:"cat ${TMP_FILE}" 2> /dev/null & wait $!
else
exit
fi
if [[ "$2" != "/run/ip.sh" ]]; then
@ -60,6 +63,6 @@ else
fi
chmod +x "$TMP_FILE"
socat TCP4-LISTEN:"${1:-5000}",reuseaddr,fork,crlf SYSTEM:"$TMP_FILE" 2> /dev/null & wait $!
fi
socat TCP4-LISTEN:80,reuseaddr,fork,crlf SYSTEM:"$TMP_FILE" 2> /dev/null &
socat TCP4-LISTEN:"${1:-5000}",reuseaddr,fork,crlf SYSTEM:"$TMP_FILE" 2> /dev/null & wait $!