Http study notes (javaWeb)

What is the HTTP protocol

What is an agreement? An
agreement refers to the rules that two parties, or multiple parties, have agreed with each other and everyone needs to abide by, called an agreement.
The so-called HTTP protocol refers to the rules that need to be followed for the data sent when communicating between the client and the server, which is called the HTTP protocol.
The data in the HTTP protocol is also called a message.
HTTP protocol format of the request The
client sends data to the server called a request.
The server sends back the data to the client and calls the response.
Requests are divided into GET requests and POST requests

GET request

1. Request line
(1) Request method GET
(2) Requested resource path [+?+Request parameter]
(3) Version number of the requested protocol HTTP/1.1
2. Request header
key: value composes
different key-value pairs , Which means different meanings.
Insert picture description here

POST request

1. Request line
(1) Request method POST
(2) Requested resource path [+?+Request parameter]
(3) The version number of the requested protocol HTTP/1.1
2. Request headers with different
key: value
request headers, there are Different meanings
Blank line
3. The request body
is the data sent to the server
Insert picture description here

Description of common request headers

Accept: Indicates the data type that the client can receive.
Accpet-Languege: Indicates the language type that the client can receive.
User-Agent: Indicates the information of the client browser.
Host: Indicates the server ip and port number at the time of the request.
Which is a GET request and which Is a POST request

What are the GET requests (in javaweb):

1. The form tag method=get
2. The a tag
3. The link tag introduces css
4. The Script tag introduces js files
5. The img tag introduces pictures
6. The iframe introduces html page
7. Enter the address in the browser address bar and press Enter

What are the POST requests (in javaweb):

8, form tag method=post

HTTP protocol format of the response

1. The response line
(1) The protocol and version number of the
response (2) The response status code
(3) The response status descriptor
2. The response headers with different
key: value
have different meanings.
Empty line
3. The response body
is the response. Data sent to the client
Insert picture description here

Description of commonly used response codes

Insert picture description here

MIME type description

MIME is a data type in the HTTP protocol.
The full English name of MIME is "Multipurpose Internet Mail Extensions". The format of the MIME type is "large type/small
type" and corresponds to a certain file extension.
Common MIME types:Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_44788518/article/details/108355735