示例:
请求:
GET / HTTP/1.1
Host: 106.53.115.186
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Cache-Control: max-age=0
响应:
HTTP/1.0 200 OK
Server: kiron
ContentType: text/html
Connection: Close
Content-Length: 195
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>
<h1>我的第一个标题</h1>
<p>我的第一个段落。</p>
</body>
</html>
常用的响应代号:
响应代号 代号描述 使用场景
200 OK
501 Method Not Inplemental 请求的方法 错误
404 Not Found 页面不存在
500 Interal Server Error 服务器收到请求后,内部发生错误无法回复
400 Bad Request 请求数据格式有问题