为了好玩,我想在CHTTP响应GET请求 - 在FF工作不铬
写了一个非常简单的服务器当我send
这种反应到Firefox它打印出人体“你好,世界”但铬它给了我一个Error 100 (net::ERR_CONNECTION_CLOSED): Unknown error.
这一点,我相信,这是相关代码:
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);
我缺少什么?
谢谢!
请将正确答案标记为Accepted。 – 2010-04-02 21:31:42
@Steven你必须等15分钟 – Tyler 2010-04-02 21:32:36
啊,我明白了。感谢您的解释。 – 2010-04-03 01:57:44