One, url and URI
URI: Uniform Resource Identifier
URL: Uniform Resource Locator
Baidu Homepage Icon Connection
Https://www.baidu.com/img/bd_logo1.png
It is a URL and a URI that includes the Access Protocol, Access path, and resource name
URLs are a subset of URIs, each URL is a URI, but not every URI is Url,uri also includes a subset urn, which is the Uniform Resource name, urn only names the resource but does not specify how to locate the resource
Second, hyper-text
The Web page you see in the browser is a hypertext parsing, and the source code is a series of HTML code
Third, HTTP and HTTPS
This is the protocol type, there are other: FTP, SFTP, SMB start URL
HTTP: Hypertext Transfer Protocol, used for transmitting hypertext data to local browser, can guarantee the efficient and accurate transmission of hypertext documents, the HTTP1.1 version is widely used now.
HTTPS: Security for the purpose of the HTTP channel, is to add SSL layer on the basis of HTTP, its security is based on SSL, the content transmitted through it is SSL encrypted, its role is mainly:
1, establish an information security channel to ensure the security of data transmission
2, confirm the authenticity of the website, any use of HTTPS website, you can click on the browser address bar of the lock logo to view the real information after the site certification, but also through the CA authority issued by the security seal to inquire
Some websites use the HTTPS protocol, but will still be prompted by the browser is unsafe, such as 12306, this is because 12306 of the CA certificate is issued by the Ministry of Railways, this certificate is not trusted by the CA authority, but its data transmission is SLL encrypted
Iv. HTTP request Process
The client sends a request to the server that the server receives the request for processing resolution, and then returns the corresponding response
Request Baidu
- Name: The names of the requests
- Status: Response State code
- Type: Request Document type
- Initiator: Request Source
- Size: Files downloaded from the server and request resource sizes
- Time: The total times that the request was initiated to get the response
- Waterfall: Network request visualization Waterfall flow
Click to view more information
General:
- Request URL: Requested URL
- Request method: Methods for requests
- Status code: Response State Code
- Remote Address: Server addresses and Ports
- Referrer policy:referrer discriminant Strategy
V. Request:
The request is made by a client to the server and can be divided into 4 parts:
Request method: Requesting methods
Common methods: Get and post
- GET: Request page, return page content
- POST: More for submitting forms, uploading files
The parameters in the GET request are included in the URL, the data can be seen in the URL, the URL of the POST request does not contain the data, it is transmitted in form form, and is included in the request body
Get requests submit data with a maximum of 1024 bytes and no post mode limit
Other methods:
- HEAD: Similar to get, except that there is no specific content in the returned response to get the header
- PUT: Transfer data to the server instead of the specified document content
- Delete: Request the server to delete the specified content
- Connect: Serve as a springboard for servers to access other Web pages instead of clients
- OPTIONS: Allow clients to view server performance
- TRACE: Echo the request received by the server, primarily for testing
Request Header
Common header information:
- Accept: The Request header field, which specifies which types of information the client can accept
- Accept-language: Specify languages acceptable to the client
- Accept-encoding: Specify acceptable content encoding for the client
- Host: Specify the hosts IP and port of the requested resource
- Cookie: The data that is stored locally by the website in order to identify the user for session tracking
- Referer: Used to identify which page the request was sent from
- User-agent: string header, which allows the server to identify the operating system, version, browser, version and other information used by the client (crawler Plus, disguised as a browser)
- Content-type: Represents the media type information in a specific request
Request Body
The hosted content is the form data in the POST request, for a GET request, an empty
Relationship of Content-type and post submission data mode
- application/x-www-form-urlencoded: Form data
- Multipart/form-data: Form File Upload
- Application//json: Serialization of JSON data
- Text/xml:xml data
Vi. response
- Response Status code: Response Status Codes
- Response Headers: Response header
- Response Body: Response body
Status Code control:http://tool.oschina.net/commons?type=5
Response header
- Date: The time the response was generated
- Last-modified: Specifies the last time the resource was modified
- Content-encoding: Specifies the encoding of the response content
- Server: Servers information
- Content-type: Document type, specifying the type of data returned
- Set-cookie: Setting cookies
- Expires: Specifies the expiration time of the response so that the loaded content is updated to the cache, and re-accessed can be loaded directly from the cache
Response body
- The data in response is in the response body, such as the HTML code of the Web page
Web Base
HTML + CSS +js
V. Basic principles of HTTP