Skip to content

Commit

Permalink
Merge branch 'curl_bug' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
kvilhaugsvik committed Oct 11, 2018
2 parents 8b80d43 + a988fe3 commit 5e5e4b3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/start-freeciv-web.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ cd ${FREECIV_WEB_DIR}/freeciv-earth/ && nohup python3 -u freeciv-earth-mapgen.py

echo "Will sleep for 8 seconds, then do a status test..." && \
sleep 8 && \
sh ${FREECIV_WEB_DIR}/scripts/status-freeciv-web.sh
bash ${FREECIV_WEB_DIR}/scripts/status-freeciv-web.sh
14 changes: 14 additions & 0 deletions scripts/status-freeciv-web.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@

alias curl='stdbuf -i0 -o0 -e0 curl'

# Some versions of Curl will by default change the formatting of headers
# when printing them to the terminal. A bug will then cause Curl to not turn
# of the custom formatting after the headers are printed. This causes all
# subsequent console output to have the custom formatting.
# This can't be worked around with the --no-styled-output option because
# older versions of curl, that don't have --no-styled-output, fails on the
# unknown option.
work_around_curl_console_output_bug () {
# reset the terminal formatting
echo -e "\e[0m"
}

checkURL () {
local URL=$1
local logfile=$2
Expand Down Expand Up @@ -62,10 +74,12 @@ printf "\n--------------------------------\n";
echo "testing WebSocket connection directly to Tornado"
echo "This should show \"HTTP/1.1 101 Switching Protocols\" and then timeout after 2 seconds."
curl -isSN -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: localhost" -H "Origin: http://localhost" -H "Sec-WebSocket-Version: 13" -H 'Sec-WebSocket-Key: +onQ3ZxjWlkNa0na6ydhNg==' --max-time 2 http://localhost:7002/civsocket/7002
work_around_curl_console_output_bug

echo "testing WebSocket connection through nginx"
echo "This should show \"HTTP/1.1 101 Switching Protocols\" and then timeout after 2 seconds."
curl -isSN -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: localhost" -H "Origin: http://localhost" -H "Sec-WebSocket-Version: 13" -H 'Sec-WebSocket-Key: +onQ3ZxjWlkNa0na6ydhNg==' --max-time 2 http://localhost/civsocket/7002
work_around_curl_console_output_bug
printf "\n--------------------------------\n ";

echo "checking freeciv-web / publite2"
Expand Down

0 comments on commit 5e5e4b3

Please sign in to comment.