Article directory
Preface
Earlier we briefly learned about the application layer - custom protocols, but these are just custom protocols. In real life, custom protocols are still used in a minority. The more commonly used protocol in the application layer is the HTTP protocol. , before learning these two protocols, we need to use a tool - Fiddler to implement HTTP packet capture to view their request and response messages.
What is Fiddler
Fiddler is an HTTP protocol debugging proxy tool. It can record and inspect all HTTP communications between computers and the Internet, set breakpoints, and view all data "in and out" of Fiddler (referring to cookies, html, js, css and other files).
If it is just communication between the client and the server, it is actually difficult for us to see the client's request data packet and the server's response data packet. What our client gets is only the request data packet and the response data packet after processing. Since To learn the HTTP protocol, we must first learn its message format. To learn its message format, we need to get its message format. To obtain the HTTP request and response messages, we need to use packet capture tools. Capture HTTP packets.
Fiddler is specifically responsible for capturing HTTP packets. Although other tools can also capture HTTP packets, because Fiddler is specifically designed to capture HTTP packets, compared with other software, we still use it to capture HTTP packets. Fiddler.
Download Fiddler
1. Download Fiddler Classic from the official website
Enter Fiddler official websitehttps://www.telerik.com/fiddler
Although Fillder Everywhere has more functions, it requires paying a certain fee, so we choose the free version of Fiddler Classic. Find Fiddler Classic below and click Try For Free
Simply fill in the information and download
2. Install Fiddler Classic
After downloading the installation package of Fiddler Classic, you can install it. The installation process is very simple.
3. Open Fiddler Classic
After opening Fiddler, a prompt like this may appear. Just click NO.
After opening, this interface appears:
However, the packet capture data you appear may not be that much and all captured are HTTP packets, but not HTTPS packets. If you want to capture HTTPS packets, you need to make relevant configurations. Click Tools, Options
Select HTTPS and check all options that appear.
A prompt may pop up during the checking process. What pops up here is the security certificate. We choose YES. Remember, you must choose YES here, otherwise you need to Uninstalled and reinstalled.
Shown on the left are the HTTP packets and HTTPS packets captured by our Fiddler
When we visit www.baidu.com
, a lot of data packets will be captured on the left. We don’t need to worry about so many, we just need to look at this blue one.
After double-clicking the captured HTTP packet, the request packet and response packet of the HTTP packet will be displayed on the right.
It can be opened in Notepad by clicking on the Row of the request packet and View In Notepad.
Looking at the response part below, we can find that the response packet contains garbled characters, so why do garbled characters appear here? Because when the server returns a response, it will compress the data to save network bandwidth. If each response packet is not compressed, it will cause a waste of network bandwidth, so we need to compress the compressed data packet. unzip.
After decompressing, click Row to view the detailed data format.
Click on the left part and use CTRL + a and delete to delete the captured data packets.