HTTP GET服务器-错误的报头
本文关键字:报头 错误 GET 服务器 HTTP | 更新日期: 2023-09-27 17:53:44
我正在编写一个HTTP服务器,但是当我创建标头并发送它时。
返回:The connection to 127.0.0.1 was interrupted.
我制作标题的代码是:
string header = "'r'n";
header += "HTTP/1.1 200 OK'r'n";
header += "Content-Type: text/html'r'n";
header += "'r'n";
header += "<html><head><title>Test</title></head><body>Testing</body></html>";
以换行符开始 -你不应该。基本上,修改如下:
string header = "'r'n";
header += "HTTP/1.1 200 OK'r'n";
string header = "HTTP/1.1 200 OK'r'n";