I don't want to waste your time too much with my question here, but I am now trying to make a CGI daemon. The problem is I cannot understand or read anywhere what I need to talk back to via the socket. That's not Hiawatha's fault, just that I can't seem to figure this out.
I have a test server app opening a socket at port 2001, then when I have Hiawatha running, I can point my browser to a page and I can see that the socket (my app) is responding and can send stuff back. But all the browsers tells is a 500 internal error.
I send this via the socket:
int byteCount;
byteCount = fprintf (stdout, "HTTP/1.1 200 OK\nContent-type: text/html\n\n<h1>Hello there</h1>");
if (send(new_fd, "HTTP/1.1 200 OK\nContent-type: text/html\n\n<h1>Hello there</h1>", byteCount, 0) == -1)
perror("send");
Yes it's a bit clumsy, just trying things out here. The socket responds correct, but frankly I have not much of a clue what I am supposed to do or what is expected for me to send so that I can serve valid to Hiawatha as a FastCGIserver daemon.
I looked and looked around on the net and it tells me nothing about how to go about writing a CGI daemon in relation to what I have to with the socket to send correct html and parse the GET parameters etc. All of this I have done successfully in CGI, so I am not completely in the dark, just at this point. Probably I am misunderstanding something here.
Is it possible that you can provide my with a little hint here? I realize that I shouldn't waste to much of your time with this, but all I need to figure out is this socket issue and then I can complete my daemon foundation.
In my httpd.conf I have:
FastCGIserver {
FastCGIid = FCGI
ConnectTo = 127.0.0.1:2001
Extension = aaa
}
FastCGI = FCGI
..and there lies another question which I can't figure out at the moment. All I want is to have a daemon running which Hiawatha can talk to via a socket for me to still have common CGI environment stuff. But now here it seems I need to provide a file Extension, but the extension would be kind of irrelevant and only serve to point to the fastcgi process?? I am not going to have php files or a custom script language, just a CGI daemon.
You can see that I am kind of confused here. I want to still have access to all CGI environment variables (which the socket seems to provide).
All the help is appreciated and really this is my only last issue to get it going for me. Thanks regardless.