I am trying to run a binary via the common gateway interface (cgi-bin). But whenever I try to access http://localhost/cgi-bin/binary from my browser I get HTTP 500 Internal error, with the following log entry in /var/log
[Sat May 26 15:31:55 2012] [error] [client 127.0.0.1] malformed header from script. Bad header=HTTP_HOST=localhost: binary
L.E.: This doesn't seem to happen if the cgi-bin object is a php script or python.
Make sure at the beginning of your code you output at least:
Content-type: text/html\n\n