Fiddler is one of the most powerful Web debugging tools that can record HTTP and HTTPS requests from all clients and servers, allowing you to monitor, set breakpoints, and even modify input and output data. The use of Fiddler is a great help both for development and for testing.
Basic introduction of Fiddler
Fiddler's official Website: www.fiddler2.com
Fiddler official website provides a lot of help documentation and video tutorials, which is the best information for learning fiddler.
Fiddler is one of the most powerful Web debugging tools, it can record all the client and server HTTP and HTTPS requests, allowing you to monitor, set breakpoints, and even modify the input and output data, Fiddler contains a powerful event-based scripting subsystem, And can be extended using the. NET language
The more you know about the HTTP protocol, the more you can master the way fiddler is used. The more you use Fiddler, the more you can help you understand the HTTP protocol.
Fiddler is a very useful tool for developers and testers fiddler how they work
Fiddler is working as a proxy Web server, which uses proxy addresses: 127.0.0.1, Port: 8888. When Fiddler exits, it automatically logs off, so it doesn't affect other programs. However, if Fiddler exits abnormally, this is because Fiddler does not log off automatically, which can cause the webpage to be inaccessible. The workaround is to restart the next fiddler.
other tools of the same kind
Similar tools are: HttpWatch, Firebug, Wireshark
Fiddler How to capture a Firefox session
can support HTTP proxy of any program's packets can be fiddler sniff, fiddler operation Mechanism is actually on this machine listening to 8888 port HTTP proxy. Fiddler2 start when the default IE proxy is set to 127.0.0.1:8888, and other browsers need to be set manually, so the Firefox agent to 127.0.0.1:8888 can listen to the data.
Set up the agent on Firefox with the following steps
Click: Tools, Options, click Advanced tab-> Network tab-Setting on the Options dialog box.
fiddler How to capture an HTTPS session
By default, Fiddler does not capture HTTPS sessions and requires you to set the Fiddler tool->fiddler Options->https tab to open
Select the checkbox and the following dialog box appears, click "YES"
After clicking "Yes", the basic interface of Fiddler is set up.
Look at the basic interface of Fiddler.
There are a lot of messages to see request or response under Inspectors tab. Where raw tab can view the complete message, Headers tab only looks at the header in the message. Figure below
HTTP Statistics view for fiddler
By displaying all of the HTTP traffic, fiddler can easily show you which files generate the page you are currently requesting. With the Statistics tab, the user can select multiple sessions to get the total information statistics for these sessions, such as multiple requests and bytes transferred.
Select the first request and the last request to get the overall time consumed by the entire page load. You can also separate which requests take the most time from the bar chart to optimize access to the page
quickexec use of the command line
The lower left corner of Fiddler has a command-line tool called Quickexec, which allows you to enter commands directly.
Common commands are
Help opens the Official usage page and all the commands are listed
CLS Clear Screen (Ctrl+x can also clear the screen)
Select a command for a session
?. PNG to select a PNG suffix picture
BPU Intercept Request
setting breakpoints in fiddler modify request
Fiddler the most powerful function is to set breakpoints, after setting breakpoints, you can modify HttpRequest any information including host, cookie or the data in the form. There are two ways to set breakpoints
The first type: Open fiddler click Rules-> Automatic Breakpoint->before requests (this method interrupts all sessions)
How to eliminate the command. Click rules-> Automatic Breakpoint->disabled
The second type: Enter the command at the command line: Bpu www.baidu.com (This method only interrupts www.baidu.com)
How to eliminate the command. Enter a command on the command line BPU
See an example, simulation Blog Park login, in IE open the Blog Park login page, enter the wrong user name and password, with fiddler interrupt session, modify the correct username password. This will enable you to log in successfully
1. Open the login interface of the blog park with IE http://passport.cnblogs.com/login.aspx
2. Open fiddler and enter BPU on the command line http://passport.cnblogs.com/login.aspx
3. Enter the wrong username and password Click Login
4. Fiddler can interrupt this session, select the interrupted session, click the WebForms tab under Inspectors tab to modify the username password, and then click Run to completion as shown in the following figure.
5. The result is a proper login to the blog park
Fiddler Setting Breakpoint Modification Response
Of course fiddler can also modify the response
The first type: Open fiddler click rules-> Automatic Breakpoint->after Response (this method interrupts all sessions)
How to eliminate the command. Click rules-> Automatic Breakpoint->disabled
The second type: Enter the command at the command line: Bpuafter www.baidu.com (This method only interrupts www.baidu.com)
How to eliminate the command. Enter command bpuafter on the command line,
The exact usage is similar to that in the previous section, not much. creating Autoresponder rules in Fiddler
Fiddler's Autoresponder tab allows you to return files locally without sending an HTTP request to the server.
See an example. 1. Open the Blog home page, the blog Park logo image to local, and make some changes to the picture.
2. Open the Fiddler to find the logo image of the session, Http://static.cnblogs.com/images/logo_2012_lantern_festival.gif, drag the session to Autoresponer tab
3. Select Enable automatic reaponses and unmatched requests passthrough
4. Select the Find a file below the rule Editor ... Select a locally saved picture. Finally click Save.
5. Re-use IE Blog home page, you will see the homepage of the picture with the local.
How to filter sessions in Fiddler
Each time using fiddler, open a website, can see in the Fiddler dozens of sessions, see dazzling. The best way to do this is to filter out some conversations, such as a session that filters out images. Fiddler in the filter function, in the Right Filters tab, there are many options, a little research, you know how to use.
session compare function in Fiddler
Select 2 sessions, right click Compare, you can use WinDiff to compare two sessions (of course you need to install WinDiff)
the encoding gadget provided in Fiddler
Click Textwizard on the Fiddler toolbar, this tool can encode and decode string.
query session in Fiddler
Use the shortcut key ctrl+f to open the Find Sessions dialog box and enter the keyword to query the session you want. The query to the session is displayed in yellow
save session in Fiddler
Sometimes we need to save the conversation so that we can send it to someone or analyze it later. The steps to save the session are as follows:
Select the session you want to save, then click File->save->selected Sessions Fiddler's script system
The most complicated thing about Fiddler is the script system. Official Help Document: Http://www.fiddler2.com/Fiddler/dev/ScriptSamples.asp
First install the Syntaxview plug-in, inspectors tab->get Syntaxview tab->download and install Syntaxview now ... Figure below
After the installation is successful, Fiddler will have one more Fiddler Script tab, as shown below
In it we can write a script, and see an example to make all cnblogs sessions appear red.
Place the script under the Onbeforerequest (osession:session) method and click Save Script
if (Osession.hostnameis ("www.cnblogs.com")) {
osession["ui-color"] = "red";
}
Copy Code
So all the Cnblogs sessions will show red.
How to use fiddler when you debug a Web site vs.
We also need to use Fiddler to analyze HTTP when we are developing an ASP with visual Stuido, and by default fiddler is not able to sniff localhost's web site. But if you add a dot behind localhost, fiddler can sniff.
For example: the original ASP. NET address is http://localhost:2391/Default.aspx, add a dot number, become http://localhost.:2391/Default.aspx can
A second option is to add 127.0.0.1 Localsite to the Hosts file.
How do you access the Http://localsite: port number. So the fiddler can be intercepted.
Response is garbled.
Sometimes we see that the HTML in response is garbled, because HTML is compressed, and we can decompress it in two ways.
1. Click on the "Response is encoded" Response raw above "any could need to be decoded before inspection." Click here to transform "
2. Select "Decode" in the toolbar. This will automatically decompress.
Original address: http://www.cnblogs.com/TankXiao/archive/2012/02/06/2337728.html