Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Case Analysis of HTTP Protocol

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains the "HTTP protocol case analysis", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "HTTP protocol case analysis"!

In the era of web2.0, the Internet has changed from the traditional Cplink S architecture to the BCMUP S architecture. As long as we have a browser, we can surf the Internet. When the client interacts with the web server, there are web requests, which are based on the unified application layer protocol (HTTP) to exchange data.

HTTP:HyperText Transfer Protocol Hypertext transfer Protocol. Is a rule that details communication between browsers and the World wide Web, allowing HTML (Hypertext markup language) documents to be transferred from web servers to web browsers.

1. Initiate a HTTP request

Enter a URL (hyperlink, uniform resource locator) in the address bar and press enter to initiate a request, and you will soon see the result returned by the request. For example:

The browser initiates:

Format URL = Protocol://IP [: port] / filepath/?keyword

Equivalent to https://www.baidu.com:80/ = https://www.baidu.com/ = www.baidu.com (the browser automatically recognizes the adding protocol and port, the default port is HTTP80,HTTPS443, and other ports need to be added manually; the protocol browser automatically selects; IP automatically looks up according to the domain name DNS)

Tool launch:

In windows, you can also use the curl.exe tool to initiate a request

Detailed curl usage can be found on its own, windows comes with curl tools, or curl-h can view its own help group documentation, which is more detailed.

Detailed explanation of 2.HTTP protocol

The latest version of HTTP is 1.1, which is a stateless protocol. Stateless: means that there is no need to establish a persistent connection between the browser and the server; this means that when a client initiates a request to the server and the web server returns a response (response), the link is closed and the server does not retain any information about the connection. In other words, HTTP requests can only be initiated by the client, and the server will not actively send data.

① HTTP request:

HTTP request consists of three parts: request line (request method), request header (message header), and request body.

POST / userinfo.php HTTP/1.1 / / request line = request type + path + protocol version

Host: testphp.vulnweb.com / / request header ↓ = host address + browser tag + accept document type +. Explain in detail later.

User-Agent: Mozilla/5.0 (X11; Linux x8634; rv:68.0) Gecko/20100101 Firefox/68.0

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: en-US,en;q=0.5

Accept-Encoding: gzip, deflate

Referer: http://testphp.vulnweb.com/login.php

Content-Type: application/x-www-form-urlencoded

Content-Length: 20

Connection: close

Upgrade-Insecure-Requests: 1

/ / blank line, indicating the end of the request

Uname=test&pass=test / / request body

② HTTP response:

HTTP/1.1 200OK / / response line

Server: nginx/1.4.1 / / response header ↓

Date: Fri, 27 Mar 1970 09:27:12 GMT

Content-Type: text/html

Connection: close

X-Powered-By: PHP/5.3.10-1~lucid+2uwsgi2

Set-Cookie: login=test%2Ftest

Content-Length: 5935

/ / Blank line, which represents the end of the response header. The following is the response body or message subject HTML document

Thank you for your reading. The above is the content of "HTTP Protocol instance Analysis". After the study of this article, I believe you have a deeper understanding of the problem of HTTP protocol example analysis, and the specific use situation still needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report