I'm currently making an extra lightweight web server in C for people who try to hack my server, but I want to know the proper coding to use for output.
I'm making a simple test page that only shows "Error" in bold and "This is a hack-ed-server" as the main text.
I attempted to use minimal HTTP headers so the page can display better.
Currently the Opera browser processes the html below correctly, however, when I test it in CURL using no parameters nothing appears on screen. I instead expected the HTML code to appear.
When I use the -I parameter for CURL, the expected HTTP headers appear correctly.
char buf[10000]={"HTTP/1.1 200 OK\r\nContent-type: text/html\r\n\r\n<html><head><title>hacked</title></head><body><H1>Error</h1><p>This is a hack-ed-server</p></body></html>\n"};
In all tests, I used the same correct IP address and the correct port number and the server daemon containing the above code was constantly running.
I'm curious. Is there something wrong with CURL, or with Opera, or with my code? Am I formatting the return codes incorrectly for the HTTP headers?