How can I make an xinetd service such that a web browser can reliably show its output?
The service always sees the HTTP GET request on its stdin, and sends its reply to stdout. xinetd handles the tcp connection.
Firefox sometimes correctly shows the output. But sometimes it claims that the server reset the connection while it was still loading the page. Sometimes it shows all output, but keeps waiting for more (and when I then press ESC, it makes a new connection to the server with an empty HTTP request).
The definition for the xinetd service is:
service test
{
disable = no
id = test
type = UNLISTED
port = 8043
wait = no
socket_type = stream
flags = IPv4
user = root
server = /usr/local/bin/test.sh
}
The script for this simple test ignores the input, just echoes a minimal html. It causes the same problem as the real thing, eventhough there I added a command to close stdout at the end.
echo 'HTTP/1.1 200 OK'
echo 'Content-Type: text/html; charset=UTF-8'
echo ''
echo '<html>'
echo '<body style="background:#dfd">'
echo '<b>hello, world!</b><br>'
echo `date`
echo '</body>'
echo '</html>'
How is this different from what a web server would do?