What is HTTP protocol
A brief introduction to the HTTP protocol
The HTTP protocol is a hypertext transfer protocol, which is a communication protocol based on TCP/IP for data transmission
Features:
1. Simple and fast , when the client initiates a request to the server, it only needs to transmit the request method and path. Commonly used request methods include POST, GET, etc. Each method specifies a different type of contact between the client and the server. Because the HTTP protocol is simple, the communication speed is fast
2. Flexible: any type of data object can be transmitted. The transmission type is marked by Content-Type
3. No connection: Limit each connection to only process one request. After the server processes the client's request, it will disconnect after receiving the client's response
4. Stateless: HTTP is a stateless protocol. Stateless means that the protocol has no memory ability for transaction processing. The lack of status means that if the previous information is needed for subsequent processing, it must be retransmitted, which may increase the amount of data transmitted per connection. On the other hand, when the server does not need other information, its response will be very fast
5. Supports B/S and C/S modes
URL
URL is a uniform resource identifier used by HTTP to transmit data and establish connections. URL is a special type of URI, the full name is UniformResourceLocator, and the Chinese name is Uniform Resource Locator. The URL contains the following parts:
For example: https://baike.baidu.com:8080/item/url/110640 ?fr=aladdin
1. Protocol/mode part: It tells the browser how to handle the file to be opened. The most commonly used mode is the Hypertext Transfer Protocol (HTTP), which is used to access the Internet. Other protocols are as follows:
http——Hypertext Transfer Protocol resources
https - Hypertext Transfer Protocol delivered using Secure Sockets Layer
ftp——File Transfer Protocol
mailto——email address
ldap——Lightweight Directory Access Protocol Search
file - a file shared on a local computer or online
News——Usenet News Group
gopher——Gopher protocol
telnet——Telnet protocol
In the above example, the protocol part is https
2. Domain name part: The above domain name is: baike.baidu.com
3. Port part: What follows the domain name is is the port number. Use: to separate the port from the domain name. The port is not a necessary part of a URL. If the port number is omitted, the default port will be used
4. The file name part: /item/url/110640
5 . Parameter part: fr=aladdin, that is,
Request
after the question mark. The HTTP request message Request mainly consists of the following parts:
* Request line: Request method | URL | Protocol version
* Request header: The request header contains a lot of useful information about the client environment and the request body
* Request body: There is a blank line between the request header and the request body. This The line is very important, it indicates that the request header has ended, and what follows is the request body. The request body can contain query string information submitted by the customer
Response
HTTP response message Response consists of the following parts:
* Status line: Protocol version | Status code | Status Message
* Response header: Date, Content-Type, etc.
* Response text: Server-side return data
Status code
The status code consists of three digits, the first Numbers define the category of the response
* 1xx: Indication message, indicating that the request has been received, continue processing
* 2xx: Success, indicating that the request has been successfully received
* 3xx: Redirect, indicating that the request will be made at night Further operations are required
* 4xx: Client error, indicating that the request has a syntax error or cannot be implemented
* 5xx: Server error, indicating that the server failed to implement a legal request
Common status Code:
1 |
|
Request method
1 2 |
|
1 2 3 4 5 6 |
|
The difference between GET and POST
Data submission: GET request data will be placed after the URL, using & number to connect, but the POST request data will be placed in the HTTP packet
Transmission data size: Since general browsers have restrictions on the length of the URL, GET is used to request the data There will be a size limit, but POST puts the data in the package, that is, there is no size limit
Security: GET submits the data in the URL and can be cached to return the data
Note:
1. The HTTP protocol does not limit the size of transmitted data, and the HTTP protocol specification does not limit the length of the URL.
2. HTTP’s GET, POST, and SOAP protocols all run on http
(1) GET: The request parameters are appended to the URL as a sequence of key/value pairs (query string) The length of the
query string is limited by web browsers and web servers (such as IE supports up to 2048 characters), which is not suitable for transmitting large data sets. At the same time, it is very unsafe
(2) POST: The request parameters are transmitted in a different part of the http header (named entity body). This part is used to transmit form information, so Content-type must be set to: application/x-www- form-urlencoded. Post is designed to support user fields on web forms, and its parameters are also transmitted as key/value pairs.
But: it does not support complex data types because post does not define the semantics and rules for transmitting data structures.
(3) SOAP: It is a special version of http post, following a special xml message format
Content-type is set to: text/xml Any data can be xmlized.
The HTTP protocol defines many methods of interacting with the server, the most basic of which are GET, POST, PUT, and DELETE. A URL address is used to describe a resource on the network, and in HTTP GET, POST, PUT, and DELETE correspond to the four operations of checking, modifying, adding, and deleting this resource. Our most common ones are GET and POST. GET is generally used to obtain/query resource information, while POST is generally used to update resource information.
The above is the detailed content of What is HTTP protocol. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



How to set up keyboard startup on Gigabyte's motherboard. First, if it needs to support keyboard startup, it must be a PS2 keyboard! ! The setting steps are as follows: Step 1: Press Del or F2 to enter the BIOS after booting, and go to the Advanced (Advanced) mode of the BIOS. Ordinary motherboards enter the EZ (Easy) mode of the motherboard by default. You need to press F7 to switch to the Advanced mode. ROG series motherboards enter the BIOS by default. Advanced mode (we use Simplified Chinese to demonstrate) Step 2: Select to - [Advanced] - [Advanced Power Management (APM)] Step 3: Find the option [Wake up by PS2 keyboard] Step 4: This option The default is Disabled. After pulling down, you can see three different setting options, namely press [space bar] to turn on the computer, press group

What graphics card is good for Core i73770? RTX3070 is a very powerful graphics card with excellent performance and advanced technology. Whether you're playing games, rendering graphics, or performing machine learning, the RTX3070 can handle it with ease. It uses NVIDIA's Ampere architecture, has 5888 CUDA cores and 8GB of GDDR6 memory, which can provide a smooth gaming experience and high-quality graphics effects. RTX3070 also supports ray tracing technology, which can present realistic light and shadow effects. All in all, the RTX3070 is a powerful and advanced graphics card suitable for those who pursue high performance and high quality. RTX3070 is an NVIDIA series graphics card. Powered by 2nd generation NVID

Understand the meaning of HTTP 301 status code: common application scenarios of web page redirection. With the rapid development of the Internet, people's requirements for web page interaction are becoming higher and higher. In the field of web design, web page redirection is a common and important technology, implemented through the HTTP 301 status code. This article will explore the meaning of HTTP 301 status code and common application scenarios in web page redirection. HTTP301 status code refers to permanent redirect (PermanentRedirect). When the server receives the client's

Which tablet is suitable for musicians? The 12.9-inch speaker in Huawei’s iPad is a very good product. It comes with four speakers and the sound is excellent. Moreover, it belongs to the pro series, which is slightly better than other styles. Overall, ipad pro is a very good product. The speaker of this mini4 mobile phone is small and the effect is average. It cannot be used to play music externally, you still need to rely on headphones to enjoy music. Headphones with good sound quality will have a slightly better effect, but cheap headphones worth thirty or forty yuan cannot meet the requirements. What tablet should I use for electronic piano music? If you want to buy an iPad larger than 10 inches, I recommend using two applications, namely Henle and Piascore. Provided by Henle

In the process of using the Windows 10 operating system developed by Microsoft, many users are curious and confused about the new technology called Cortana. Cortana's official name in the Chinese context is "Cortana", which is actually a built-in function of the Windows 10 system. Cortana, an artificial intelligence (AIassistant) service program. Frequently asked questions and solutions. How to open Cortana and not respond. Solution steps. Chinese solution is not supported. How to put the search box into Cortana. What software is Cortana? Answer: "Cortana" It is a cloud platform personal intelligent assistant carefully built by Microsoft. It has two usage modes: login and non-login. When you are logged in

What driver is good to install on rx5808g? 20.5.1 and 20.4.2WHQL refer to the version number of the software or driver. These version numbers are typically used to identify updates or fixes to software or drivers. In the computer world, WHQL stands for Windows Hardware Quality Labs, which is an institution used by Microsoft to test and verify the compliance and stability of hardware and drivers. Therefore, 20.5.1 and 20.4.2WHQL indicate that these software or drivers have passed Microsoft's testing and verification and can be safely used in the Windows operating system. AMDrx580 graphics card relatively stable drivers 20.5.1 and 20.4.2WHQL refers to the version number of the software or driver. These version numbers are passed

What games can be played with i34150 with 1G independent graphics? Can it play small games such as LoL? GTX750 and GTX750TI are very suitable graphics card choices. If you just play some small games or not play games, it is recommended to use the i34150 integrated graphics card. Generally speaking, the price difference between graphics cards and processors is not very big, so it is important to choose a reasonable combination. If you need 2G of video memory, it is recommended to choose GTX750TI; if you only need 1G of video memory, just choose GTX750. GTX750TI can be seen as an enhanced version of GTX750, with overclocking capabilities. Which graphics card can be paired with i34150 depends on your needs. If you plan to play stand-alone games, it is recommended that you consider changing the graphics card. you can choose

What configurations are needed to use CAD smoothly? To use CAD software smoothly, you need to meet the following configuration requirements: Processor requirements: In order to run "Word Play Flowers" smoothly, you need to be equipped with at least one Intel Corei5 or AMD Ryzen5 or above processor. Of course, if you choose a higher-performance processor, you'll be able to get faster processing speeds and better performance. Memory is a very important component in the computer. It has a direct impact on the performance and user experience of the computer. Generally speaking, we recommend at least 8GB of memory, which can meet the needs of most daily use. However, for better performance and smoother usage experience, it is recommended to choose a memory configuration of 16GB or above. This ensures that the
