[英]HTTP GET Server - Incorrect Header
我正在編碼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";
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.