For fun I'm trying to write a very simple server in C.
When I send
this response to Firefox it prints out the body "hello, world" but with Chromium it gives me a Error 100 (net::ERR_CONNECTION_CLOSED): Unknown error.
This, I believe, is the relevant code:
char *response = "HTTP/1.0 200 OK\r\nVary: Accept-Encoding, Accept-Language\r\nConnection: Close\r\nContent-Type: text/plain\r\nContent-Length:20\r\n\r\nhello, world";
if(send(new_fd, response, strlen(response), 0) == strlen(response)) {
printf("sent\n");
};
close(new_fd);
What am I missing?
Thanks!