HTTP Hypertext Transfer Protocol, is the client browser and server communication specification, is the browser and server communication protocol, belongs to the application layer of the Protocol, Web developers understand the HTTP protocol is very important. The browser requests the server through the HTTP protocol, completes the request server shuts down the connection immediately, frees the resources, therefore says the HTTP protocol is "stateless".
HTTP request:
The browser request server process is an HTTP request, and the HTTP request consists of three parts:
1 Request Lines
2 header of the request
3 Request for Package body
The header of the request-generally the default data, we do not set, this part is to tell the server browser some information, such as browser is what browser, requesting the server is which host and other information. Some message headers are optional, describing some of the client's environment information and the requested server address information.
Requested package body-as a web developer only need to know get/post request way, get or post to the server data is the request package body, this part is not necessary.
HTTP response:
1 Response Lines
2 header of the response
3 response of the package body
The header of the response and the part of the package we can set, the response of the Baotou tells the browser how to handle the data to be returned to the browser, so you must set the header of the response before the output content. This is why the header is not able to output content before it.
Common features of HTTP requests and responses
HTTP protocol Getting Started knowledge