mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-06-08 09:27:45 +08:00
Always listen on port 80
This commit is contained in:
parent
daad343eec
commit
34ded91c12
@ -33,15 +33,18 @@ if [[ "$2" != "/"* ]]; then
|
|||||||
HTML=$(html "$BODY")
|
HTML=$(html "$BODY")
|
||||||
printf '%b' "HTTP/1.1 200 OK\nContent-Length: ${#HTML}\nConnection: close\n\n$HTML" > "$TMP_FILE"
|
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 $!
|
socat TCP4-LISTEN:"${1:-5000}",reuseaddr,fork,crlf SYSTEM:"cat ${TMP_FILE}" 2> /dev/null & wait $!
|
||||||
|
|
||||||
else
|
exit
|
||||||
|
|
||||||
if [[ "$2" != "/run/ip.sh" ]]; then
|
fi
|
||||||
|
|
||||||
|
if [[ "$2" != "/run/ip.sh" ]]; then
|
||||||
|
|
||||||
cp "$2" "$TMP_FILE"
|
cp "$2" "$TMP_FILE"
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
BODY="The location of DSM is <a href='http://\${IP}:\${PORT}'>http://\${IP}:\${PORT}</a><script>"
|
BODY="The location of DSM is <a href='http://\${IP}:\${PORT}'>http://\${IP}:\${PORT}</a><script>"
|
||||||
BODY="${BODY}setTimeout(function(){ window.location.assign('http://\${IP}:\${PORT}'); }, 3000);</script>"
|
BODY="${BODY}setTimeout(function(){ window.location.assign('http://\${IP}:\${PORT}'); }, 3000);</script>"
|
||||||
@ -57,9 +60,9 @@ else
|
|||||||
echo "printf '%b' \"HTTP/1.1 200 OK\\nContent-Length: \${#HTML}\\nConnection: close\\n\\n\$HTML\""
|
echo "printf '%b' \"HTTP/1.1 200 OK\\nContent-Length: \${#HTML}\\nConnection: close\\n\\n\$HTML\""
|
||||||
} > "$TMP_FILE"
|
} > "$TMP_FILE"
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
chmod +x "$TMP_FILE"
|
|
||||||
socat TCP4-LISTEN:"${1:-5000}",reuseaddr,fork,crlf SYSTEM:"$TMP_FILE" 2> /dev/null & wait $!
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
chmod +x "$TMP_FILE"
|
||||||
|
|
||||||
|
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 $!
|
||||||
|
Loading…
x
Reference in New Issue
Block a user