Home Web Front-end HTML Tutorial HTTP protocol knowledge closely related to front-end development

HTTP protocol knowledge closely related to front-end development

Apr 16, 2019 am 09:07 AM
http front end

What front-end engineers deal with most is the browser. No matter what they do, they cannot do without the browser. Among them, the HTTP protocol is often It will be ignored by us, but in fact, resource caching, CDN loading, page performance optimization, etc. are all inseparable from the understanding of the HTTP protocol.

HTTP is also called Hypertext Transfer Protocol, full name: Hyper Transfer Protocol. Initially HTTP could only transmit HTML files, but now it can transmit text, images, videos and various streaming files.

HTTP is stateless: the same client initiates multiple requests in succession. To the HTTP server, they are all new requests. HTTP has no way of knowing that it comes from a client.

HTTP message structure: To see the specific message structure, you need to use a packet capture tool, so here is only a brief introduction without specific examples. The message structures of request and response are basically the same.

Header: divided into request/response line and request/response header.

request/response line: includes the request method (GET/POST), the path to resource and the version number of the http protocol.

request/response header: Here are the various request headers.

Body: Response body, usually an HTML file. If it is a get request, there is no response body.

HTTP request method:

GET Request to obtain the resource identified by Request-URI
POST Append new data after the resource identified by Request-URI
HEAD Request to obtain by The response message header of the resource identified by Request-URI
PUT Requests the server to store a resource and uses Request-URI as its identifier
DELETE Requests the server to delete the resource identified by Request-URI
TRACE Requests the server to send back a receipt The requested request information is mainly used for testing or diagnosis
CONNECT is reserved for future use
OPTIONS requests to query the performance of the server, or query options and requirements related to resources

For us, commonly used That is GET, and POST. Let me reiterate, there is no need to submit a form, and there is no security issue with get compared to post.

HTTP status code:

1XX Prompt message - Indicates that the request has been successfully received and continues to be processed.

2XX Success - Indicates that the request has been successfully received, understood, and accepted

3XX Redirect - Further processing must be performed to complete the request

4XX Client Error - Request There is a syntax error or the request cannot be implemented

5XX Server-side error - The server cannot implement a legal request

There are many status codes, you can understand them by yourself, I think there are a few that you must know.

HTTP communication process: query DNS according to URL, find server, establish TCP connection, send request, and server response.

For HTTP, I think the basics are to know that HTTP is stateless, HTTP message structure, basic request method, and basic status code.

There is still a lot to learn about the HTTP protocol, this is just the basic need to know.

Welcome to follow Coding’s personal notes public account

##What front-end engineers deal with most is the browser, no matter what they do Inseparable from the browser, the HTTP protocol is often ignored by us, but in fact, resource caching, CDN loading, page performance optimization, etc. are all inseparable from the understanding of the HTTP protocol.

HTTP is also called Hypertext Transfer Protocol, full name: Hyper Transfer Protocol. Initially HTTP could only transmit HTML files, but now it can transmit text, images, videos and various streaming files.

HTTP is stateless: the same client initiates multiple requests in succession. To the HTTP server, they are all new requests. HTTP has no way of knowing that it comes from a client.

HTTP message structure: To see the specific message structure, you need to use a packet capture tool, so here is only a brief introduction without specific examples. The message structures of request and response are basically the same.

Header: divided into request/response line and request/response header.

request/response line: includes the request method (GET/POST), the path to resource and the version number of the http protocol.

request/response header: Here are the various request headers.

Body: Response body, usually an HTML file. If it is a get request, there is no response body.

HTTP request method:

GET Request to obtain the resource identified by Request-URI
POST Append new data after the resource identified by Request-URI
HEAD Request to obtain the response message header of the resource identified by Request-URI
PUT Requests the server to store a resource and uses Request-URI as its identifier
DELETE Requests the server to delete the resource identified by Request-URI
TRACE Requests the server to send back the received request information, mainly used for testing or diagnosis
CONNECT is reserved for future use of
OPTIONS requests to query the server's performance, or to query resource-related options and requirements

For us, the commonly used ones are GET, and POST. Let me reiterate, there is no need to submit a form, and there is no security issue with get compared to post.

HTTP status code:

1XX Prompt message - Indicates that the request has been successfully received and continues to be processed.

2XX Success - Indicates that the request has been successfully received, understood, and accepted

3XX Redirect - Further processing must be performed to complete the request

4XX Client Error - Request There is a syntax error or the request cannot be implemented

5XX Server-side error - The server cannot implement a legal request

There are many status codes, you can understand them by yourself, I think there are a few that you must know.

HTTP communication process: query DNS according to URL, find server, establish TCP connection, send request, and server response.

For HTTP, I think the basics are to know that HTTP is stateless, HTTP message structure, basic request method, and basic status code.

There is still a lot to learn about the HTTP protocol, this is just the basic need to know.

[Recommended course: HTTP video course]

The above is the detailed content of HTTP protocol knowledge closely related to front-end development. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP and Vue: a perfect pairing of front-end development tools PHP and Vue: a perfect pairing of front-end development tools Mar 16, 2024 pm 12:09 PM

PHP and Vue: a perfect pairing of front-end development tools. In today's era of rapid development of the Internet, front-end development has become increasingly important. As users have higher and higher requirements for the experience of websites and applications, front-end developers need to use more efficient and flexible tools to create responsive and interactive interfaces. As two important technologies in the field of front-end development, PHP and Vue.js can be regarded as perfect tools when paired together. This article will explore the combination of PHP and Vue, as well as detailed code examples to help readers better understand and apply these two

Understand common application scenarios of web page redirection and understand the HTTP 301 status code Understand common application scenarios of web page redirection and understand the HTTP 301 status code Feb 18, 2024 pm 08:41 PM

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

Questions frequently asked by front-end interviewers Questions frequently asked by front-end interviewers Mar 19, 2024 pm 02:24 PM

In front-end development interviews, common questions cover a wide range of topics, including HTML/CSS basics, JavaScript basics, frameworks and libraries, project experience, algorithms and data structures, performance optimization, cross-domain requests, front-end engineering, design patterns, and new technologies and trends. . Interviewer questions are designed to assess the candidate's technical skills, project experience, and understanding of industry trends. Therefore, candidates should be fully prepared in these areas to demonstrate their abilities and expertise.

HTTP 200 OK: Understand the meaning and purpose of a successful response HTTP 200 OK: Understand the meaning and purpose of a successful response Dec 26, 2023 am 10:25 AM

HTTP Status Code 200: Explore the Meaning and Purpose of Successful Responses HTTP status codes are numeric codes used to indicate the status of a server's response. Among them, status code 200 indicates that the request has been successfully processed by the server. This article will explore the specific meaning and use of HTTP status code 200. First, let us understand the classification of HTTP status codes. Status codes are divided into five categories, namely 1xx, 2xx, 3xx, 4xx and 5xx. Among them, 2xx indicates a successful response. And 200 is the most common status code in 2xx

Is Django front-end or back-end? check it out! Is Django front-end or back-end? check it out! Jan 19, 2024 am 08:37 AM

Django is a web application framework written in Python that emphasizes rapid development and clean methods. Although Django is a web framework, to answer the question whether Django is a front-end or a back-end, you need to have a deep understanding of the concepts of front-end and back-end. The front end refers to the interface that users directly interact with, and the back end refers to server-side programs. They interact with data through the HTTP protocol. When the front-end and back-end are separated, the front-end and back-end programs can be developed independently to implement business logic and interactive effects respectively, and data exchange.

Exploring Go language front-end technology: a new vision for front-end development Exploring Go language front-end technology: a new vision for front-end development Mar 28, 2024 pm 01:06 PM

As a fast and efficient programming language, Go language is widely popular in the field of back-end development. However, few people associate Go language with front-end development. In fact, using Go language for front-end development can not only improve efficiency, but also bring new horizons to developers. This article will explore the possibility of using the Go language for front-end development and provide specific code examples to help readers better understand this area. In traditional front-end development, JavaScript, HTML, and CSS are often used to build user interfaces

What status code is returned for an HTTP request timeout? What status code is returned for an HTTP request timeout? Feb 18, 2024 pm 01:58 PM

The HTTP request times out, and the server often returns the 504GatewayTimeout status code. This status code indicates that when the server executes a request, it still fails to obtain the resources required for the request or complete the processing of the request after a period of time. It is a status code of the 5xx series, which indicates that the server has encountered a temporary problem or overload, resulting in the inability to correctly handle the client's request. In the HTTP protocol, various status codes have specific meanings and uses, and the 504 status code is used to indicate request timeout issues. in customer

How to implement HTTP streaming using C++? How to implement HTTP streaming using C++? May 31, 2024 am 11:06 AM

How to implement HTTP streaming in C++? Create an SSL stream socket using Boost.Asio and the asiohttps client library. Connect to the server and send an HTTP request. Receive HTTP response headers and print them. Receives the HTTP response body and prints it.

See all articles