HTTP request line, request header, and request body Details/details HTTP header information

  • According to actual use:
  1. Common header field: the header used by both the request and response packets.

    • What it does: The generic header is a header that can be used by both clients and servers to provide some very useful generic functionality between clients, servers, and other applications, such as the Date header. A header that has nothing to do with the data transferred in the final message body.
    The first field instructions
    Cache-Control Controlling cache behavior
    Connection Hop – by – hop header and connection management
    Date Date and time when the packet was created
    Pragma Packet instructions
    Transfer-Encoding Specifies the encoding mode of the packet transmission body
    Upgrade Upgrade to another protocol
    Via Proxy server information
    Warning Error notification
  2. Request header field: the header used when sending request packets from the client to the server.

    • What it does: It is unique to the request message and provides the server with some additional information, such as what type of data the client wants to receive, such as the Accept header. This section provides additional information about the request, client information, and priority of the response.
    The first field instructions The sample
    Accept The types of media that the user agent can handle Accept: text/html
    Accept-Charset Preferred character set
    Accept-Encoding Priority content encoding. The browser declares the encoding method it receives, usually specifying the compression method. Does it support compression? What compression method does it support Accept-Encoding: gzip, deflate
    Authorization Web Authentication Information
    Except Expect specific behavior from the server
    if-Match Compare Entity Tag (ETag)
    if-Modified-Since Compares the update times of resources
    Range Byte range request for the entity
    Refer Byte range request for the entity
    TE Priority of transmission encoding
    User-Agent HTTP client program information

    Example request message:

    GET /home.html HTTP / 1.1
    User-Agent: Mozilla / 5.0 (Macintosh; Intel Mac OS X 10.9; The rv: 50.0) Gecko / 20100101 Firefox 50.0Accept: text/html,application/xhtml+xml,application/xml; Q = 0.9 * / *; Q = 0.8Accept-Language: en-US,en; Q = 0.5Accept-Encoding: gzip, deflate, br
    Connection: keep-alive
    Upgrade-Insecure-Requests: 1
    If-Modified-Since: Mon, 18 Jul 2016 02:36:04 GMT
    If-None-Match: "c561c68d0ba92bbeb8b0fff2a9199f722e3a621a"
    Cache-Control: max-age=0
    Copy the code
  3. Response header field: the header used to return response packets from the server to the client.

    • Function: Facilitate the client to provide information. What type of Server the client is interacting with, such as the Server header. Additional content added to the response also requires the client to attach additional content information.
    The first field instructions
    Accept-Ranges Whether to accept byte range requests
    Age Calculate the elapsed time of resource creation
    ETag Matching information of resources
    Location Redirects a client to the specified UPI
    Proxy-Authenticate The proxy server authenticates the client
    WWW-Authenticate Authentication information about the server to the client
    Server HTTP server installation information. What type of server is the client interacting with?
    vary Management information about the proxy server
  4. Entity header field: the header used for the entity part of the request message and response message.

    • What it does: You can use the entity header to specify the data Type of the body part of the entity, such as the Content-Type header. Added entity-related information such as when the resource content was updated.
    The first field instructions
    Allow HTTP methods supported by the resource
    Content-Encoding The encoding method applicable to the entity body
    Content-Language The natural language of entity subjects
    Content-Length The size of the entity body
    Content-Location Replace the URI of the corresponding resource
    Content-MD5 The packet digest of the entity body
    Content-Range The location range of the entity body
    Content-Type The media type of the entity body
    EXpires The date and time when the entity body expires
    Last-Modified The last modified date and time of the resource
  1. The difference between arrays and linked lists

    An array of The list
    Data structure: A collection of type data elements An unordered collection of linked elements of a node
    Use indexes to find elements directly Starting from scratch, so linking lists takes linear time and is much slower
    Arrays have fixed sizes Linked lists are dynamic and flexible, and can be expanded and reduced in size
    Inserting and deleting an array can take a lot of time Linked lists insert and delete quickly
    Memory is allocated during compilation Allocates memory at execution or runtime
    Elements are stored consecutively in an array Elements are stored randomly in a linked list
    Less memory requirements More memory is required in the linked list because additional next and previous reference elements are stored
  2. How to determine the tail pointer

    Normal linked list: p->next == NULL

    Loop list: p->next == HEAD

  3. How do you tell if a linked list is closed loop

    Fast and slow pointer judgment: let pointer 1 move down one node each time, let pointer 2 move down two nodes each time, and then compare whether the two Pointers point to the same node. If they are the same, then the linked list is judged to have a ring, if not, then continue the next cycle.

  4. Why are vue js functions called first citizens

    Features of functional programming:

    • Functions can be stored in variables

    • Function as argument (higher order function)

    • Function as return value (higher-order function)

  5. What does vue’s data return do

    • Data that is not wrapped with return is visible globally in the project, resulting in variable contamination

    • Variables in data wrapped with return only take effect in the current component and do not affect other components

    • ** The latter data is a method, ** is the same as:

          return{}}Copy the code
  6. Vue vs. React

    • The implementation principle of monitoring data changes is different

      1. With getters/setters and some hijacking of functions, Vue knows exactly how the data is changing and does not require special optimization to achieve good performance
      2. Defective React to monitor data changes: the React the default was conducted by means of comparative reference, if not optimal (PureComponent/shouldComponentUpdate) may lead to a lot of unnecessary VDOM to render
    • Differences in data flow

      1. Bidirectional binding between Vue components <–> DOM

      2. React has always advocated one-way data flow, which he calls the onChange/setState() mode

    • HoC and mixins

      1. The way we combine different functions in Vue is through mixin.Vue components are wrapped functions, not simply objects or functions passed in when we define components
      2. In React we use HoC (high-level component). High-order components are essentially high-order functions. The React component is a pure function, so high-order functions are very simple for React
    • Component communication differences

      1. There are three ways to implement component communication in Vue:

        - The parent component passes data or callbacks to the child component through props. Although callbacks can be passed, we usually only pass data. The communication between the child component and the parent component is handled through the mechanism of events

        - Child components send messages to parent components via events

        - Provide/Inject data from the parent component to the child component through the newly added provide/ Inject function in V2.2.0, spanning multiple levels.

      2. React also has three types:

        - The parent component can pass data or callbacks to the child components through props

        Context can be used to communicate across hierarchies, which is similar to provide/inject

      3. React does not support custom events. In React, we use callback functions. A Vue neutron component can pass messages to its parent in two ways: events and callback functions, and Vue prefers to use events

    • The template renders differently

      1. Vue is rendered using an extended HTML syntax. / Vue is implemented in a separate template from the component JS code, using instructions such as v-if for conditional statements
      2. React renders the template using JSX. React implements common syntax in the template using native JS syntax, such as interpolation, conditional, loop, etc

    Vue and React are different

  7. Why use React on mobile

    • The biggest benefit of React is that it saves the complexity of fine-grained operations and has the maintainability of large engineering projects

    • React can be rendered on the server

    • Virtual DOM

    • componentization

    • Compatibility is indeed better than VUE

    • But violence relies on the Diff algorithm

  8. Elementui-related issues

This post was first posted on my GitHub blog and will be updated on other blogs.