This is the fifth day of my participation in the August Wen Challenge.More challenges in August
1. Common HTTP status codes
- 1 xx (
information
Status code)- 100:
Continue
, it is sentPOST
Send when requestedheader
After the message, the server returns this status code, indicating acknowledgement, and can continue sending data
- 100:
- 2 xx (
successful
Status code)- 200:
OK
“Is returned normally - 201:
Create
, the request is successful and the servercreate
A newresources
- 202:
Accepted
The server accepted the request butHas yet to deal with
- 200:
- 3 xx (
redirect
)- 301:
Moved Permanently
.Permanent redirection
, the requested page has been permanently moved to the new location - 302:
Found
.Temporary redirection
- 303:
See Other
.Temporary redirection
, and always usedGET
Method requests a new URI - 304:
Not Modified
, since the last request,Page not modified
- 301:
- 4 xx (
The client
Error)- 400:
Bad Request
, the server does not understand the request format - 401:
Unauthorized
Request,unauthorized
- 403:
Forbidden
.ban
access - 404:
Not Found
.Can't find
Matches the URIresources
- 400:
- 5 xx (
The service side
Error)- 500:
Internal Server Error
, server error - 502:
Bad Gateway
The server gateway is incorrect - 503:
Service Unavailable
, the server temporarilyUnable to process request
- 500:
2.304 status code
If the client sends a conditional GET request and the request is granted, and the contents of the document have not changed (since the last access or according to the conditions of the request), the server should return the 304 status code (provided: there is a cache in the browser for comparison).
3.301 and 302
- 301: indicates that the resource has been deleted
A permanent move
To a new location,A new location
In the response returnedURI
, the responseIn general, it can be cached
- 302: Indicates that the resource is
Temporary mobile
That should betemporary
From differentURI
Access the resource, the responseGenerally, it cannot be cached
(Unless setExpires
orCache-Control
) - Application:
301
Used to doPage jump
.302
Used to doTemporary jump
(For example, unlogged users jump to the login interface)
4. Differences between GET and POST
In terms of | GET | POST |
---|---|---|
Parameter passing | Stored in aURL In the |
Stored in aRequest Body In the |
Length limit | There are length restrictions (mainlyBrowser Restrictions ) |
Unlimited length |
security | Unsafe, exposed to the url | Secure, request parameters are not visible in the url |
encoding | Only supportURL coding |
supportA variety of coding way |
The cache | The browserTake the initiative to The cache |
Can’t cache |
Parameters reserved | The browserkeep parameter |
The browserDon't keep parameter |
back | harmless | The data will be resubmitted |
idempotence | Power etc. | non idempotence |
Side effects | There is no Side effects |
There are Side effects |
application | The query | Commit changes |
There is also a controversial claim: A POST request produces two packets while a GET request produces only one. In fact, a POST request produces two packets as a result of sending the header and body separately. This is not necessary
5. Fetch sends two requests
The fetch sends a POST request twice. The first sends an Options request asking the server if it supports the modified headers. If so, the second sends the data.
6.CDN
CDN: Content Delivery Network
- Try to avoid the Internet as much as possible
Be likely to influence
dataTransmission speed
andThe stability of
The bottleneck and link, so that content transmission faster, more stable. - Method: Multiple
CDN
Node server pairThe source station
Resources forThe cache
Pass all when the user accessesLocal load technology
Point user access toTo the nearest
The node ofCDN node
toThe response
User request - Purpose: To get users
To the nearest
Access to resources to speed up usersAccess speed
- Advantages:
- To solve
Across the region
andCross operator
Access problems,To reduce
accessTime delay
- Stand up to the source
shunt
Role,To reduce
The source stationload
- To solve
7.DNS
Domain Name System (DNS)
DNS concepts:
- by
Layered DNS server
Implementation of theDistributed database
- One that allows the host to
The query
Distributed databaseApplication layer protocol
Description:
- For browsers,
DNS
Is used to bringThe domain name
Converted toThe IP address
the - Query method:
recursive
Query +The iteration
The query recursive
Query:This machine
toLocal DNS Server
Perform a query and return the query resultThe iteration
Query:Local DNS Server
Continue toThe root
,TLD(Top-level domain)
,authority
Etc.The DNS server
Query domain names and obtain the query result