CN105700894A - Method and device for modifying HTTP response data - Google Patents

Method and device for modifying HTTP response data Download PDF

Info

Publication number
CN105700894A
CN105700894A CN201610103734.1A CN201610103734A CN105700894A CN 105700894 A CN105700894 A CN 105700894A CN 201610103734 A CN201610103734 A CN 201610103734A CN 105700894 A CN105700894 A CN 105700894A
Authority
CN
China
Prior art keywords
response
http request
rule
http
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201610103734.1A
Other languages
Chinese (zh)
Inventor
刘福密
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Qianhai Juzi Information Technology Co Ltd
Shenzhen Fenqile Network Technology Co Ltd
Original Assignee
Shenzhen Qianhai Juzi Information Technology Co Ltd
Shenzhen Fenqile Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Qianhai Juzi Information Technology Co Ltd, Shenzhen Fenqile Network Technology Co Ltd filed Critical Shenzhen Qianhai Juzi Information Technology Co Ltd
Priority to CN201610103734.1A priority Critical patent/CN105700894A/en
Publication of CN105700894A publication Critical patent/CN105700894A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3438Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment monitoring of user actions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the invention discloses a method and device for modifying HTTP response data. The method comprises the steps that when it is monitored that an HTTP request in a conversation list is dragged, conversation data of the HTTP request is acquired, and a response rule corresponding to the HTTP request is set based on the conversion data, wherein the HTTP request in the conversion list is sent by a browser side; when it is monitored that that browser side sends the HTTP request again, the response rule is matched, and the HTTP response data corresponding to the HTTP request is modified based on the response rule. According to the technical scheme adopted in the embodiment, operation for modifying the HTTP response data in an HTTP protocol agent debugging tool is simplified.

Description

A kind of method revising http response data and device
Technical field
The present embodiments relate to Computer Applied Technology, particularly relate to a kind of method revising http response data and device。
Background technology
HTML (Hypertext Markup Language) (HyperTextTransferProtocol, HTTP), be most widely used a kind of procotol on the Internet, it is stipulated that the rule of intercommunication between browser and Web server。For common Internet user, it is only necessary to input chained address clickthrough in the browser of client, so that it may obtain the webpage data information of Web server end response。
But for webpage front-end research staff, they pay close attention to the data being more how to realize that the procotol in network service is comprised and are analyzed and revise, and how to realize the debugging to web application, thus occur in that procotol acts on behalf of debugging acid, particularly http protocol acts on behalf of debugging acid, is widely applied in the front end research staff exploitation to webpage and debugging。In webpage development, the http response data that front end research staff it is frequently necessary to Web server is returned are modified。When modifying http response data, front end research staff can act on behalf of existing corresponding function plug-in unit in debugging acid by http protocol and carry out。
But, based on http protocol act on behalf of the plug-in unit of existing amendment http response in debugging acid modify operation time, after the selected HTTP request sent first by browser end, if wanting to revise the http response data that this HTTP request is corresponding, first have to the related data in this HTTP request carries out local preservation, also to find the data file of the local above-mentioned HTTP request preserved afterwards, again the response data content in the data file of this HTTP request is modified, thus just complete the setting of rule of response;Then, when browser end sends this HTTP request again, only by the coupling of URL (UniformResourceLocator, URL) is searched the rule of response preserved;Finally it is collected in the response data revised in rule of response and completes the amendment to http response data。It can be seen that its complex operation when http response data being modified based on above-mentioned plug-in unit, and then have impact on the progress of work that web application is researched and developed by research staff, thus reduce research staff and http protocol is acted on behalf of the Consumer's Experience that debugging acid uses。
Summary of the invention
The present invention provides a kind of method revising http response data and device, the operation revising http response data in debugging acid to simplify http protocol to act on behalf of。
On the one hand, embodiments providing a kind of method revising http response data, the method includes:
After listening to the HTTP request in session list carried out drag operation, obtain the session data of described HTTP request, and the rule of response that described HTTP request is corresponding is set based on described session data, wherein, the HTTP request in described session list is the HTTP request that browser end sends;
Monitoring after browser end sends described HTTP request again, mate described rule of response, and revise, based on described rule of response, the http response data that described HTTP request is corresponding。
On the other hand, embodiments providing a kind of device revising http response data, be integrated in http protocol and act on behalf of in debugging acid, this device includes:
Rule of response arranges module, for after listening to the HTTP request in session list carried out drag operation, obtain the session data of described HTTP request, and the rule of response that described HTTP request is corresponding is set based on described session data, wherein, the HTTP request in described session list is the HTTP request that browser end sends;
Response data modified module, for monitoring after browser end sends described HTTP request again, mating described rule of response, and revise, based on described rule of response, the http response data that described HTTP request is corresponding。
The method of the amendment http response data that the embodiment of the present invention provides and device, after listening to the HTTP request in session list carried out drag operation, can directly obtain the session data of this HTTP request, and the setting of HTTP request rule of response is can be achieved with based on above-mentioned session data, wherein the HTTP request in session list is the HTTP request that browser end sends first;When monitoring browser end and again sending above-mentioned HTTP request, it is possible to the current http response data of HTTP request are modified by the rule of response based on above-mentioned setting。Utilize the method, without carrying out the local lookup preserved and this locality is preserved data file of session data corresponding to HTTP request, respond rule settings afterwards again, the present invention can directly obtain session data and carry out rule of response setting, largely simplify and act on behalf of debugging acid based on http protocol and http response data are modified operating process, thus saving the research and development time of research staff, improving http protocol and acting on behalf of the Consumer's Experience of debugging acid。
Accompanying drawing explanation
The schematic flow sheet of a kind of method revising http response data that Fig. 1 provides for the embodiment of the present invention one;
The schematic flow sheet of a kind of method revising http response data that Fig. 2 provides for the embodiment of the present invention two;
The schematic flow sheet of a kind of method revising http response data that Fig. 3 provides for the embodiment of the present invention three;
The schematic flow sheet of a kind of method revising http response data that Fig. 4 provides for the embodiment of the present invention four;
The structured flowchart of a kind of device revising http response data that Fig. 5 provides for the embodiment of the present invention five。
Detailed description of the invention
Below in conjunction with drawings and Examples, the present invention is described in further detail。It is understood that specific embodiment described herein is used only for explaining the present invention, but not limitation of the invention。It also should be noted that, for the ease of describing, accompanying drawing illustrate only part related to the present invention but not entire infrastructure。
Embodiment one
The schematic flow sheet of a kind of method revising http response data that Fig. 1 provides for the embodiment of the present invention one。The method can be performed by the device of amendment http response data, and wherein this device can be realized by software and/or hardware, acts on behalf of the part of debugging acid as http protocol and is integrated in http protocol and acts on behalf of in debugging acid。
Usually, common http protocol acts on behalf of debugging acid Fiddler, HttpWatch, WireShark and Firebug etc., these instruments can as procotol (the comprising http protocol) agency between online client and Web server, can record and check all http protocol communications between arbitrary online client and Web server, especially Fiddler, debugging acid is acted on behalf of as a kind of http protocol, compared to Firebug and HttpWatch, the browser being suitable for is wider, can support all can arrange the browser and application program that HTTP Proxy is 127.0.0.1:8888;Simultaneously, compared to WireShark, arbitrary network communication protocol all can be caught the function of analysis, Fiddler has then embodied the specificity to http protocol, the amendment etc. of the analysis of HTTP request, the setting of breakpoint, the debugging of web application and HTTP request data for specific HTTP request, can be carried out;Even the http response data that server returns can also be modified, the power that Fiddler has, making it be widely applied in the front end research staff exploitation to webpage and debugging, thus Fiddler becomes http protocol and acts on behalf of the representative of debugging acid。
The method of the amendment http response data that the embodiment of the present invention one provides, as it is shown in figure 1, specifically include following operation:
Step S101, after listening to the HTTP request in session list carried out drag operation, obtain the session data of described HTTP request, and the rule of response that described HTTP request is corresponding is set based on described session data, wherein, the HTTP request in described session list is the HTTP request that browser end sends。
In the present embodiment, described session list specifically can refer to act on behalf of, based on http protocol, the list that the HTTP request sent by browser end that debugging acid catches is formed。Wherein, the HTTP request caught is equivalent to a http session in session list。Accordingly, described http protocol is acted on behalf of debugging acid and is existed multiple, and such as Fiddler, HttpWatch, WireShark and Firebug etc., in the present embodiment, described http protocol is acted on behalf of debugging acid and is preferably Fiddler。
In the present embodiment, the session data of described HTTP request specifically can be regarded as: the http response data message that the requesting data information comprised in the HTTP request that browser end sends and server end return after above-mentioned HTTP request is responded。Wherein, described requesting data information generally can include the URL for obtaining server resource position and access method, and HTTP request method parameter (common requesting method parameter such as GET (acquisition) parameter or POST (amendment) parameter, for the implication of different requesting method parameters, no longer describe in detail here) etc. data message;Described http response data message may generally refer to server end and is sent to browser end and makes browser end make the data message of corresponding display。
In the present embodiment, after listening to user and the HTTP request in session list is carried out drag operation, just can obtain, according to this HTTP request, the session data that this HTTP request is corresponding。Wherein, the drawing direction of the drag operation of described HTTP request being not particularly limited, as long as meeting, HTTP request being dragged to session list;Additionally, the dragging number for HTTP request is generally preferred to once drag one;When listen to multiple HTTP request are carried out drag operation time, will select one of them HTTP request carry out http response data amendment operation。
In the present embodiment, after the session data obtaining described HTTP request, based on described session data, this HTTP request will be responded the setting of rule。Accordingly, its setting up procedure can be briefly described into: obtain described HTTP request session data after, that ejects rule of response arranges list, and the data message correspondence comprised in described session data is filled to the editable text frame arranging list, receive user the content in editable text frame is modified editor and confirm after, this can be arranged list acquiescence and save as native XML file, thus achieve the setting of rule of response。It should be noted that the HTTP request that the HTTP request performing step S101 operation can preferably send through browser end first, but do not limit this HTTP request and be necessary for the request that browser end sends first。Described HTTP request did not carry out http response data modification before can also being, repeat the HTTP request sent through browser;Or carried out http response data modification but through browser transmission the secondary request responding rule setting again。Therefore the HTTP request responding rule setting described in also is understood as: that sent by browser end and acted on behalf of, by http protocol, the HTTP request that debugging acid is caught。Moreover, it is to be understood that acquiescence is saved in rule of response list through the step S101 rule of response arranged。
Step S102, monitoring after browser end sends described HTTP request again, mate described rule of response, and revise, based on described rule of response, the http response data that described HTTP request is corresponding。
In the present embodiment, only achieving the setting of rule of response corresponding to described HTTP request through step S101, the real amendment to http response data corresponding to HTTP request needs to realize based on step S102。In step s 102, qualifications http response data modified is described HTTP request to be responded after rule arranges, in addition it is also necessary to captures browser end and again sends described HTTP request。That is, only monitor after browser end sends described HTTP request again, just the rule of response in rule of response list can be mated, the rule of response corresponding to obtain this HTTP request, and complete the amendment of http response data based on this rule of response。Wherein, described rule of response in rule of response list is mated, can be regarded as and the URL comprised in the HTTP request currently caught and requesting method parameter information are mated with each rule of response in rule of response list, if above-mentioned two data information are satisfied by matching condition, then illustrate that rule of response is present in described rule of response list。Accordingly, the described amendment to http response data operate can be briefly described for: first intercept server end will be sent to the http response bag of browser end;Then search in rule of response list and obtain the rule of response matched with HTTP request;Afterwards original response data in described http response bag is replaced to the data comprised in the rule of response of above-mentioned acquisition, be achieved in the amendment of http response data。
A kind of method revising http response data that the embodiment of the present invention one provides, without carrying out the local setting searching and responding based on the data file searched rule preserved and this locality is preserved data file of session data corresponding to HTTP request, can after listening to the HTTP request in session list carried out drag operation, directly obtain the session data of this HTTP request, and can be achieved with the setting of HTTP request rule of response based on above-mentioned session data;And after again can sending above-mentioned HTTP request monitoring browser end, the current http response data of HTTP request are modified by the rule of response being directly based upon above-mentioned setting。The method that the present invention carries largely simplifies to be acted on behalf of debugging acid based on http protocol and http response data is modified operating process, thus saving the research and development time of research staff, improving http protocol and acting on behalf of the Consumer's Experience of debugging acid。
Embodiment two
The schematic flow sheet of a kind of method revising http response data that Fig. 2 provides for the embodiment of the present invention two。The embodiment of the present invention two is optimized based on above-described embodiment, in the present embodiment, by step " obtain the session data of described HTTP request; and based on described session data, the rule of response that described HTTP request is corresponding is set " be optimized for further: obtain the session data of described HTTP request, that ejects described rule of response arranges list simultaneously, the described list that arranges includes 4 editable text frames, respectively another name, URL, HTTP request method parameter and response body;The response data correspondence of the URL, HTTP request method parameter and the described HTTP request that are included by described session data is filled to the described editable text frame arranging list;Receiving after user's amendment to the described editable text frame arranging list edits and confirm, preserving and described list is set, complete described rule of response and arrange。
In addition, the invention process two also by step " monitoring after browser end sends described HTTP request again; mate described rule of response; and revise, based on described rule of response, the http response data that described HTTP request is corresponding " be optimized for further: capturing after browser end sends described HTTP request again, and server end sends http response bag to described browser end, intercept described http response bag;Read the rule of response list comprising at least one rule of response the rule of response that lookup and acquisition and described HTTP request match in described rule of response list;After getting described rule of response, the request header of described HTTP request is modified, to disable the buffer memory of described HTTP request;And based on described rule of response, revise the response data in described http response bag。
As in figure 2 it is shown, a kind of method revising http response data that the embodiment of the present invention two provides, specifically include following operation:
Step S201, after listening to the HTTP request in session list carried out drag operation, obtain the session data of described HTTP request, that ejects described rule of response arranges list simultaneously。
In the present embodiment, after listening to the HTTP request in session list is carried out drag operation, while obtaining the session data of described HTTP request, that can eject rule of response corresponding to this HTTP request arranges list。Wherein, the HTTP request in described session list is preferably the HTTP request that browser end sends, and the described list that arranges specifically can be regarded as the list edited for arranging described rule of response。Accordingly, the described list that arranges specifically can include 4 editable text frames, respectively another name, URL, HTTP request method parameter and response body。
The response data correspondence of step S202, the URL included by described session data, HTTP request method parameter and described HTTP request is filled to the described editable text frame arranging list。
In the present embodiment, the response data correspondence of URL, HTTP request method parameter and this HTTP request that the described session data got includes can be filled the extremely described list that arranges and can edit frame herein。It should be noted that the session data of the described HTTP request of described acquisition, eject arranging list and session data correspondence being filled and can edit frame herein to the described list that arranges of rule of response corresponding to this HTTP request, these operations almost carry out simultaneously。Namely, after listening to the HTTP request in session list carried out drag operation, perform above-mentioned three steps and operate the time spent less than 1 second, compared with the method for existing amendment http response data, without user's manual operation, largely simplify the operation that arranges to rule of response, and then save user and revise the operating time of http response data。
Further, the response data correspondence of described URL, HTTP request method parameter and the described HTTP request included by described session data is filled to the described editable text frame arranging list, specifically includes:
The response data of the URL, HTTP request method parameter and the described HTTP request that are included by described session data is filled respectively to the described editable text frame arranging the URL by name of list, HTTP request method parameter and response body;Extract, by canonical coupling, the filename comprised in the URL of described session data, and described filename is filled to the editable text frame of the described another name by name arranging list。
In the present embodiment, URL content in described session data specifically can be regarded as the protocol name (such as http protocol) needed for network service, server name (or IP address), access path and filename, exemplary, described URL is represented by: agreement: // server name/path?Filename, such as http://***.com/msg/msg_dataGetmsgCount?;In described session data, HTTP request method parameter content specifically can be regarded as the parameter value that HTTP request method is corresponding, such as GET parameter, POST parameter and PUT (increase) parameter etc., described requesting method parameter is preferably POST parameter by the present embodiment;In described session data, http response data specifically can be regarded as after the browser end captured sends HTTP request first, server end the http response data returned。Based on aforesaid operations step, it may be achieved session data is to the corresponding filling arranging list。
Additionally, for arranging the editable text frame of another name by name in list, the filling of its content can be passed through the URL realization in canonical coupling session data。Described canonical coupling specifically can be regarded as based on matching regular expressions URL。Exemplary, described regular expression may be configured as comprise " # ", "/" and "?" formula, concrete, URL can be divided into two parts character string with " # " number, Part I character string is designated as a;Character string a is divided into N section character string (N is for the integer more than 1) with "/" number, and remembers that last part character string is b;Finally by character string b with "?" number it is divided into two parts, take Part I, described Part I is exactly the file names portion in URL。After the filename being obtained URL by canonical coupling, so that it may described filename is filled to the editable text frame of another name by name arranging list。
Step S203, receiving after user's amendment to the described editable text frame arranging list edits and confirm, preserving and described list is set, complete described rule of response and arrange。
Usually, the editable text frame arranging list after filling can be modified editor by user, and finally, the described list that arranges can be revised and is compiled as required content by user, and the described acknowledgement key that list is set can be clicked, to realize the preservation arranging list after amendment editor。It should be noted that the described any editable text frame arranged in list can be modified editor by user, but the text box content of described URL by name can not be empty。
In the present embodiment, receiving after user's amendment to the described editable text frame arranging list edits and confirm, can preserve and described list is set, concrete, the described storing path arranging list can by user's sets itself, also can be saved in extensible markup language (ExtensibleMarkupLanguage, the XML) file of this locality by system default。Thus complete the setting of rule of response corresponding to HTTP request。
Step S204, capturing after browser end sends described HTTP request again, and server end is sending http response bag to described browser end, intercepts described http response bag。
In the present embodiment, acting on behalf of after debugging acid captures the HTTP request that browser end sends above-mentioned setting again based on http protocol, and capture server end send http response bag to described browser end before, the http response bag that server end is sent intercepts, the content in http response bag to be modified operation based on operations described below。
Step S205, read and comprise the rule of response list of at least one rule of response, and search in described rule of response list and obtain and rule of response that described HTTP request matches。
In the present embodiment, owing to the setting of described rule of response is shown in rule of response list, so needing described rule of response list is read, wherein said rule of response list is including at least a bar response rule。After the content in described rule of response list is read out, the rule of response matched with described HTTP request can be searched in rule of response list, and obtain the content comprised in the rule of response found。
Further, the described rule of response that lookup and acquisition and described HTTP request match in described rule of response list, specifically include:
Judge whether described rule of response list exists the rule of response matched of the URL with described HTTP request;If there is described rule of response, then judge whether described rule of response exists the HTTP request method parameter that the HTTP request method parameter with described HTTP request matches;If there is the HTTP request method parameter matched, then obtain described rule of response。
In the present embodiment, the URL comprised in each with rule of response list for the URL in described HTTP request rule of response file can be mated。If there is the rule of response matched of the URL with described HTTP request in described rule of response list, then may determine that the rule of response (being likely 1, it is also possible to be multiple) matched, and this rule of response is made further coupling。That is, again judge whether this rule of response exists the HTTP request method parameter matched with the HTTP request method parameter in described HTTP request。If there is such rule of response (finally at most determining 1 rule of response), then obtaining this rule of response, namely obtaining all data messages in this rule of response (the response volume data including in rule of response)。
Step S206, after getting described rule of response, the request header of described HTTP request is modified, to disable the buffer memory of described HTTP request;And based on described rule of response, revise the response data in described http response bag。
In the present embodiment, after getting described rule of response (data message of rule of response), the amendment operation of the request header of described HTTP request can be carried out, its amendment operation can be undertaken by the special interface function that http protocol is acted on behalf of in debugging acid, wherein, described special interface function can be regarded as and HTTP request is sent to the interface function worked before server。Exemplary, in Fiddler, the function name of this special interface function is expressed as AutoTamperRequestBefore ()。Concrete, the field value set in this HTTP request head can be modified as 0 by described special interface function, thus can disable the buffer memory of described HTTP request。It should be noted that, the buffer memory disabling described HTTP request just can get the complete http response bag corresponding to described HTTP request, thus avoid server and directly this HTTP request cache information in the server is sent to the situation of browser end, and then ensure that and can revise http response data。
In the present embodiment, when get rule of response and carry out HTTP request buffer memory disabling after, it is possible to based on the rule of response obtained carry out response data in described http response bag amendment operation。
Further, described based on described rule of response, revise the response data in described http response bag, specifically include:
Described http response bag is carried out decompression operation;Obtain the response body comprised in described rule of response;Response data in described http response bag is replaced with the data in described response body。
In the present embodiment, response data in described http response bag is modified, first have to described http response bag is carried out decompression operation, because in the transmitting procedure to described http response bag, generally http response bag is compressed with the form of .gzip, so when obtaining the data in http response bag, it is necessary to first decompress described http response bag;Then the information content responding body in the rule of response after matched rule match is obtained;Finally, the response of available described rule of response is internal holds the response data replaced in described http response bag, is achieved in the amendment to http response data。It should be noted that, in the amendment carrying out http response data, also need to recalculate the length of described response data, and based on the response body field value in the length value amendment http response head calculated, make this field value length value equal to amended http response data。Additionally, after amendment http response data, amended http response data can be sent to browser end, the user of browser end just can see amended http response data message。
A kind of method revising http response data that the embodiment of the present invention two provides, the amendment operated with response data that arranges optimizing rule of response further operates。Make it after listening to HTTP request is carried out drag operation, it is possible to obtaining the session data of this HTTP request and extract related data from session data and be filled into the rule of response of ejection and arrange in list, this operation enormously simplify the setting procedure of rule of response;And after again can sending HTTP request capturing browser end, by mating URL and HTTP request method parameter, the rule of response in rule of response list is mated, substantially increase the matching accuracy rate of rule of response based on this matched rule;The amendment to http response data is completed eventually through to the replacement of response data in current http response bag。
Embodiment three
The schematic flow sheet of a kind of method revising http response data that Fig. 3 provides for the embodiment of the present invention three。The present embodiment three is optimized based on above-described embodiment, in the present embodiment, step " monitoring after browser end sends described HTTP request again; mate described rule of response; and revise, based on described rule of response, the http response data that described HTTP request is corresponding " after, also add step: distinctly display the described HTTP request that described http protocol is acted on behalf of in debugging acid session list。
As it is shown on figure 3, a kind of method revising http response data that the embodiment of the present invention provides, specifically include following operation:
Step S301, after listening to the HTTP request in session list carried out drag operation, obtain the session data of described HTTP request, and the rule of response that described HTTP request is corresponding is set based on described session data, wherein, the HTTP request in described session list is the HTTP request that browser end sends。
Step S302, monitoring after browser end sends described HTTP request again, mate described rule of response, and revise, based on described rule of response, the http response data that described HTTP request is corresponding。
In the present embodiment, not at detailed description step S301 and step S302, it implements the description that process is referred in embodiment one or embodiment two。
Step S303, the described HTTP request distinctly displayed in described session list。
In the present embodiment, it is understandable that, the device execution of the amendment http response data in debugging acid acted on behalf of by the method needs of amendment http response data provided by the present invention based on being integrated in http protocol, therefore, after required HTTP request is carried out the amendment of http response data of correspondence, need to act on behalf of in debugging acid session list at described http protocol distinctly display out by revising the HTTP request of response data, reach the purpose reminding the response data of HTTP request described in user to be modified。Exemplary, it is possible to the HTTP request corresponding to amendment http response data is differently shown with red background or green background or other more prominent color backgrounds in session list。
A kind of method revising http response data that the embodiment of the present invention three provides, complete the setting of rule of response corresponding to HTTP request, and monitoring after browser end sends this HTTP request again, complete the amendment to http response data based on the rule of response arranged;Additionally, after the amendment completing http response data, also http protocol is acted on behalf of the HTTP request that in debugging acid session list, these http response data are corresponding and is differently shown, thus reach the purpose reminding the response data of HTTP request described in user to be modified。
Embodiment four
The schematic flow sheet of a kind of method revising http response data that Fig. 4 provides for the embodiment of the present invention four。The embodiment of the present invention four is a preferred embodiment, and the method for the amendment http response data provided is performed by the device revising http response data, and this device is integrated in http protocol as a kind of plug-in unit and acts on behalf of in debugging acid Fiddler。
As shown in Figure 4, a kind of method revising http response data that the invention process four provides, specifically include following operation:
Step S401, after listening to the HTTP request in the session list of Fiddler carried out drag operation, obtain the session data of described HTTP request, that ejects described rule of response arranges list simultaneously。
Wherein, described HTTP request is preferably based on the Fiddler HTTP request sent by browser end caught;The described list that arranges includes the editable text frame of another name by name, URL, POST parameter and response body。
Exemplary, realizing the HTTP request in the session list to Fiddler by IAutoTamper () interface function in Fiddler and carry out the monitoring of drag operation, the major function of described IAutoTamper () interface function specifically can be regarded as the event to Fiddler and monitors。
The response data of step S402, URL, POST parameter included by described session data and described HTTP request is filled in the editable text frame of described URL, POST parameter by name arranging list and response body respectively;Extracted the filename in the URL of session data simultaneously by canonical coupling, and file name is filled to the editable text frame of another name by name。
Exemplary, eject based on step S401 described rule of response list is set after, just can quickly realize described session data to the filling arranging list。
Step S403, receiving after user's amendment to the described editable text frame arranging list edits and confirm, preserving and described list is set, complete described rule of response and arrange。
Exemplary, receive user to insert HTTP request session data arrange list modify editor and confirm after, just can being saved in local XML file by the setting list of described rule of response, the rule of response after preservation can show in rule of response list。
Step S404, capturing based on Fiddler after browser end sends described HTTP request again, and capturing server end and send http response bag to described browser end, intercepting described http response bag。
Exemplary, capturing after browser end sends described HTTP request again based on Fiddler, and capture server end transmission http response bag to described browser end, the interception of http response bag can be realized based on the AutoTamperResponseBefore () interface function in Fiddler, AutoTamperResponseBefore () interface function in described Fiddler specifically can be regarded as before the http response data that HTTP request is corresponding return browser end, and the data in Fiddler are operated interface function required when programming。
Step S405, read and comprise the rule of response list of at least one rule of response。
Exemplary, before carrying out http response data modification, including at least a rule of response in described rule of response list。
Step S406, judge whether described rule of response list exists the rule of response matched of the URL with described HTTP request;If so, step S407 is then performed;If it is not, then return step S401。
Exemplary, respond the rule match of rule based on step S406, when Response List exists the rule of response matched of the URL with described HTTP request, it is possible to perform step S407;Otherwise, it is possible to return step S401。Described when being absent from Response List with the URL of the described HTTP request rule of response matched, return it into step S401 and specifically can be regarded as in Response List the rule of response being absent from described HTTP request, if wanting the amendment that this HTTP request is responded data, then need to return step S401 and first carry out the setting of rule of response。It is thus understood that, the method that the present invention carries is execution capable of circulation。
Step S407, judge the POST parameter that whether there is the POST match parameters with described HTTP request in described rule of response, if so, then perform step S408, if it is not, then return step S401。
In the present embodiment, when meeting the decision condition of step S406, it is necessary to perform step S407 and judge whether the POST parameter in described rule of response mates the POST parameter of HTTP request further, if coupling, then can perform step S408;Otherwise, needing also exist for returning step S401, reason is ibid。
Step S408, obtain described rule of response, and the request header of described HTTP request is modified。
Exemplary, after meeting the decision condition of step S407, it is possible to obtain the rule of response matched with described HTTP request, and the data message in described rule of response can be obtained。In addition, it is also based on AutoTamperRequestBefore () and the field value set in this HTTP request head is modified as 0, thus can disabling the buffer memory of described HTTP request, described interface function AutoTamperRequestBefore () can be regarded as and the data in Fiddler are operated before HTTP request is sent to server interface function required when programming。
Step S409, the http response bag intercepted is carried out decompression operation。
Exemplary, the http response bag that the document form of interception is .gzip is decompressed so that it is the response data in http response bag can be modified。
Step S410, the response body obtained in the described rule of response found, replace with the data in described response body by the response data in described http response bag。
Exemplary, it is possible to based on the data message responding body in described rule of response, the response data in described http response bag is replaced, is consequently formed new http response data。Further, when http response data are modified, need to recalculate the length value of http response data, and in the Content-Length field revised based on Fiddler in http response head, make this field value length value equal to amended http response data。
Step S411, the described HTTP request distinctly displayed in Fiddler session list。
Exemplary, the background background color carrying out the HTTP request of http response data modification in Fiddler is set to green, to realize the differentiation with other normal HTTP request, reaches the purpose reminding the response data of HTTP request described in user to be modified。
The preferred embodiment of a kind of method revising http response data that the embodiment of the present invention four provides, describe the process acting on behalf of http response data of modifying based on institute of the present invention extracting method in debugging acid Fiddler at http protocol in detail, compared with the method for amendment http response data existing with Fiddler, the method that the present invention carries largely simplifies to be acted on behalf of debugging acid based on http protocol and http response data is modified operating process, thus saving the research and development time of research staff, improving http protocol and acting on behalf of the Consumer's Experience of debugging acid。
Embodiment five
The structured flowchart of a kind of device revising http response data that Fig. 5 provides for the embodiment of the present invention five。This device is applicable to the situation of amendment http response data, can be realized by software and/or hardware, acts on behalf of the part of debugging acid as http protocol and is integrated in http protocol and acts on behalf of in debugging acid。As it is shown in figure 5, this device specifically includes following structure: rule of response arranges module 51 and response data modified module 52。Wherein,
Rule of response arranges module 51, for after listening to the HTTP request in session list carried out drag operation, obtain the session data of described HTTP request, and the rule of response that described HTTP request is corresponding is set based on described session data, wherein, the HTTP request in described session list is the HTTP request that browser end sends。
Response data modified module 52, for monitoring after browser end sends described HTTP request again, mating described rule of response, and revise, based on described rule of response, the http response data that described HTTP request is corresponding。
In the present embodiment, this device first passes through rule of response and arranges module 51 after listening to the HTTP request in session list is carried out drag operation, obtain the session data of described HTTP request, and the rule of response that described HTTP request is corresponding is set based on described session data;Then further through response data modified module 52 monitoring after browser end sends described HTTP request again, mate described rule of response, and revise, based on described rule of response, the http response data that described HTTP request is corresponding。
Further, rule of response arranges module 51, including:
Data capture unit 511, for obtaining the session data of described HTTP request, ejects the list that arranges of described rule of response simultaneously, and the described list that arranges includes 4 editable text frames, respectively another name, URL, HTTP request method parameter and response body。
Data fill unit 512, and the response data correspondence of URL, HTTP request method parameter and described HTTP request for being included by described session data is filled to the described editable text frame arranging list。
List storage unit 513, for receiving after user's amendment to the described editable text frame arranging list edit and confirm, preserves and described arranges list, complete the setting of described rule of response。
On the basis of above-described embodiment, described data fill unit 512, are particularly used in:
The response data of the URL, HTTP request method parameter and the described HTTP request that are included by described session data is filled respectively to the described editable text frame arranging the URL by name of list, HTTP request method parameter and response body;Extract, by canonical coupling, the filename comprised in the URL of described session data, and described filename is filled to the editable text frame of the described another name by name arranging list。
Further, described response data modified module 52, including:
Response interception unit 521, for capturing after browser end sends described HTTP request again, and server end sends http response bag to described browser end, intercepts described http response bag。
Rule match unit 522, for reading the rule of response list comprising at least one rule of response, and the rule of response that lookup and acquisition and described HTTP request match in described rule of response list。
Data modification unit 523, for, after getting described rule of response, modifying to the request header of described HTTP request, to disable the buffer memory of described HTTP request;And based on described rule of response, revise the response data in described http response bag。
On the basis of above-described embodiment, described rule match unit 521, it is particularly used in:
Judge whether described rule of response list exists the rule of response matched of the URL with described HTTP request;If there is described rule of response, then judge whether described rule of response exists the HTTP request method parameter that the HTTP request method parameter with described HTTP request matches;If there is the described HTTP request method parameter matched, then obtain described rule of response。
Described data modification unit 523, is particularly used in:
After getting described rule of response, the request header of described HTTP request is modified, and described http response bag is carried out decompression operation;Obtain the response body comprised in described rule of response, and the response data in described http response bag is replaced with the data in described response body。
Further, this device also includes:
Distinctly display module 53, for again sending described HTTP request monitoring browser end, after revising, based on described rule of response, the http response data that described HTTP request is corresponding, distinctly display the described HTTP request that described http protocol is acted on behalf of in debugging acid session list。
A kind of device revising http response data that the embodiment of the present invention five provides, first pass through data capture unit that rule of response arranges in module, data fill unit and list storage unit achieves the setting of rule of response, compared with the plug-in unit of existing amendment http response data, simplify the setting procedure of rule of response significantly;Then, by the response interception unit in response data modified module, rule match unit and data modification unit, it is provided with and has carried out the coupling of rule of response based on URL and HTTP request method parameter, achieve the amendment of http response data, compared with the plug-in unit of existing amendment http response data, largely improve the matching accuracy rate of rule of response;Finally, it is also provided with distinctly displaying module, in order to reach the purpose reminding the response data of HTTP request described in user to be modified。As can be seen here, the device that the present invention carries improves http protocol further and acts on behalf of the Consumer's Experience of debugging acid。
Note, above are only presently preferred embodiments of the present invention and institute's application technology principle。It will be appreciated by those skilled in the art that and the invention is not restricted to specific embodiment described here, various obvious change can be carried out for a person skilled in the art, readjust and substitute without departing from protection scope of the present invention。Therefore, although the present invention being described in further detail by above example, but the present invention is not limited only to above example, when without departing from present inventive concept, other Equivalent embodiments more can also be included, and the scope of the present invention is determined by appended right。

Claims (14)

1. the method revising http response data, it is characterised in that including:
After listening to the HTTP request in session list carried out drag operation, obtain the session data of described HTTP request, and the rule of response that described HTTP request is corresponding is set based on described session data, wherein, the HTTP request in described session list is the HTTP request that browser end sends;
Monitoring after browser end sends described HTTP request again, mate described rule of response, and revise, based on described rule of response, the http response data that described HTTP request is corresponding。
2. method according to claim 1, it is characterised in that the session data of the described HTTP request of described acquisition, and the rule of response that described HTTP request is corresponding is set based on described session data, including:
Obtaining the session data of described HTTP request, eject the list that arranges of described rule of response simultaneously, the described list that arranges includes 4 editable text frames, respectively another name, URL, HTTP request method parameter and response body;
The response data correspondence of the URL, HTTP request method parameter and the described HTTP request that are included by described session data is filled to the described editable text frame arranging list;
Receiving after user's amendment to the described editable text frame arranging list edits and confirm, preserving and described list is set, complete described rule of response and arrange。
3. method according to claim 2, it is characterized in that, the response data correspondence of described URL, HTTP request method parameter and the described HTTP request included by described session data is filled to the described editable text frame arranging list, specifically includes:
The response data of the URL, HTTP request method parameter and the described HTTP request that are included by described session data is filled respectively to the described editable text frame arranging the URL by name of list, HTTP request method parameter and response body;
Extract, by canonical coupling, the filename comprised in the URL of described session data, and described filename is filled to the editable text frame of the described another name by name arranging list。
4. method according to claim 1, it is characterised in that described mate described rule of response monitoring after browser end sends described HTTP request again, and revise, based on described rule of response, the http response data that described HTTP request is corresponding, including:
Capturing after browser end sends described HTTP request again, and server end is sending http response bag to described browser end, intercepts described http response bag;
Read the rule of response list comprising at least one rule of response the rule of response that lookup and acquisition and described HTTP request match in described rule of response list;
After getting described rule of response, the request header of described HTTP request is modified, to disable the buffer memory of described HTTP request;And based on described rule of response, revise the response data in described http response bag。
5. method according to claim 4, it is characterised in that the described rule of response that lookup and acquisition and described HTTP request match in described rule of response list, specifically includes:
Judge whether described rule of response list exists the rule of response that the URL with described HTTP request matches;
If there is described rule of response, then judge whether described rule of response exists the HTTP request method parameter that the HTTP request method parameter with described HTTP request matches;
If there is the described HTTP request method parameter matched, then obtain described rule of response。
6. method according to claim 4, it is characterised in that described based on described rule of response, revises the response data in described http response bag, specifically includes:
Described http response bag is carried out decompression operation;
Obtain the response body comprised in described rule of response;
Response data in described http response bag is replaced with the data in described response body。
7. according to the arbitrary described method of claim 1-6, it is characterized in that, described monitoring after browser end sends described HTTP request again, mate described rule of response, and based on, after the http response data that the described HTTP request of described rule of response amendment is corresponding, also including:
Distinctly display the described HTTP request in described session list。
8. revise a device for http response data, be integrated in http protocol and act on behalf of in debugging acid, it is characterised in that including:
Rule of response arranges module, for after listening to the HTTP request in session list carried out drag operation, obtain the session data of described HTTP request, and the rule of response that described HTTP request is corresponding is set based on described session data, wherein, the HTTP request in described session list is the HTTP request that browser end sends;
Response data modified module, for monitoring after browser end sends described HTTP request again, mating described rule of response, and revise, based on described rule of response, the http response data that described HTTP request is corresponding。
9. device according to claim 8, it is characterised in that described rule of response arranges module, including:
Data capture unit, for obtaining the session data of described HTTP request, ejecting the list that arranges of described rule of response, the described list that arranges includes 4 editable text frames simultaneously, respectively another name, URL, HTTP request method parameter and response body;
Data fill unit, and the response data correspondence of URL, HTTP request method parameter and described HTTP request for being included by described session data is filled to the described editable text frame arranging list;
List storage unit, for receiving after user's amendment to the described editable text frame arranging list edit and confirm, preserves and described arranges list, complete the setting of described rule of response。
10. device according to claim 9, it is characterised in that described data fill unit, specifically for:
The response data of the URL, HTTP request method parameter and the described HTTP request that are included by described session data is filled respectively to the described editable text frame arranging the URL by name of list, HTTP request method parameter and response body;
Extract, by canonical coupling, the filename comprised in the URL of described session data, and described filename is filled to the editable text frame of the described another name by name arranging list。
11. device according to claim 8, it is characterised in that described response data modified module, including:
Response interception unit, for capturing after browser end sends described HTTP request again, and server end sends http response bag to described browser end, intercepts described http response bag;
Rule match unit, for reading the rule of response list comprising at least one rule of response, and the rule of response that lookup and acquisition and described HTTP request match in described rule of response list;
Data modification unit, for, after getting described rule of response, modifying to the request header of described HTTP request, to disable the buffer memory of described HTTP request;And based on described rule of response, revise the response data in described http response bag。
12. device according to claim 11, it is characterised in that described rule match unit, specifically for:
Judge whether described rule of response list exists the rule of response that the URL with described HTTP request matches;
If there is described rule of response, then judge whether described rule of response exists the HTTP request method parameter that the HTTP request method parameter with described HTTP request matches;
If there is the described HTTP request method parameter matched, then obtain described rule of response。
13. device according to claim 11, it is characterised in that described data modification unit, specifically for:
After getting described rule of response, the request header of described HTTP request is modified, and described http response bag is carried out decompression operation;
Obtain the response body comprised in described rule of response, and the response data in described http response bag is replaced with the data in described response body。
14.-13 arbitrary described device according to Claim 8, it is characterised in that also include:
Distinctly display module, for again sending described HTTP request monitoring browser end, after revising, based on described rule of response, the http response data that described HTTP request is corresponding, distinctly display the described HTTP request in described session list。
CN201610103734.1A 2016-02-25 2016-02-25 Method and device for modifying HTTP response data Pending CN105700894A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610103734.1A CN105700894A (en) 2016-02-25 2016-02-25 Method and device for modifying HTTP response data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610103734.1A CN105700894A (en) 2016-02-25 2016-02-25 Method and device for modifying HTTP response data

Publications (1)

Publication Number Publication Date
CN105700894A true CN105700894A (en) 2016-06-22

Family

ID=56223340

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610103734.1A Pending CN105700894A (en) 2016-02-25 2016-02-25 Method and device for modifying HTTP response data

Country Status (1)

Country Link
CN (1) CN105700894A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108521444A (en) * 2018-03-19 2018-09-11 五八有限公司 A kind of Networked E-Journals method, apparatus and computer readable storage medium
CN110516143A (en) * 2018-05-31 2019-11-29 北京数聚鑫云信息技术有限公司 A kind of business datum extracting method and device based on browser
CN112800309A (en) * 2021-01-30 2021-05-14 上海应用技术大学 Crawler system based on HTTP proxy and implementation method thereof

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060112174A1 (en) * 2004-11-23 2006-05-25 L Heureux Israel Rule-based networking device
CN101304418A (en) * 2007-05-09 2008-11-12 赛门铁克公司 Client side protection against drive-by pharming via referrer checking
CN101426172A (en) * 2007-10-29 2009-05-06 中兴通讯股份有限公司 Method and system for webpage viewing by mobile multimedia data broadcast
CN102075570A (en) * 2010-12-31 2011-05-25 南京中兴特种软件有限责任公司 Method for implementing HTTP (hyper text transport protocol) message caching mechanism based on keywords

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060112174A1 (en) * 2004-11-23 2006-05-25 L Heureux Israel Rule-based networking device
US20090327827A1 (en) * 2004-11-23 2009-12-31 Juniper Networks, Inc. Rule-based networking device
CN101304418A (en) * 2007-05-09 2008-11-12 赛门铁克公司 Client side protection against drive-by pharming via referrer checking
CN101426172A (en) * 2007-10-29 2009-05-06 中兴通讯股份有限公司 Method and system for webpage viewing by mobile multimedia data broadcast
CN102075570A (en) * 2010-12-31 2011-05-25 南京中兴特种软件有限责任公司 Method for implementing HTTP (hyper text transport protocol) message caching mechanism based on keywords

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
邱鹏 等: "《移动App测试实战 顶级互联网企业软件测试和质量提升最佳实践》", 31 July 2015, 机械工业出版社 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108521444A (en) * 2018-03-19 2018-09-11 五八有限公司 A kind of Networked E-Journals method, apparatus and computer readable storage medium
CN108521444B (en) * 2018-03-19 2022-05-31 五八有限公司 Network debugging method and device and computer readable storage medium
CN110516143A (en) * 2018-05-31 2019-11-29 北京数聚鑫云信息技术有限公司 A kind of business datum extracting method and device based on browser
CN112800309A (en) * 2021-01-30 2021-05-14 上海应用技术大学 Crawler system based on HTTP proxy and implementation method thereof

Similar Documents

Publication Publication Date Title
CN102655481B (en) A kind of instant messaging chat content inspection method based on webpage and system
CN103139292B (en) Method for processing pictures in hyper text transmission protocol (HTTP) proxy and proxy server and system
US20190102351A1 (en) Generating configuration information for obtaining web resources
CN101902485B (en) Rewriting method of reversal Web agent link
CN107133161B (en) Method and device for generating client performance test script
CN106484611B (en) Fuzzy test method and device based on automatic protocol adaptation
US20060259898A1 (en) System, methods and apparatus for markup language debugging
CN108959539B (en) Rule-configurable webpage data analysis method
CN104685831A (en) Measuring web page rendering time
CN103034483A (en) Web page script management method and system
CN102420782A (en) Method, client and system for sharing webpage by instant messaging
CN102638580A (en) Webpage information processing method and webpage information processing device
CN102882974A (en) Method for saving website access resource by website identification version number
CN108833565B (en) Method and device for monitoring server, server and storage medium
CN105205072B (en) The methods of exhibiting and system of webpage information
CN106656919B (en) A kind of session analytic method and system based on Telnet agreement
CN112181477B (en) Complex event processing method and device and terminal equipment
CN105700894A (en) Method and device for modifying HTTP response data
CN105190530A (en) Transmitting hardware-rendered graphical data
CN106992940A (en) Message processing method, device, system and terminal
CN106582013B (en) Game service system, method and device for updating data to online game
CN105023184A (en) Financial market information query method based on WeChat terminal
CN107800552A (en) A kind of data interactive method and device
CN103312736B (en) Web page processing method and system and proxy server
CN111857932A (en) Web substitution and filling method for operation and maintenance auditing system based on puppeteer

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20160622

RJ01 Rejection of invention patent application after publication