0 37 min 1 week

  Press Enter to enter the command line mode

  Insert image description here

  The physical address refers to the MAC address, and the IPv4 address is IP.

  MAC address, also known as physical address and LAN address, is mainly used to confirm the address of devices on the internet, similar to an ID number, with a unique identifier. Each network interface card is equipped with a MAC address when it is manufactured, and it will never change.

  IP address, similar to your current address, is a marker of your specific location in the network. The IP address of a network interface card can be changed.

  2.1 Twisted Pair

  One day, Xiao Fan wanted to play a game with Xiao Hang, so he found a pair of twisted-pair cables (network cable) to connect the two computers together and began the journey of gaming.

  Insert image description here

  2.2 Hub

  If there are multiple computers, you can use a hub, also known as a repeater, where a computer sends information to the hub, which then reaches other computers.

  Just like playing Mahjong with three people!

  Insert image description here

  2.3 Switch

  Due to the issue with hubs, we often need to send information to a specific computer rather than broadcast, so a new device called a switch (switch) has appeared.

  The switch can.

  Question for thought, if the switch is to send content to a specified computer, then internally, it must record which computer is connected to which port of mine. MAC address is a physical address, and the switch is not interested in the IP address.

  Insert image description here

  Insert image description here

  Question for thought:

  How does the switch know this table:

  Insert image description here

  Let’s take an example:

  Xiao Hang -> Switch: Searching for Xiao Fan

  The switch names Xiao Hang as Mac1

  Switch @ everyone: Who is Xiao Fan?

  A member -> Switch: I am Xiao Fan

  The switch names Xiao Fan as Mac2, and the switch will remember the addresses of Mac1 and Mac2 in the future.

  The switch connects the call between Xiao Hang and Xiao Fan.

  Switches are more efficient and can also perform bridging.

  Insert image description here

  2.4 Router

  Question for thought: Can a large-scale network be established using a switch?

  The address table of a general switch can only store a few thousand addresses. When there are too many devices in the network, if the switch cannot find the corresponding device, it will broadcast. Therefore, a device called a router has been introduced, which is a device that everyone has heard of and is generally present in homes.

  Note: A router is not a cat. The function of a modem is to convert incoming signals.

  Insert image description here

  The concept of a network comes into being here. Even the bridging of switches does not involve the concept of IP address; data transmission is based on MAC addresses. With the abstract concept of a network, IP addresses come into existence, and IP addresses and subnet masks together help us locate a computer’s position in the network.

  IP address and subnet mask are actually 32-bit binary numbers.

  Insert image description here

  When sending information, a message header is added again.

  Insert image description here

  Home routers have a WAN port and several LAN ports, each with a network interface card. One card belongs to the internet network, with an IP address like 10.25.23.65, and another belongs to an internal network such as 192.168.0.1 (try connecting to the browser and input this URL to see if it works over Wi-Fi).

  Insert image description here

  A router contains a routing table.

  The concept of gateway arises with the transmission within a network.

  The gateway (Gateway) is a ‘gateway’ that connects one network to another network. Just as you have to pass through a door to go from one room to another, this door is the gateway.

  IP cannot be transmitted directly because the switches within the network do not support IP addresses, so communication needs to be converted to MAC addresses, and MAC addresses are found based on IP addresses.

  It is very important to broadcast and ask which MAC address’s IP is 192.168.0.5, and it will respond upon receiving it.

  Let’s take an example:

  192.168.100.100 sends information to 192.168.200.101

  Insert image description here

  Step 1:

  192.168.100.100 -> 192.168.100.100Insert image description here

  Step 2:

  192.168.100.100 -> 192.168.200.100

  Insert image description here

  Step 3:

  192.168.200.100 -> 192.168.200.101

  Insert image description here

  ICMP (Internet Control Message Protocol) is a subprotocol of the TCP/IP protocol suite, used for transmitting control messages between IP hosts and routers. Control messages refer to messages about network connectivity, whether a host is reachable, whether a route is available, and other messages about the network itself. Although these control messages do not transmit user data, they play an important role in the transmission of user data.

  2.5 NAT Protocol

  Each device is allocated an IP address, which of course can achieve network establishment, but in fact we only have a limited number of IP addresses, and the number that can be used is about 4 billion. Therefore, the general practice is that there is only one IP address at home, and all devices are connected through a router to connect to the internal network. So, what’s the problem? If your phone’s address is 192.168.0.10, others may also be the same. How can Baidu distinguish them?

  Insert image description here

  This is called the NAT protocol NAT (Network Address Translation, Network Address Translation).

  Nowadays, home routers are all equipped with switching functions.

  The number of usable IP addresses is 2.56 billion, with more than 4 billion (47,111,225,204).

  There is a distinction between public and private IPv4 addresses:

  Private IP address: locally unique, cannot be used for internet communication, and does not require payment.

  Public IP address: globally unique, can be used for internet communication, and requires payment.

  The role of NAT: When data packets are transmitted between the internal network and the external network, the source and destination IP addresses in the data packets are converted. The source IP address is modified when converting from internal to external, and the destination IP address is modified when converting from external to internal.

  NAT Protocol Classification:

  Dynamic, static

  One-to-one, one-to-many, many-to-many

  One-to-one belongs to static, converting one IP to another IP in a fixed manner;

  One-to-many belongs to dynamic, converting multiple IPs to a single IP;

  Multi-to-multi can be both dynamic and static, converting multiple IPs to multiple IPs;

  1, Class A IP address

  A Class A IP address is composed of, the highest bit of the network address must be “0”, the address range is from 1.0.0.0 to 126.0.0.0. There are 126 available Class A networks, and each network can accommodate more than 100 million hosts.

  2, Class B IP address

  A Class B IP address is composed of, the highest bit of the network address must be “10”, the address range is from 128.0.0.0 to 191.255.255.255. There are 16,382 available Class B networks, and each network can accommodate more than 60,000 hosts.

  3, Class C IP address

  A Class C IP address is composed of, the highest bit of the network address must be “110”. The range is from 192.0.0.0 to 223.255.255.255. Class C networks can reach more than 2.09 million, and each network can accommodate 254 hosts.

  4, Class D address

  Used for. The first byte of Class D IP address starts with “lll0”, which is a specially reserved address. It does not point to a specific network, and currently this type of address is used in multicast (Multicast). Multicast addresses are used to address a group of computers at one time, identifying a group of computers that share the same protocol. 224.0.0.0 to 239.255.255.255 is used for multicast.

  5, Class E IP address

  Starting with “llll0”, reserved for future use. 240.0.0.0 to 255.255.255.254, 255.255.255.255 is used for broadcast addresses

  IP Private Address:

  Among the three main types of IP addresses, three areas are reserved as private addresses, and their address ranges are as follows:

  Class A address: 10.0.0.0 to 10.255.255.255, Class B address: 172.16.0.0 to 172.31.255.255, Class C address: 192.168.0.0 to 192.168.255.255

  The first group of numbers in Class A address is 1 to 126. Note that, while the number 0 indicates that the address is a local host and cannot be transmitted.

  The first group of numbers in Class B address is 128 to 191.

  The first group of numbers in Class C address is 192 to 223.

  Insert image description here

  Although it is possible to access each host through the IP address, it is obviously very difficult to remember so many clumsy strings of numbers, so the Internet provides domain names ()

  Domain names are also composed of several parts, separated by dots, for example, the domain name of the host “Baidu Search” is the pinyin of Baidu, which is “www.baidu.com”, obviously the domain name is much easier to remember than the IP address.

  There is a special one, the corresponding IP address is always the local machine address.

  , pointing to an IP address.

  Insert image description here

  Insert image description here

  Play a small experiment [Block Website]

  Step 1: Taking as an example, first test whether the computer can access the website
betting online website lottery online and The latest entrance
  Insert image description here

  Seems to be problem-free

  step2: Append the hosts file:

  Insert image description here

  Win10 needs, can not find the file, first select

  , re-enter the website address to access

  Insert image description here

  Insert image description here

  Expansion: through the implementation of 4399 web page access

  Hosts is a system file without an extension, which can be opened with tools such as Notepad. Its function is to establish an ‘database’ of association between some commonly used website domain names and their corresponding IP addresses. When a user enters a website address that needs to be logged in, the system will first automatically search for the corresponding IP address in the Hosts file. Once found, the system will immediately open the corresponding web page. If not found, the system will then submit the website address to the DNS domain resolution server for IP address resolution.

  When browsing a website, the browser must first resolve the domain name of the website to be visited into a unique IP address through the DNS server, and then the browser can locate and access the data of this website.

  The operating system stipulates that before making a DNS request, check whether there is a mapping relationship between the domain name and IP address in the system’s Hosts file. If there is, directly access the network location specified by this IP address. If not, then submit the domain resolution request to the known DNS server. That is to say, the IP resolution priority of Hosts is higher than that of DNS

  4.1 Domestic DNS

  First place

  114DNS: ★★★★★

  114DNS opened the curtain for the era of high reliability DNS. 114DNS began to provide high-speed, stable, and credible DNS recursive resolution services to the public.

  Analysis service; providing authoritative intelligent DNS resolution services with strong anti-attack capabilities for websites; providing reliable DNS disaster recovery and outsourcing services for ISPs;

  As the largest DNS with the largest number of domestic users, it has fast access speed, nodes in various regions, load users from various operators, and DNS anti-hijacking ability

  Natural strength, of course, is also listed in the top.

  DNS server IP address:

  Primary: 114.114.114.114

  Alternative: 114.114.114.115

  2017 Public DNS Server Address Evaluation – DNS Recommendation

  Second place

  DNSPod DNS: ★★★★★

  DNSPod was founded in March 2006 and is the largest third-party domain name service provider in China, ranking fourth globally. DNSPod was the first to provide

  Websites providing free intelligent DNS products, committed to providing high-quality Telecom, Unicom, and Education Network dual-line or triple-line intelligent DNS for all kinds of websites.

  Free resolution, as one of the competitors of 114DNS, whether it is access speed, node coverage in various regions, or anti-hijacking ability, all are

  Top-level.

  DNS server IP address:

  Primary: 119.29.29.29

  Alternative: 182.254.116.116

  2017 Public DNS Server Address Evaluation – DNS Recommendation

  Third place

  Alibaba DNS: ★★★★★

  Alibaba Public DNS is a DNS recursive resolution system launched by the Alibaba Group. As the largest domestic Internet infrastructure service provider, Alibaba
online casino platform and Just click to enter
  Based on the inheritance of many years of excellent technology, Babar provides the most reliable public DNS services to a large number of Internet users by offering superior performance.

  provides free DNS recursive resolution services with ‘fast’, ‘stable’, and ‘intelligent’ for Internet users.

  DNS server IP address:

  Preferred: 223.5.5.5

  Alternative: 223.6.6.6

  2017 Public DNS Server Address Evaluation – DNS Recommendation

  4.2 Domain name classification

  1. Language classification

  English domain names, Chinese domain names, Japanese domain names, Korean domain names, etc.

  Now we commonly see English domain names.

  English domain names: baidu.com

  Chinese domain names: baidu.com, baidu.中国, baidu.中国

  Other language domain names are the same as above.

  Insert image description here

  2. Regional classification

  China, the United States, the United Kingdom, Japan, and so on.

  In China, we commonly use the .cn domain, which is the top-level domain of the mainland of China. In addition, there are .com.cn, .net.cn, .org.cn, etc. Different provinces and cities in China also have their own top-level domains, such as the top-level domain of Inner Mongolia is: .nm.cn.

  The top-level domain of the United States is .us, Japan is .jp, and Hong Kong is .hk.

  3. Institutional classification

  .com Commercial institutions or companies

  .org Non-profit organizations, groups

  .gov Government departments

  .net Domain names of institutions or companies related to the Internet

  Although there are many classifications, we do not follow this principle too much in our daily use. For example, many .com are also used as personal websites, and many .net are also used for company websites.

  4.3 Hierarchical classification

  1. Top-level domain (first-level domain)

  baidu.com

  baidu.cn

  2. Second-level domain

  www.baidu.com

  jingyan.baidu.com

  3. Third-level domain

  wangshangyingxiao.club.1688.com

  hhz.bbs.53hui.com

  Insert image description here

  Describe simply how networks are connected:

  Insert image description here

  Insert image description here

  Deep understanding – book recommendation ‘How Networks Are Connected’

  Insert image description here

  What does the transmission rely on for control

  Insert image description here

  Source port and destination port fields

  TCP source port (Source Port): occupies . It represents the application on the source computer.

  TCP destination port (Destination Port): occupies . It represents the application on the target computer.

  Sequence number field

  CP sequence number (Sequence Number): occupies . It represents the serial number of the first byte of the data sent in this message segment. In TCP connections, each byte of the transmitted byte stream will be numbered in order. When the SYN flag is set, this is the serial number of the first letter of the current data segment; if the value of SYN is , the value of this field is the sequence value (ISN), used for . At this time, the serial number of the first byte is 1 greater than the value of this field, that is, ISN + 1

  Acknowledgment Number Field

  TCP Acknowledgment Number (Acknowledgment Number, ACK Number): It indicates the sequence number of the first byte of data that the receiving end expects to receive from the sender’s next data segment. Its value is the next byte that the receiving computer will receive, i.e. the next byte to be received.

  Data Offset Field

  TCP Header Length (Header Length): The data offset refers to the byte offset from the start of the ‘data’ part of the data segment to the start of the TCP data segment. In fact, the ‘data offset’ here is also used to determine the length of the TCP data segment header, to inform the receiving end’s application that.

  Reserved Field

  Reserved: For the future development of TCP.

  Flag Field

  CWR (Congestion Window Reduce): A flag indicating that it has received a TCP packet with the ECE flag set. After receiving the message, the sender reduces the size of the sending window to slow down the sending rate. ECE (ECN Echo): Used to indicate that a TCP endpoint has ECN functionality during the TCP three-way handshake. During data transmission, it also indicates that the ECN in the IP header of the received TCP packet is set to 11, i.e. URG (Urgent): Indicates the data sent in this data segment. When URG=1, it means there is urgent data. When , ACK: Indicates the previous sequence number field. When ACK=1, it indicates that the previous sequence number field is valid. Only when ACK=1, the previous acknowledgment number field is valid. PSH (Push): Informs the other party that after receiving this data segment, if the value is 1, it means that the data should be submitted to the upper layer immediately, rather than cached. RST: Indicates whether . If RST=1, it means , it is necessary to release the connection and then re-establish the connection. SYN: Used when establishing a connection, to be used for . When SYN=1, ACK=0, it indicates that this is a connection establishment data segment; when SYN=1, ACK=1, it indicates that the other party has established a connection. When SYN=1, it indicates that this is a request to establish a connection or an agreement to establish a connection. FIN: Marks the end of data. If FIN=1, it means that the data has been sent and the connection can be released.

  Window Size Field

  Window Size (Window Size): It indicates how many bytes of data can still be received from the Ack Number, and also indicates the current window of the receiving end. This field can be used for TCP flow control.

  TCP Checksum Field

  Checksum (TCP Checksum): It is used to confirm. The sender generates a number based on the data content, and the receiver verifies the generated value based on the received data., only then can it be proved that the data is valid. If the two values are different, discard this data packet. The Checksum is calculated based on three parts.

  Urgent Pointer field

  Urgent Pointer (Urgent Pointer): Only for the current . It indicates the number of bytes of urgent data in this data segment. When all the urgent data is processed, TCP will inform the application to return to normal operation. Even if the, because.

  Optional field

  Option (Option):, but the length must be .

  Insert image description here

  Three-way handshake

  The first handshake: When establishing a connection, the client sends a syn packet (syn=j) to the server and enters the SYN_SEND state, waiting for the server’s confirmation;

  The second handshake: After the server receives the syn packet, it must confirm the client’s SYN (ack=j+1), and at the same time, it also sends a SYN packet (syn=k), that is, the SYN+ACK packet. At this time, the server enters the SYN_RECV state;

  The third handshake: After the client receives the SYN+ACK packet from the server, it sends a confirmation packet ACK (ack=k+1) to the server. Once this packet is sent, the client and server enter the ESTABLISHED state, completing the three-way handshake.

  Three-way handshake:

  Xiaohang → Xiaofan: Can you hear me speaking?

  Xiaofan → Xiaohang: Yes, can you hear me speaking?

  Xiaohang → Xiaofan: Yes, we can start chatting now!

  Insert image description here

  Insert image description here

  Four-way挥手

  1) The client A sends a FIN to close the data transmission from client A to server B;

  2) After receiving this FIN, the server B sends back an ACK, confirming the sequence number as one more than the received sequence number. Like SYN, a FIN will occupy a sequence number;

  3) The server B closes the connection with the client A and sends a FIN to the client A;

  4) The client A sends back an ACK packet to confirm, and sets the sequence number to one more than the received sequence number.

  Four-way挥手:

  Xiaohang → Xiaofan: I want to exit this game round

  Xiaofan → Xiaohang: Good

  Xiaofan → Xiaohang: I also want to exit

  Xiaohang → Xiaofan: Good (both parties know that the other has exited the game at this time)

  Interview Summary

  Why is the connection establishment protocol a three-way handshake, while the connection closure is a four-way handshake?

  This is because when the SOCKET in the LISTEN state of the server receives a connection request in the form of a SYN message, it can send the ACK and SYN() in a single packet. When it receives the FIN message from the other party, it, however, there is also a possibility that there is still some data in transit to the other party, so you cannot close the connection immediately. That is, you may still need to send the data in transit to the other party, or you may still have some data to send to the other party before closing the connection, and then send the FIN message to the other party to indicate that you agree to close the connection now, so it is here.

  Why does the TIME_WAIT state need to wait for 2MS L before returning to the CLOSED state?

  This is because although both parties have agreed to close the connection, and the 4 handshake messages have also been coordinated and sent, it should be possible to directly return to the CLOSED state (just like from the SYN_SEND state to the ESTABLISHED state); but because we must assume that the network is unreliable, you cannot guarantee that the ACK message you finally send will definitely be received by the other party. Therefore, the SOCKET in the LAST_ACK state of the other party may resend the FIN message due to timeout without receiving the ACK message, so the role of this TIME_WAIT state is. (What do the involved states mean, please refer to ‘The States of Each Step in TCP Communication’).

  Insert image description here

  Let me explain:

  The UDP header is simple, including source port, destination port, UDP total length, checksum, each occupying 16 bits/2 bytes, a total of 8 bytes. Source port: 16 bits in length, specifying the port number used by the sender. If there is no need for a response from the other party, it can be set to 0 entirely. Destination port: 16 bits in length, specifying the port number used by the recipient. UDP total length: 16 bits in length, specifying the total length of the UDP datagram. Checksum: 16 bits in length, used for error detection in UDP, to prevent errors in UDP messages, and at the same time, the pseudo-header is involved in the calculation to avoid the UDP user data packet being delivered to the wrong destination. The header, data part, and pseudo-header of UDP will participate in the checksum calculation, and each field is calculated in units of 16 bits, therefore, the data part must be guaranteed to be filled with zeros if it is insufficient.

  1. Introduction to HTTP Protocol

  (English: HyperText Transfer Protocol, abbreviation: HTTP) is an application layer protocol used for distributed, collaborative, and hypermedia information systems. HTTP is the foundation of data communication on the World Wide Web.

  The development of HTTP was initiated by Tim Berners-Lee at the European Organization for Nuclear Research (CERN) in 1989. The standardization of HTTP was coordinated by the World Wide Web Consortium (W3C) and the Internet Engineering Task Force (IETF), and ultimately a series of RFCs were published, the most famous of which was RFC 2616 published in June 1999, defining a widely used version of the HTTP protocol today – HTTP 1.1.

  In December 2014, the Hypertext Transfer Protocol Bis (httpbis) working group of the Internet Engineering Task Force (IETF) submitted the HTTP/2 standard proposal to the IESG for discussion, which was approved on February 17, 2015. The HTTP/2 standard was officially published as RFC 7540 in May 2015, replacing HTTP 1.1 and becoming the implementation standard for HTTP.

  2. Overview of HTTP Protocol

  HTTP is a standard (TCP).

  Through the use of web browsers or other tools, the client initiates an HTTP request to the specified port on the server (()).

  The client is referred to as a user agent.

  The server that responds and stores some resources, such as HTML files and images, is called the origin server.

  Normally, an HTTP client initiates a request., The HTTP server waits for that. Once the request is received, the server will send a status to the client, such as “HTTP/1.1 200 OK”, as well as the content returned, such as the requested file, error message, or other information.

  3. HTTP Working Principle

  The HTTP protocol defines how the Web client requests a Web page from the Web server, as well as how the server sends the Web page to the client. The HTTP protocol uses., The request message includes the request method, URL, protocol version, request headers, and request data. The server responds with a., The response content includes the protocol version, success or error code, server information, response headers, and response data.

  The following are the steps of HTTP request/response:

  The client connects to the Web server

  The browser sends an HTTP request to the DNS server for the IP address corresponding to the domain name in the URL, an HTTP client, typically a browser, sends an HTTP request to the HTTP port of the Web server (default is 80).

  Through the TCP socket, the client sends a text request message to the Web server… The server accepts the request and returns an HTTP response

  Web server. The server writes the replica of the resource to the TCP socket, which is read by the client… Release the TCP connection

  If the connection mode is close, the server actively closes the TCP connection, and the client passively closes the connection, releasing the TCP connection; if the connection mode is , then the can continue to receive requests within that time; the client browser parses the HTML content

  First, the client browser checks the status code indicated. Then, the response headers inform that the following is a certain number of bytes of HTML documents and the character set of the documents. The client browser formats it according to the syntax of HTML and displays it in the browser window.

  The HTTP protocol is an application layer protocol based on the TCP/IP protocol.sports betting method and The latest method

  Insert image description here

  Based on the request-response model

  The HTTP protocol stipulates that requests are initiated from the client, and the server responds to the request and returns in the end. In other words, communication is definitely initiated from the client first, and the server will not send a response before receiving a request.

  Insert image description here

  Stateless

  HTTP is stateless, meaning that the HTTP protocol itself does not save the communication state between requests and responses. In other words, at the HTTP level, .

  Insert image description here

  Using the HTTP protocol, a new response is generated each time a new request is sent. The protocol itself does not store any information about previous requests or response messages. This is why the HTTP protocol is specifically designed to be so simple. However, with the continuous development of the Web, the increasing number of situations where statelessness makes business processing difficult. For example, when a user logs into an online shopping website, even if he is not logged in, he also needs to be able to. For this example, the website needs to save the user’s state in order to be able to determine who sent the request. Although HTTP/1.1 is a stateless protocol, in order to achieve the expected state-keeping function, it introduces. With the use of cookies, communication with the HTTP protocol can manage the state. The detailed content of cookies will be explained later.

  Connectionless

  The meaning of connectionless is to limit each connection to handle only one request. After the server processes the client’s request and receives the client’s response, the connection is disconnected. This method can avoid establishing a long-term connection with each user, handling requests and responses once, and then the server and client disconnect. However, the early HTTP protocol disconnected directly after a request and a response, but the current HTTP protocol 1.1 version does not disconnect directly, but waits for a few seconds. What is this waiting for? It is waiting for the user to have subsequent operations. If the user has a new request within these few seconds, the messages are still received and sent through the previous connection channel. If no new requests are sent by the user after these few seconds, the connection will be disconnected. This is because establishing a connection also takes time, and the default seems to be 3 seconds now. However, this, the optimal waiting time should be analyzed and statistically determined based on the behavior of the users of your own website.

  Summary: HTTP is a stateless, connectionless protocol based on requests and responses

  4. HTTP request format (request protocol)

  It is just a string:

  Insert image description here

  The URL includes: /index/index2?a=1&b=2; both the path and parameters are here.

  Insert image description here

  Here is an example of the content in the request header: this length indicates, and you can roughly understand the key-value pairs in other request headers, among which there is one that tells your server what kind of request I sent to you, and what kind of client it is.

  Insert image description here

  Take JD as an example and see the user-agent

  Insert image description here

  Insert image description here

  Let’s look at an example of a crawler. When crawling JD, there is no problem, but when crawling the drawer, you must have the user-agent because it can judge whether your request is a normal request, which is a kind of anti-crawling mechanism.

  Insert image description here

  Open the demo.html file we saved, and then open it through the browser to see the page effect.

  The meaning of writing the above content is to let you know that there is such a request header, some of which are meaningful, just add it to the headers={} dictionary in the requests module.
online casino download and The latest strategy
  5. HTTP request methods

  The HTTP/1.1 protocol defines several ways to:

  (1) GET

  Send a request to the specified resource. GET method should only be used for, and should not be used for operations that produce “side effects”, commonly used in data query requests.

  (2) POST

  Request the server to process the specified resource (such as submitting a form or uploading a file). The data is included in the request body. This request may create a new resource or modify an existing resource, or both. It is often used for data addition, deletion, and modification operations.

  Request method: get and post requests (write it ourselves through the form)

  GET submitted data will be placed after the URL, that is, in the request line, such as EditBook?name=test1&id=123456. (The parameters in the request header are of this form, which will be discussed later) POST method is to place the submitted data in the request body of the HTTP packet. (Because) the data submitted by the POST method is not limited. GET and POST requests

  6. URL

  The Uniform Resource Locator (URL) of the Hypertext Transfer Protocol (HTTP) includes the five basic elements of obtaining information from the Internet in a simple address:

  The transmission protocol layer URL marker symbol (as [//], fixed and unchanged) access resource credentials information (can be omitted) server () port number (represented by numbers, if it is the default value of HTTP:) path (distinguished by the “/”) character for each directory name in the path) query (GET mode form parameters, starting with the “?” character, each parameter separated by “&”, and separated by “=” between parameter name and data, usually encoded in UTF8 URL encoding to avoid character conflicts) fragment (starting with the “#” character)

  7. Common ContentTypes in requests

  It is to inform the server that I have sent a parameter to you, what type of parameter it is, and how you should receive and parse it.

  application/x-www-form-urlencoded

  This should be the most common way to submit POST data. If the browser’s native form does not set the enctype attribute, it will ultimately submit the data in the application/x-www-form-urlencoded manner. The request is similar to the following (irrelevant request headers are omitted in this article)

  Format: name=’lisi’&age=13

  application/json

  The application/json Content-Type as a response header is certainly not unfamiliar. In fact, more and more people are using it as a request header to inform the server that the message body is a serialized JSON string. Due to the popularity of the JSON specification, all major browsers (except for low-version IE) support JSON.stringify natively, and server-side languages all have functions to handle JSON. Using JSON will not encounter any trouble.

  Format: {“name”:”lisi”,”age”:13}

  multipart/form-data

  This is another common way to submit POST data. When we use form uploads to upload files, we must ensure that the form’s enctyped is equal to this value.

  8. HTTP response format (response protocol)

  Insert image description here

  Insert image description here

  Common contentType in responses

  text/html

  Inform the browser that the data returned is HTML, please render

  application/json

  Inform the browser that the data returned is JSON, and it is generally expected that JavaScript will handle it

  Common content type reference table

  9. HTTP status codes

  All HTTP responses, in order, are separated by.

  Status codes:

  1xx messages – The request has been received by the server and is being processed2xx success – The request has been received, understood, and accepted by the server (200)3xx redirection – Further actions are required to complete this request4xx request errors – The request contains lexical errors or cannot be executed, client (404)5xx server errors – The server encountered an error while processing a valid request, 500

  Although the RFC 2616 has recommended descriptive phrases for status, such as “200 OK”, “404 Not Found”, web developers can still decide on which phrase to use to display localized status descriptions or custom information.

  Insert image description here

  10. Some common response headers:

  Common request header reference table

  1. Main class

  2. Utility class

  3. Thread task class

  4. Self-contained request packaging

  5. Self-contained response packaging

  6. Linux system testing

  Crawling college students’ schedules and grades

  Front-end and back-end interaction

  Continuously updated~~~~

  Hint: