Python Advanced (35)-fiddler command line and HTTP breakpoint debugging

Source: Internet
Author: User

Python Advanced (35)-fiddler command line and HTTP breakpoint debugging one. Fiddler built-in commands

?? In the previous section (using Fiddler for packet Capture analysis), the Web session (which is not the same concept as what we normally call a session) is described here, and each HTTP request is called a session. The interface is able to see all the HTTP requests that Fiddler crawls. In order to manage all sessions more conveniently, Fiddler provides a series of built-in functions for filtering and manipulating these sessions ( Custom command line operation the children's shoes of Linux should be able to feel how convenient this will be. Enter the location of the command below the Web Session Admin panel (via the shortcut key Alt+q can focus to the command line).
?? Fiddler built-in commands have such as the following:

1. Select command

?? Select all corresponding types (referred to as Content-type) for HTTP requests of the specified type, such as selecting Pictures. Use the command select image and select CSS to choose all the corresponding types of CSS requests. Select HTML selects all requests that respond to HTML (what about a very similar SQL statement?). )。

Is the result of running Select Image:

2. Allbut command

?? The Allbut command is used to select all response types that are not HTTP requests of a given type. such as Allbut image is used to select all the corresponding type is not a picture of the session (HTTP request), the command of another alias Keeponly. Note that. The keeponly and Allbut commands are to delete a session that is not of that type. All that is left is the type of response. Therefore, if you run Allbut xxxx (a nonexistent type), it is actually similar to running the CLS command (deleting all the sessions, ctrl+x shortcut keys are also this function).

3.?

Text command

?? Select all the sessions for all URLs that match the character after the question mark.

4. >size and 5. =status command

?? Select all HTTP requests that have a response status equal to the given state.
?? For example, select HTTP request with all status 200: =200

6. @host command

?? Select all HTTP requests that include the specified HOST.
?? For example: @csdn. NET Select all host including Csdn.net requests

7. Bpafter. Bps, BPV, BPM, BPU

?? These commands are primarily used to set breakpoints in batches

    • Bpafter XXX: Interrupt URL includes all session responses for specified characters
    • Bps XXX: Interrupts the HTTP response status for all session responses of the specified character.

    • BPV XXX: All session responses that interrupt the specified request mode
    • BPM XXX: Interrupts all session responses for the specified request mode. Equivalent to BPV XXX
    • Bpu XXX: Similar to bpafter.

?? When these commands do not have an add-on, all HTTP requests that set breakpoints are emptied.
?? Many other commands are available for reference in the Fiddler website Manual.

Two Using Fiddler for HTTP Breakpoint debugging

?? This is one of Fiddler's powerful and useful tools. By setting breakpoints, Fiddler can:

    • Change the HTTP request header information.

      For example, change the request header UA, cookies, Referer information, through the "forgery" corresponding information to achieve the corresponding purpose (debugging, simulation of user real request, etc.).

    • Constructs the request data, breaks through the form the limit, submits the data arbitrarily.

      Avoid page JS and form restrictions affecting debugging.

    • Intercept response data and alter the response entity.


      ?? Why is the above method important? If the JS front-end Program ape and the server program Ape is a division of labor. JS program apes want to debug the functionality of the AJAX request, so that it does not have to wait for the server-side program ape developed all the interface and then start to develop the JS end of the AJAX request function, because by "simulating" the real server side of the response, can guarantee the correctness of the function, and the server-side development Program Ape , only to ensure that the response is in line with the rules.

      This greatly simplifies the efficiency of program development and, of course, reduces the difficulty of different line-of-business program ape-linking.
      ?? There are two ways of setting breakpoints:

    • 1.fiddler menu Bar->rules->automatic breakpoints-> Select the breakpoint mode in such a way that the breakpoint set will be valid for all subsequent HTTP requests. There are two breakpoint locations:

    • A. Before response. That is, after the request is sent, but before the Fiddler agent Relays, the requested data can be changed.

    • B.after Response. That is, after the server response, but before fiddler the response to the client. The result of the response can be changed.

    • 2. Enter the command line. Bpafter xxx or BPV,BPU,BPM, etc. set breakpoints.

      Such breakpoints are only for specific types of requests.

?? As an example of a local Web project, we demonstrate how to set HTTP breakpoints simply:
?? 1. First set up the Firefox agent, so that it can crawl all HTTP requests (localhost request, also can be set in the filter only crawl intranet request), set for example to see:

-then open the local project with the Web.

The content of the page is:

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvc3vuahvhcwlhbmcx/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast "alt=" here to write a picture descriptive narrative "title=" ">
-Set the post-response breakpoint (after response breakpoint), which can be set via the command line: Bpafter localhost. Type Enter after carriage. Web revisit file. Can be seen through the Fiddler Web session interface. The request has been hung up, and the Web browser has been in a loaded state. Looking at the right side of the Inspector panel, there is something new:

?? Then we can change the response information.

The change process is:
?? Switch to the TextView sub-panel and select the part that needs to be changed. Then click "Run to complete" and you can echo the changed response. If we change the content such as the following:

?? Click Run After. Open the Web interface just now.

Can see the changes of the page.

?? Visible. The response of the page has been changed correspondingly. This is the post-response breakpoint.

Of course in practical applications. Breakpoints are more complex to set up and respond to than this, and here are just a few of the main demo examples.
?? The ways to terminate breakpoints are:

    • Clicking "Run Complete" on the Inspector interface terminates the breakpoint on this HTTP request.
    • Enter the GO command. It also causes the current request to skip the breakpoint.
    • You can disabled breakpoints in Rules->auto breakpoint.
      Anyway. Fiddler's breakpoint function is very powerful, about its further study and application, need a continuous accumulation and groping process.


Python Advanced (35)-fiddler command line and HTTP breakpoint debugging

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.