neutron-lbaas/devstack/samples/webserver.sh
Michael Johnson 78e8b42c37 Make sample web server close connections
The sample web server, using nc, currently does not close the
connection after serving the content.  This can cause clients to
hang waiting for the connection to close after the content has been
served.  This patch includes the content length in the response
so that the connection will close.

Change-Id: I9b7d120099c2652a2a91e3471e3152c1b02ce7f6
2016-01-26 20:41:58 +00:00

10 lines
278 B
Bash
Executable File

#!/bin/sh
MYIP=$(/sbin/ifconfig eth0|grep 'inet addr'|awk -F: '{print $2}'| awk '{print $1}');
OUTPUT_STR="Welcome to $MYIP\r"
OUTPUT_LEN=${#OUTPUT_STR}
while true; do
echo -e "HTTP/1.0 200 OK\r\nContent-Length: ${OUTPUT_LEN}\r\n\r\n${OUTPUT_STR}" | sudo nc -l -p 80
done