Visual C++网络编程经典案例详解 第5章 网页浏览器 HTTP响应 实体数据 服务器的消息响应格式

在服务器的响应消息中包括了消息头和消息体两部分。
其中消息体中包含的实体数据。
并且在消息头和实体数据之间使用一个空白行进行分隔。

例如 客户端向服务器请求一个页面GET.html
服务器的响应消息格式如下

HTTP/1.1 200 OK//消息头。
Date: Mon,21 Nov 2008 18:33:22 GMT
Server:Microsoft=IIS/6.0
Accept-Ranges:bytes
Content-Type: text/html
Content-Length: 1024
Connection:close 
					//用空白行进行分隔
<html>
<head>
<title>GET方式传送数据</title>
</head>
<body>
<form id=form1 name=form1 method="get" action="http://127.0.0.1/get.html">
<table border=0 cellpadding=1 cellspacing=1 width=75%>
<tr><td width=150>姓名: </td>
	<td><input id=b1 name="name"></td></tr>
<tr><td width=150>地址: </td>
	<td><input id=b1 name="address"></td></tr>
<tr><td width=150>电话号码: </td>
	<td><input id=b1 name="number"></td></tr>	
</body>
<tr><td width=150>邮箱: </td>
	<td><input id=b1 name="email"></td></tr>	
<tr><td><input type=submit value=保存>&nbsp&nbsp<input type=reset value=重置>
</td></tr>
</table>
</form>
</body>
</html>

从上面的响应消息中
服务器向客户端返回的响应消息中
响应码200表示请求被服务器理解并接收。
返回的实体数据是一个网页内容,
其格式为*.html格式
大小为1024b

猜你喜欢

转载自blog.csdn.net/eyetired/article/details/83986559