[Note JS/HTML/CSS] HTTP protocol (1) in the web, jscss
Recently, I have been teaching in coursera, and I am also busy with my own courses. I always forget to write Study Notes ORZ.
Introspection ing...
When writing HTML, the form must submit and query data (for example) to the server over HTTP)
The client sends data to the Server over HTTP
The main methods include GET and POST (Other methods include PUT, DELETE, and HEAD)
There are two types of HTTP message formats: request and response.
The request message can be abstracted:
The HTTP head contains some request information. The first line is request line, which consists of the method fields (such as GET/POST), url fields, and HTTP Protocol version fields.
The following lines are header line.
The HTTP entity body is empty when the GET method is used. The POST method contains some form submission information and files.
Generally, GET is used for data request (if the method is not declared, the default value is GET), and POST is used for data submission.
GET can only transmit a small amount of data, and the transmitted data is displayed in the url, which is not secure.
POST can transmit more data than GET. The POST method is required when uploading files (multiple bytes) and passwords (requiring high security ).
Response message can be abstracted:
The status line of the first line in the HTTP head, including the HTTP Version Information and status code.
The next few lines are header line, which indicates information about some server versions and HTTP entity bodies.
E.g. content-type: text/html indicates that the body contains an html file.
Some common status codes:
200 OK: enabled successfully
301 Moved Permanently: The request object is Permanently removed.
400 Bad Request: Incorrect Request that cannot be understood by the server
401 Not Found: the requested object is Not on the server.
505 HTTP Version Not Supported: the server does Not pay for the HTTP Version of the current Request message
For study notes only. If you have any errors, please point out> <, THX...