简介
http协议工作于浏览器端-服务器端架构为上。浏览器作为HTTP客户端通过URL向HTTP服务端即WEB服务器发送所有请求。Web服务器根据接收到的请求后,向客户端发送响应信息。
特点
1.基于TCP/IP协议
2.基于请求-响应模式
浏览器端发出请求,服务器端做出响应。
3.无状态保存
http自身不对请求和响应之间的通信数据进行保存,方便处理大量的业务。
4.无连接
无连接的含义是每次只处理一个请求。服务器处理完客户请求,并受到客户应答之后即断开连接,以节省传输时间。
http请求协议与响应协议
1)请求协议
格式
请求方式:GET/POST
GET方式提交的数据会放在url之后,POST方式提交的数据会放在请求体中。
2)响应协议
格式
响应状态码
在程序开发中提供了很大的识错帮助。响应状态码是浏览器端发出请求时,返回给浏览器端的请求结果状态,借此知道这次请求是成功了还是出问题了,问题出在哪里。