fiddler-Working principle

Source: Internet
Author: User

The browser communicates with the server by establishing a TCP connection with the HTTP protocol, and the browser is sent to the server by default via the system HTTP proxy. While Fiddler is the HTTP proxy server for C # development (Microsoft produced, the main author Eric Lawrence), fiddler works on the application layer in layer seven to capture the HTTP (s) request through. Fiddler acts as a proxy server role between the client's browser and the server. It will establish a proxy service locally, with a default port of 8888, and access to http://127.0.0.1:8888 will display the Fiddler page.

Fiddler as a system agent, when the Fiddler is enabled, the proxy setting of IE will become 127.0.0.1:8888, so if your browser does not set the appropriate proxy after the Fiddler is turned on, then Fiddler cannot capture the HTTP request. The following is the proxy settings for Internet Explorer after starting fiddler:

The working principle is as follows:

On a system with fiddler installed, the 8888 port is monitored after booting fiddler (default 8888, can be modified).

We can see through the port of the monitoring system:

1. Status of Port 8888 before starting fiddler

Command: NETSTAT-ANO|FINDSTR "8888"

Indicates that no occupancy status is found

2. After starting fiddler:

After starting FIDDELR, you can find that port 8888 is being monitored by 5256 threads, LISTENING indicates that this thread is listening

You can view the 5256 thread for the Fiddler program:

Command: tasklist |findstr "5256"

3. Then launch the Chrome browser and browse the Web to discover:

The 5658 process establishes a TCP connection with fiddler (established indicates the connection of this thread ), the sending side is 5658 processes occupy 3258 ports, and the receiving end is 8888 ports occupied by fiddler (5256)

Command: NETSTAT-ANO|FINDSTR "8888"

View the 5568 process for chrome programs

Command: tasklist |findstr "5568"

Similarly, open the Firefox browser, browse the Web page is also the same:

The 7836 process establishes a TCP connection with the Fiddler, 7836 processes occupy 3294 ports on the sending side, and 8888 ports are occupied by the receiving end of fiddler (5256)

Command: NETSTAT-ANO|FINDSTR "8888"

View the 7836 process for the Firefox program:

Command: tasklist |findstr "7836"

PS: to note that Firefox needs to manually set the agent to fiddler:127.0.0.1:8888, because Firefox is not using the system default WinINET

Therefore, fiddler as a proxy server, after establishing a connection with the browser, the browser like the target server sends the request will go through the fiddler proxy,

So fiddler can capture HTTP (s) requests, which can be interpreted, parsed, or even rewritten to emit HTTP (s) requests.

Simply put:

Browser <-> Fiddler <-> Server

In normal debugging, Fiddler is often used to:

1. parse the request : such as: Parsing HTTP request status, request header, request body, return header, return body, etc.

2. Modify the request , such as: Set a breakpoint, you can modify the sent request data, or modify the data returned by the request

3. REDIRECT the request , such as: Replace the remote file, you can debug the JS/CSS code on the line

4. construct a request , such as: Construct a request to send data, such as a test site security that can be used

There is time to tidy up the usage of fiddler later.

Transferred from: http://lin.xiaogang.me/?p=134

fiddler-Working principle

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.