Learn the basics of the HTTP protocol (micro-summary).

Source: Internet
Author: User
Tags url example keep alive

1. Network NatureFor resource sharing and information transfer. 2, the essence of Web-based applications is to obtain data and transfer data to users. 3, the TCP/IP protocol stack Workflow entity layer is not a layer of TCP/IP protocol stack. This means that the TCP/IP stack totals four layers.
First you have to access the network, LAN or WAN, when the computer is connected to the network, that is, when the cable is inserted in the local router
The routing table updates the data and removes long unused computer IP and MAC addresses with a certain elimination mechanism algorithm, and calculates the new join group
IP, the routing table will get the MAC address of the new access computer via the ARP Protocol (Address Resolution Protocol) and deposit
The MAC address and the assigned IP address.
First a user uses the application to generate data and sends the data through the application-layer conventions (i.e. application-layer protocol), where the data is first sealed
To form head and data. Re-encode the port that the target computer needs to accept data through the transport layer again. Second package, using the transport layer
The agreed rules (that is, the Transport Layer protocol, TCP/UDP) send the data, the data arrives at the network layer, the network layer confirms the destination IP to send the data through the IP protocol,
Then through the data Link layer's MAC address, the data link layer passes the data through the Ethernet protocol the third time to encapsulate the frame, the frame also points head (header, fixed length
18 bytes) and data (the minimum 46 bytes, the maximum 1500 bytes), the excess is divided into multiple frames to send. Then through the physical layer for the fourth time
Encapsulation, the data is packaged into 1 or 0 high and low potentials using the Entity layer protocol, which may be encoded using differential Manchester, where the data is
A network cable or electromagnetic wave arrives at a route or switch, and the route first checks to see if the destination IP is within the group's LAN, through the destination IP address and the sender IP
To the local subnet mask (and), if the result of the operation is equal, the target host is within this LAN and is determined directly through the routing table.
IP and Mac information to send data. If not, the router continues to send the data to the upper layer until a node has information belonging to the destination IP
, receive it, and re-open it four times through the application layer, Transport layer, network layer, Data link layer--layer-------To find ip-> confirm Mac
Address, confirm the port information, receive the data to the User B application, and then the application presented to the B user. 4, network five layer 1) application layer: The application layer determines the activity that communicates to the user when the application service is provided, and the HTTP protocol is in that layer. 2) Transport layer: The Transport layer provides port-to-port data transfer between two computers in a network connection to the upper application layer. There are two different protocols in the Transport layer: TCP and UDP. 3) Network layer: The network layer is used to process packets that flow over the network. A packet is the smallest unit of data transmitted over a network. This layer specifies what path (IP address to IP address) to reach the other computer.
and send the packets to each other.
When transferring from one computer or network device to another, the network layer's role is to select a transmission route within a multitude of options. 4) Link layer: Used to process the hardware part of the connection network. Including the control of the operating system, hardware device drivers, network cards and optical fiber and other physical visible parts (including connectors and other transmission media).
The categories on the hardware are within the scope of the link layer. 5) Entity layer: Responsible for physical means to connect the computer, and transmission of 0 and 1 of electrical signals. 5, Html, hypertext Super Text, the linear text into non-linear text, with jump. 6, HTTP Protocol HTTP protocol is the TCP/IP protocol family based on the operation, is a subset of TCP/IP.
Is on the application layer to the server, the client for the data transmission method, transmission format constraints and provisions of a protocol, the specific format and process
are described below. 7, server, service, server program server can be understood as a more powerful host, the server for each client service, for the client request service,
The corresponding service is called by the server program to provide services to the client. 8, browser ——— > Server request response to the client to initiate a request to the server, send a request message, the server receives the request message, if the message is sent without a cookie (such as initial login)
, the server sets a cookie and logs it, responds to the response message, and compares the cached data in the request header, if the last modification time of the record equals the service
The last time the device was modified or the resource stamp is consistent with the server, the new page is not returned, the client continues to use the original interface, or the new page is returned. 9, URL URL format: schema://host[:p ort#]/path/. /[?query-string][#anchor] I. Schema: protocol used, HTTP, https. HTTPS is a secure HTTP protocol
II. Host: Indicates the domain name or IP address of the requesting server
III. PORT: Port number, default is 80
Iv. path: The path to the request resource
V. query-string: Data sent to the server
VI. Anchor: Anchor, not related to the server, only with the client URL example: http://www.mywebsit.com/sj/test/test.html?name=zhangsan&age=18

Schema:http
Host:www.mywebsit.com
Port:80
Path:sj/test/test.html
Query-string:name=zhangsan&age=18
10, message Related Information supplement: Request message:? The request message has 4 parts:? 1, request line

Structure: Method/path-to-resource Http/version-number Method: Request Methods: Get, Post
Get data for the server
Post submission data to server Path-to-resource: path URL of request resource Version-number: Version number http/1.1 2, request header

Accept: The type of data that the browser receives
Accept-encoding: The browser is able to receive the encoded format of the data
Accept-language: Browser-supported languages
Accept-charset: The type of character set the browser can receive
User_agent: User agent that tells the server client about browser information and operating system information
Connection:keep Alive (Long connection and short connection)
Host: Hosting Address
Cookie: User identification (save username) 3, blank line 4, request body (requestor)
Response message: The response message is also divided into four parts: 1, Response Line (response lines) Structure: Http/version-number Status-code message http/version Number: version numbers general http/1.1 Status code a) Status code action: The server is used to tell the browser whether the browser has generated the expected response
b) Status code category: 1XX 2XX 3XX 4XX 5XX I. 1XX: Prompt to indicate that the server has received a request from the browser to continue processing
II. 2XX: Successful processing, indicating that the browser's request has been successfully received and processed correctly
III.3XX: Redirect, which means further processing is required
Iv. 4XX Client Request error indicating a client request error
V. 5XX server-side error, server failed to properly handle client request common status code interpretation: I. OK: Indicates that the client request was successfully received and sent the response data to the client
II. 302 Found: Redirect, the new URL will be returned in response, and the browser will automatically send a request to the new URL.
Iii. 304 Not Modified: Indicates that the information has been cached and can continue to use
Iv. 403 Forbidden: The server receives a client request but refuses to service the client
V. 404 Not Found: Indicates that the resource requested by the client does not exist (the URL was incorrectly lost)
VI. Internet Server error: Unexpected errors occurred on server message: status code corresponding state information 2, Response header (response header)

Date: Message generation time
Content-type: Type of response data
Transfer-encoding: chunked transfer
Last-modified:fri, APR 2018 06:43:31 GMT: The time that the server recorded the last modified file
Content-type: The content type of the body of the response message
Etag: Resource stamp, used in conjunction with If-none_match of request message
Set-cookie: Sending Cookie data to the browser and requiring the browser to record
Content-encoding: How the server responds to a browser's file compression
Content-language: The server tells the browser the language of the response
Server: Servers tell the browser about the current server
Location: redirected URL

3, empty line 4, Request body (response body) users see the content, generally use static or Dynamic Web page code

Learn the basics of the HTTP protocol (micro-summary).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.