Overview: refers to the server and client communication between the constraints and specifications, client and service-side data interaction is not messy, need to follow (based on) a certain standard
Common protocols:
A) HTTP, HTTPS Hypertext Transfer Protocol
B FTP File Transfer Protocol
c) SMTP Simple Mail Transfer Protocol
This paper mainly introduces HTTP Hypertext Transfer Protocol.
1. HTTP protocol
Hypertext Transfer Protocol, the Web site is based on the HTTP protocol, such as the site's pictures, CSS, JS, etc. are based on the HTTP protocol for transmission. HTTP protocols are constrained and regulated by requests from client to server (request) and responses from server to client (Response)
Common requests are: GET, POST, put, DELETE
2, request-Request message:
A the request is initiated by the client, and its canonical format is: Request line, request header, request body. Such as:
b The request message line: By the request method, the request URL and the protocol version constitute
c) Request message headers
Host:localhost requested host
cache-control:max-age=0 control cache (no-cache| no-store)
accept:*/* accepted document MIME type
User-agent: Provides access to the Web site to identify the type of browser you are using, operating system and version, CPU type, browser rendering engine, browser language, browser plugin, and so on. The standard format for the browser UA string is: Browser identity (operating system identity; encryption level identification; browser language) rendering engine identity version information
Referer: from which URL
to jump accept-encoding: acceptable compression format
D request the style of the report: that is, the data passed to the server
Note: when the form is submitted as post, the request header is set to content-type:application/x-www-form-urlencoded, and this setting is not required when requested in get form
3, Response-Response message:
A The response is issued by the server, and its canonical format is: status line, response header, response Principal
b) Response Head:
Date: Response time Server
: Server information
content-length: Response principal length
Content-type: MIME type of response resource
c) Response Principal: The content returned to the client by the server
d) Status code:
Common status codes are:---Server successfully returns Web pages, 304---Documents unmodified, 403---Do not have permissions, 404---Request Web page does not exist,---server error, 503---service Unavailable
Description: The client and server in the data transmission is in the form of bytes, can be understood as a text transmission, when the browser needs to know exactly how to resolve the text form of data, MIME is to explicitly inform the browser how to deal with
There are a lot of knowledge points about HTTP protocol, this article only introduces the approximate process of its transmission. Learning and understanding of its composition is to better understand Ajax. For more information, please see---AJAX overview and implementation process, I hope to help you!