[go: up one dir, main page]

CN103795762B - A kind of test method and system of reverse proxy - Google Patents

A kind of test method and system of reverse proxy Download PDF

Info

Publication number
CN103795762B
CN103795762B CN201210431552.9A CN201210431552A CN103795762B CN 103795762 B CN103795762 B CN 103795762B CN 201210431552 A CN201210431552 A CN 201210431552A CN 103795762 B CN103795762 B CN 103795762B
Authority
CN
China
Prior art keywords
request
response
http request
response information
processor
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.)
Active
Application number
CN201210431552.9A
Other languages
Chinese (zh)
Other versions
CN103795762A (en
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.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and 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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201210431552.9A priority Critical patent/CN103795762B/en
Publication of CN103795762A publication Critical patent/CN103795762A/en
Application granted granted Critical
Publication of CN103795762B publication Critical patent/CN103795762B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Computer And Data Communications (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The present invention provides a kind of test methods of reverse proxy, comprising: pre-generated http request is sent to Reverse Proxy by request of loading processor;The http request received is transmitted to response playback processor by the Reverse Proxy, and the response information prerecorded that the response playback processor returns after receiving http request is received, the response information is transmitted to the request of loading processor;The response information received from the Reverse Proxy is compared by the request of loading processor with local preset response information, obtains the test result of the Reverse Proxy according to comparison result;The present invention also provides a kind of test macros of reverse proxy.The technical solution provided according to the present invention can efficiently realize the functional test of Reverse Proxy.

Description

Reverse proxy test method and system
[ technical field ] A method for producing a semiconductor device
The invention relates to a testing technology in the field of internet, in particular to a testing method and a testing system for a reverse proxy.
[ background of the invention ]
The reverse proxy is that a reverse proxy server is used for receiving a connection request on the internet, then the request is forwarded to a server on an internal network, and a result obtained from the server is returned to a client requesting connection on the internet. The reverse proxy is widely applied to various large internets and is mainly used for carrying out flow statistics, flow forwarding, seven-layer attack prevention and the like.
At present, in the testing process of the reverse proxy, different clients, such as a mobile phone, a computer, a tablet computer and the like, need to be used for sending different types of http requests to the reverse proxy server, and meanwhile, various services for processing different http requests need to be constructed on a web server for testing whether the reverse proxy server can work normally. The method comprises the steps that various http requests and corresponding services on a web server need manual construction by testers, so that the testing process time of the existing reverse proxy is long, and a real http request and response environment are difficult to simulate.
[ summary of the invention ]
The invention provides a method and a system for testing a reverse proxy, which can efficiently realize the function test of a reverse proxy server.
The specific technical scheme of the invention is as follows:
according to a preferred embodiment of the present invention, a method for testing a reverse proxy comprises:
the request loading processor sends a pre-generated http request to the reverse proxy server;
the reverse proxy server transmits the received http request to a response playback processor, receives pre-recorded response information returned by the response playback processor after receiving the http request, and transmits the response information to the request loading processor;
and the request loading processor compares the response information received from the reverse proxy server with locally preset response information, and obtains a test result of the reverse proxy server according to a comparison result.
In the above method, the method for generating the http request in advance by the request loading processor is as follows:
the request loading processor stores a request log file of a web server in advance, wherein the request log file of the web server contains request log information of the web server;
a request loading processor extracts a field from request log information of the web server;
and the request loading processor fills a preset http request template by utilizing the extracted field to generate an http request.
In the above method, the method for generating the http request in advance by the request loading processor is as follows:
the request loading processor receives http information input by a user;
and the request loading processor fills a preset http request template by using http information input by a user to generate an http request.
In the above method, the method for the response playback processor to record the response information in advance comprises:
the response playback processor receives and stores an http request sent by a request loading processor or a browser;
the response playback processor forwards the received http request to a web server and receives response information corresponding to the http request returned by the web server;
and the response playback processor stores the response information and the corresponding relation between the response information and the http request.
In the above method, the method for requesting to load the preset response information in the processor comprises:
the request loading processor receives response information copied from the response playback processor and the corresponding relation between the response information and the http request.
In the above method, the method for the response playback processor to return the pre-recorded response information after receiving the http request includes:
the response playback processor finds response information corresponding to the http request according to a corresponding relation between a preset http request and the response information;
and the response playback processor returns the found response information to the reverse proxy server according to a preset sending delay fixed value or a random value in a sending delay interval.
In the above method, the obtaining a test result of the reverse proxy server according to the comparison result specifically includes:
if the information in the two response messages is different, judging that the function of the reverse proxy server is abnormal, and sending an alarm mail to a preset user mailbox; the alarm mail comprises the following steps: receiving abnormal response information from a reverse proxy server, an http request corresponding to the abnormal response information, and response information corresponding to a local preset http request;
if the information in the two response messages is the same, judging that the reverse proxy server is normal in function, and sending a test report to a preset user mailbox; the test report includes: the number of the transmitted http requests, the number of response information corresponding to each response time period, the average value of the response time, and the return value in the received response information.
A reverse proxy test system comprising: a request loading processor, a reverse proxy server and a response playback processor; wherein,
the request loading processor is used for sending a pre-generated http request to the reverse proxy server;
the reverse proxy server is used for forwarding the received http request to the response playback processor, receiving the pre-recorded response information returned by the response playback processor after receiving the http request, and forwarding the response information to the request loading processor;
and the request loading processor is also used for comparing the response information received from the reverse proxy server with locally preset response information and obtaining a test result of the reverse proxy server according to the comparison result.
In the above system, the request loading processor generates an http request in advance, specifically:
the method comprises the steps of pre-storing a request log file of a web server, wherein the request log file of the web server comprises request log information of the web server;
extracting fields from request log information of the web server;
and filling a preset http request template by using the extracted field to generate an http request.
In the above system, the request loading processor generates an http request in advance, specifically:
receiving http information input by a user;
and filling a preset http request template by using http information input by a user to generate an http request.
In the above system, the response playback processor records response information in advance, specifically:
receiving and storing an http request sent by a request loading processor or a browser;
forwarding the received http request to a web server, and receiving response information corresponding to the http request returned by the web server;
and storing the response information and the corresponding relation between the response information and the http request.
In the system, the response information is preset in the request loading processor, and the method specifically includes:
the request loading processor receives response information copied from the response playback processor and the corresponding relation between the response information and the http request.
In the above system, the response playback processor returns the pre-recorded response information after receiving the http request, specifically:
finding response information corresponding to the http request according to a corresponding relation between a preset http request and the response information;
and returning the found response information to the reverse proxy server according to a preset sending delay fixed value or a random value in a sending delay interval.
In the above system, the request loading processor obtains the test result of the reverse proxy server according to the comparison result, and specifically includes:
if the information in the two response messages is different, judging that the function of the reverse proxy server is abnormal, and sending an alarm mail to a preset user mailbox; the alarm mail comprises the following steps: receiving abnormal response information from a reverse proxy server, an http request corresponding to the abnormal response information, and response information corresponding to a local preset http request;
if the information in the two response messages is the same, judging that the reverse proxy server is normal in function, and sending a test report to a preset user mailbox; the test report includes: the number of the transmitted http requests, the number of response information corresponding to each response time period, the average value of the response time, and the return value in the received response information.
According to the technical scheme, the invention has the following beneficial effects:
the function test of the reverse proxy server is realized through the closed-loop automatic interaction among the request loading processor, the reverse proxy server and the response playback processor, and complex web service and response environment do not need to be built on the web server, so that the test time is greatly reduced, and the test efficiency of the reverse proxy is improved.
[ description of the drawings ]
FIG. 1 is a schematic block diagram of a preferred embodiment of a test system implementing a reverse proxy according to the present invention;
FIG. 2 is a flow chart diagram of a preferred embodiment of a test method for implementing a reverse proxy of the present invention;
FIG. 3 is a schematic flow chart of a method for recording response information by a response playback processor according to the present invention;
fig. 4 is a schematic diagram of the networking of the present invention in testing a reverse proxy server.
[ detailed description ] embodiments
The basic idea of the invention is: the request loading processor sends a pre-generated http request to the reverse proxy server; the reverse proxy server transmits the received http request to a response playback processor, receives pre-recorded response information returned by the response playback processor after receiving the http request, and transmits the response information to the request loading processor; and the request loading processor compares the response information received from the reverse proxy server with locally preset response information, and obtains a test result of the reverse proxy server according to a comparison result.
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in detail with reference to the accompanying drawings and specific embodiments.
Fig. 1 is a schematic structural diagram of a preferred embodiment of the test system for implementing a reverse proxy according to the present invention, and as shown in fig. 1, the system includes: a request loading processor 10, a reply playback processor 11 and a reverse proxy server 12.
Based on the above system, the present invention further provides a reverse proxy testing method, fig. 2 is a schematic flow chart of a preferred embodiment of the reverse proxy testing method implemented by the present invention, as shown in fig. 2, the preferred embodiment includes the following steps:
step 201, a request loading processor extracts a field from request log information of a web server, and generates an http request according to the extracted field and a preset http request template; or the request loading processor receives input http information and generates an http request according to the http information and a preset http request template.
Specifically, in the preferred embodiment, more than one request loading processor is provided, for each request loading processor, a user needs to store a request log file of a web server into the request loading processor in advance, the content of the request log file of the web server is a log stored by the web server according to a received http request when the user sends the http request to the web server through a browser, the log belongs to an online real http request log, the request log file of the web server contains request log information of more than one web server, and the request loading processor extracts a plurality of fields from the request log information of the web server according to a preset policy, such as a request type, a request address, a data coding mode that the browser can decode, cookie data, a browser type, a source URL, a host in an initial URL, a port and the like; the preset strategy can be to extract fields referenced by quotation marks in the character string or fields after spaces in the character string; after extracting fields from request log information of a web server, a request loading processor fills the extracted fields into an http request template according to the http request template preset by a user to generate an http request; here, the request loading processor needs to generate http requests of the same number according to the number of the request log information of the web servers in the request log file of the web server, that is, an http request is generated correspondingly for the request log information of each web server.
Or, requesting the loading processor to receive http information input by a user, wherein the http information comprises: request type, request address, data encoding mode which can be decoded by the browser, cookie data, browser type, source URL, host and port in initial URL, etc.; then, the request loading processor fills http information input by the user into an http request template preset by the user to generate an http request; here, the request loading processor supports http information input by a user, and can conveniently realize and construct various types of http requests for testing the functions of the reverse proxy server.
For example, there is the following request log information of the web server:
61.236.32.126--[05/Mar/2007:00:00:00+0800]″GET/index.php?tn=btplus_cbHTTP/1.1″2001467mod_gzip:54pct.″www.host.com″″www.referer.com″BAIDUID=141550BC0DD29E1F93BFD49836DA40CC″Mozilla/4.0(compatible;MSIE 6.0;Windows NT 5.1;SV1)″
wherein, GET is a request type to replace a method field in an http request template; php; gzip is a data coding mode which can be decoded by the browser, and replaces an Accept-Encoding field in an http request template; BAIDUID =141550BC0DD29E1F93BFD49836DA40CC is cookie data, and replaces a cookie field in an http request template; mozilla/4.0(compatible; MSIE 6.0; Windows NT 5.1; SV1 is browser type, replacing the User-Agent field in the http request template; www.host.com is the Host and port in the initial URL, replacing the Host field in the http request template; www.referer.com is the source URL, replacing the refer field in the http request template; furthermore, the Accept field in the http request template is fixed as text/html, application/xhtml + xml, application/xml, (+) q =0.9,/, q = 0.8.
The http request generated according to the fields extracted from the above example of the request log information of the web server is as follows:
″GET//index.php?tn=btplus_cb HTTP/1.1\r\nHost:www.host.com\r\nAccept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Encoding:gzip,deflate\r\nReferer:www.referer.com\r\nCookie:BAIDUID=141550BC0DD29E1F93BFD49836DA40CC;\r\nUser-Agent:Mozilla/4.0(compatible;MSIE6.0;WindowsNT 5.1;SV1)\r\n\r\n″。
for example, the request loading processor may receive http information entered by the user as follows:
GET/testbfe.php HTTP/1.1Host:db-testing-oped3001.db01.baidu.com:8901User-Agent:Mozilla/5.0(windows NT 5.1;rv:3.0)Gecko/20100101FireFox/13.0.1Accept-Encoding:gzip,deflateConnection:keep-aliveCookie:BAIDU=ABEE505768E4367875D6382A71939FEB:FG=1;BDUT=tbjh0EB0DD6C71BB689AC4C1C1307CFDB346138b7d734011;USERID=0cac808c2ebd401391dc4d87;Hm_lvt_t46af353ab5a92ddf70d8368b2529c10=1342609618035;Hm_lvt_e7617bc79ca305e55d9b5d393123de33=1341297466246;6a05b31484fdc3f8a9edb6307d81ef7a=706f5996fac620d8aa113313a034898a0881a5d4%3A4%3A%7Bi%3A0%3Bs%3A5%3A5%3A%22admin%22%3Bi%3A1%3Bs%3A5%3A%22admin%22%3Bi%3A2%3Bi%3A2592000%3Bi%3A3%3Ba3A0%3A%7B%7D%7D;UUAPTGC=TGT-602800-EOC3dchi70EyurqslcFYCKJlzaNuPFImGqsprpFoIB6N7RfbEF-vvap
step 202, the response playback processor stores the received http request, forwards the http request to the web server, and receives response information returned by the web server; the response playback processor and the request loading processor store the response information and the corresponding relation between the response information and the http request.
Specifically, the user sets a switch in advance in the response playback processor, the switch being used to control the operation mode of the response playback processor, and the switch may be implemented by setting an attribute of the response playback processor, for example, when a field value of status in the attribute of the response playback processor is set to 1, the operation mode of the response playback processor is a recording mode, the information recording function is turned on, when a field value of status in the attribute of the response playback processor is set to 0, the operation mode of the response playback processor is a playback mode, and the information playback function is turned on.
When the operation mode of the response playback processor is set to the recording mode, recording of response information is required, and as shown in fig. 3, the specific recording process of response information is as follows:
firstly, a response playback processor receives an http request, wherein the http request can be an http request sent by a request loading processor; the request loading processor can send the generated http request to the response playback processor according to the IP address and the port, a plurality of request loading processors can send the http request to the response playback processor in sequence, and a plurality of request loading processors can also send the http request to the response playback processor at the same time; alternatively, the user may send an http request to the replay handler via the browser, so that the http request received by the replay handler is an http request sent by the browser.
Then, on one hand, the response playback processor saves the received http request to a local request file, wherein when the response playback processor saves the received http request, the response playback processor needs to save the http request according to a receiving sequence; for example, after receiving the http request from the requesting loader a, the replay handler saves the http request in a request file, and then after receiving the http request from the requesting loader B, saves the http request in a request file, where the http request is located after the http request from the requesting loader a. And on the other hand, the response playback processor sequentially sends the received http requests to the corresponding web servers according to the IP addresses and ports of the web servers preset by the user and the receiving sequence of the http requests.
Finally, the web server responds after receiving the http request, constructs response information corresponding to the http request and sends the response information to the response playback processor; here, when the response playback processor sends the received http request to the web server, a serial sending mode is adopted, that is, after the response playback processor sends an http request, the response playback processor waits for receiving response information returned by the web server, and when the response information returned by the web server is received, the response playback processor sends the next http request to the web server, and so on; therefore, the response playback processor can be ensured that the received response information is the response information corresponding to the http request after the response playback processor sends the http request, so that the response playback processor can establish the corresponding relation between the http request and the response information and store the corresponding relation between the http request and the response information into a local response file; meanwhile, the response playback processor saves the received response information in the response file according to the reception order.
After the response playback processor sends all the received http requests and receives the response information corresponding to all the http requests, the recording work of the response playback processor is considered to be finished, then the recorded prompt mail is sent to the user according to the set mailbox, the user can modify the field value of status in the attribute of the response playback processor from 1 to 0, the working mode of the response playback processor is set to be a playback mode, and meanwhile, the response information stored in the response playback file of the response playback processor and the corresponding relation between the http request and the response information are copied to the request loading processor corresponding to the http request, so that the request loading processor stores the generated http request and the corresponding response information.
In the preferred embodiment, the response playback processor can record the response information only once, and can directly utilize the pre-recorded response information when the reverse proxy server is tested subsequently.
It should be noted that the above steps 201 to 202 are processes of requesting the loading processor to generate an http request and responding the playback processor to record response information, and belong to a preparation stage in a reverse proxy server test process, and a real test stage of the reverse proxy server is step 203 and step 205 described below; the http request and the response information may be generated only once and recorded once, and when the reverse proxy server is tested, the step 203 may be directly executed by directly using the http request and the response information.
Step 203, the request loading processor sends the pre-generated http request to the reverse proxy server.
Specifically, a user configures the sending frequency of the http request on the request loading processor in advance according to the test requirement; after the response playback processor records the response information, the reverse proxy server can be tested.
As shown in fig. 4, when testing the reverse proxy server, each request loading processor sends a generated http request to the reverse proxy server according to a preset http request sending frequency and a local http request generation sequence; here, there may be more than one request loading processor in the preferred embodiment, so that when the reverse proxy server is tested, some http requests sent by the request loading processors to the reverse proxy server are generated according to the request log information of the web server, and the rest http requests sent by the request loading processors to the reverse proxy server are generated according to the http information input by the user.
And step 204, the reverse proxy server forwards the received http request to the response playback processor, receives the pre-recorded response information returned by the response playback processor after receiving the http request, and forwards the response information to the corresponding request loading processor.
Specifically, as shown in fig. 4, after receiving the http request sent by the request loading processor, the reverse proxy server forwards the http request to the response playback processor, and the response playback processor finds the response information corresponding to the received http request according to the correspondence between the locally stored http request and the response information, and then returns the found response information to the reverse proxy server. Here, after receiving the http request, the reverse proxy server establishes a session channel for each http request, where the session channel is used as an interaction channel between the request loading processor, the reverse proxy server, and the response playback processor, and through the session channel, the reverse proxy server may forward the received http request to the response playback processor, then receive response information returned by the response playback processor, and send the response information to the request loading processor that sent the http request; in the process of the interaction of the http request and the response information, a session channel between the request loading processor and the reverse proxy server and a session channel between the reverse proxy server and the response playback processor exist all the time until the reverse proxy server sends the response information returned by the response playback processor to the request loading processor, namely after the complete response session is completed, the reverse proxy server releases the session channel established for the http request, and the established different session channels do not influence each other, so that the reverse proxy server is ensured to be capable of forwarding the received response information to the request loading processor corresponding to the http request corresponding to the response information.
In the preferred embodiment, the response playback processor records the real response information on the web server in advance, so that the web server is not required to send the response information to the reverse proxy server when the reverse proxy server is tested, and the response playback processor replaces the work of the web server and sends the pre-recorded response information to the reverse proxy server.
When the response playback processor sends the response information to the reverse proxy server, the response playback processor can send the response information according to a preset sending delay fixed value; or, since the response speeds of the web servers are different under different request pressures, in order to achieve that the response playback processor can better simulate the work of the web server, a user needs to configure a sending delay interval of the response information in the web server in advance according to a test requirement, after the web server receives an http request from the reverse proxy server, a specific time value can be randomly selected in the preset sending delay interval, and then the response information is sent to the reverse proxy server according to the selected specific time value as the sending delay.
Step 205, the request loading processor compares the response information received from the reverse proxy server with the locally preset response information, and obtains the test result of the reverse proxy server according to the comparison result.
Specifically, a plurality of response time periods are set in the request loading processor in advance, such as: 0-1000 ms, 1000-2000 ms, 2000-5000 ms, more than 5000 ms.
Because the request loading processor sends http requests to the reverse proxy server according to the sequence, and the reverse proxy server also forwards http requests to the response playback processor according to the sequence of receiving http requests, after receiving response information from the reverse proxy server, the request loading processor can find corresponding http requests according to the receiving sequence of the response information, then finds the response information corresponding to the http requests in the corresponding relationship between the locally stored http requests and the response information, compares the found response information with the response information received from the reverse proxy server, and judges whether the information in the two response information is the same.
If the information in the two response messages is different, the response messages forwarded by the reverse proxy server are not in accordance with expectations, and the function of the reverse proxy server is abnormal, so that an alarm mail aiming at the abnormality needs to be sent to a preset user mailbox to alarm a user, so that the user can debug the reverse proxy server; the alarm mail comprises the following contents: the method comprises the steps of receiving abnormal response information from a reverse proxy server, an http request corresponding to the abnormal response information, and response information corresponding to the http request stored locally.
If the information in the two response messages is the same, the response messages forwarded by the reverse proxy server are in accordance with expectations, and the function of the reverse proxy server is normal, so that the request loading processor needs to send the test report to a preset user mailbox; wherein, the test report includes the relevant function data of the reverse proxy server, and the relevant function data includes the following contents: the method comprises the steps of requesting to load the number of http requests sent by a server, the number of response information corresponding to each response time period, the average value of response time and the return value in the received response information.
After each http request is sent by the request loading processor, a corresponding timer is started, the timer is stopped until response information corresponding to the http request is received, then response time is determined according to the time of the timer, the response time period where the response time is located is judged, and then the counter value of the response time period is increased by 1. The request loading processor may also calculate an average of the response times of http requests in dependence on the determined response times. The request loading processor receives a response message, wherein a message header in the response message carries a return value of the http request, the return value refers to an http protocol state code and mainly comprises the following five types of return values: a return value of 1xx, indicating retention; a return value of 2xx indicating successful receipt of the request; the return value is 3xx, which indicates that the user needs to further refine the request to complete the request; the return value is 4xx, which represents that the user requests an error; the return value is 5xx, indicating a reverse proxy error.
To implement the above system, as shown in fig. 1, in the test system of the reverse proxy:
a request loading processor 10 for sending a pre-generated http request to a reverse proxy server 12;
the reverse proxy server 12 is configured to forward the received http request to the response playback processor 11, receive pre-recorded response information returned by the response playback processor 11 after receiving the http request, and forward the response information to the request loading processor 10;
the request loading processor 10 is further configured to compare the response information received from the reverse proxy server 12 with locally preset response information, and obtain a test result of the reverse proxy server 12 according to the comparison result.
The request loading processor 10 generates an http request in advance, specifically: the method comprises the steps of pre-storing a request log file of a web server, wherein the request log file of the web server comprises request log information of the web server; extracting fields from request log information of the web server; and filling a preset http request template by using the extracted field to generate an http request.
Or, the request loading processor 10 generates an http request in advance, specifically: receiving http information input by a user; and filling a preset http request template by using http information input by a user to generate an http request.
The response playback processor 11 records response information in advance, specifically: receiving and storing an http request sent by a request loading processor or a browser; forwarding the received http request to a web server, and receiving response information corresponding to the http request returned by the web server; and storing the response information and the corresponding relation between the response information and the http request.
The response information is preset in the request loading processor 10, and specifically includes: the request loading processor receives response information copied from the response playback processor and the corresponding relation between the response information and the http request.
Wherein, the response playback processor 11 returns the pre-recorded response information after receiving the http request, specifically: finding response information corresponding to the http request according to a corresponding relation between a preset http request and the response information; and returning the found response information to the reverse proxy server according to a preset sending delay fixed value or a random value in a sending delay interval.
The request loading processor 10 obtains the test result of the reverse proxy server according to the comparison result, and specifically includes: if the information in the two response messages is different, judging that the function of the reverse proxy server is abnormal, and sending an alarm mail to a preset user mailbox; the alarm mail comprises the following steps: receiving abnormal response information from a reverse proxy server, an http request corresponding to the abnormal response information, and response information corresponding to a local preset http request; if the information in the two response messages is the same, judging that the reverse proxy server is normal in function, and sending a test report to a preset user mailbox; the test report includes: the number of the transmitted http requests, the number of response information corresponding to each response time period, the average value of the response time, and the return value in the received response information.
The technical scheme of the invention has the following beneficial effects:
1. when the test is carried out, the online real http request and the test http request constructed by the user are combined to test the reverse proxy server, so that the reverse proxy server can be comprehensively tested.
2. The response playback processor returns response information by adopting random sending delay, and can realize on-line simulation of an on-line real web service environment, thereby ensuring that the test result of the reverse proxy server is consistent with the on-line test result.
3. When judging that the reverse proxy server is abnormal, the request loading processor can automatically give an alarm so that a tester can debug the reverse proxy server in time and the testing efficiency is improved.
4. The method can adjust the sending frequency of the http request on the request loading processor, can automatically count the average value of the response time, can automatically record the return value of the http request, and greatly improves the testing efficiency of the reverse proxy server.
5. When the reverse proxy server is tested, the http request is generated according to an on-line real request log, and the response information comes from a real web server, so that the real http request and a response environment can be simulated under the condition that various complex services do not need to be constructed on the web server and the http request does not need to be constructed manually, the time required by environment construction is greatly reduced, and the testing efficiency of the reverse proxy server is improved.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (12)

1. A method for testing a reverse proxy, the method comprising:
the request loading processor sends a pre-generated http request to the reverse proxy server;
the reverse proxy server transmits the received http request to a response playback processor, receives pre-recorded response information corresponding to the http request returned by the response playback processor after receiving the http request, and transmits the response information to the request loading processor;
the request loading processor compares response information received from the reverse proxy server with locally preset response information corresponding to the http request, and obtains a test result of the reverse proxy server according to a comparison result;
the method for recording the response information in advance by the response playback processor comprises the following steps:
the response playback processor receives and stores an http request sent by a request loading processor or a browser;
the response playback processor forwards the received http request to a web server and receives response information corresponding to the http request returned by the web server;
and the response playback processor stores the response information and the corresponding relation between the response information and the http request.
2. The method of claim 1, wherein the method for pre-generating the http request by the request loading processor is as follows:
the request loading processor stores a request log file of a web server in advance, wherein the request log file of the web server contains request log information of the web server;
a request loading processor extracts a field from request log information of the web server;
and the request loading processor fills a preset http request template by utilizing the extracted field to generate an http request.
3. The method of claim 1, wherein the method for pre-generating the http request by the request loading processor is as follows:
the request loading processor receives http information input by a user;
and the request loading processor fills a preset http request template by using http information input by a user to generate an http request.
4. The method of claim 1, wherein the method for requesting to load the preset response information in the processor comprises:
the request loading processor receives response information copied from the response playback processor and the corresponding relation between the response information and the http request.
5. The method of claim 1, wherein the method for the response playback processor to return the pre-recorded response information corresponding to the http request after receiving the http request comprises:
the response playback processor finds response information corresponding to the http request according to a corresponding relation between a preset http request and the response information;
and the response playback processor returns the found response information to the reverse proxy server according to a preset sending delay fixed value or a random value in a sending delay interval.
6. The method according to claim 1, wherein the obtaining the test result of the reverse proxy server according to the comparison result comprises:
if the information in the two response messages is different, judging that the function of the reverse proxy server is abnormal, and sending an alarm mail to a preset user mailbox; the alarm mail comprises the following steps: receiving abnormal response information from a reverse proxy server, an http request corresponding to the abnormal response information, and response information corresponding to a local preset http request;
if the information in the two response messages is the same, judging that the reverse proxy server is normal in function, and sending a test report to a preset user mailbox; the test report includes: the number of the transmitted http requests, the number of response information corresponding to each response time period, the average value of the response time, and the return value in the received response information.
7. A reverse proxy test system, comprising: a request loading processor, a reverse proxy server and a response playback processor; wherein,
the request loading processor is used for sending a pre-generated http request to the reverse proxy server;
the reverse proxy server is used for forwarding the received http request to the response playback processor, receiving the response information corresponding to the http request, which is pre-recorded and returned by the response playback processor after the response playback processor receives the http request, and forwarding the response information to the request loading processor;
the request loading processor is also used for comparing the response information received from the reverse proxy server with locally preset response information corresponding to the http request, and obtaining a test result of the reverse proxy server according to a comparison result;
the response playback processor records response information in advance, specifically:
the response playback processor receives and stores an http request sent by a request loading processor or a browser;
the response playback processor forwards the received http request to a web server and receives response information corresponding to the http request returned by the web server;
and the response playback processor stores the response information and the corresponding relation between the response information and the http request.
8. The system according to claim 7, wherein the request loading processor pre-generates an http request, specifically:
the method comprises the steps of pre-storing a request log file of a web server, wherein the request log file of the web server comprises request log information of the web server;
extracting fields from request log information of the web server;
and filling a preset http request template by using the extracted field to generate an http request.
9. The system according to claim 7, wherein the request loading processor pre-generates an http request, specifically:
receiving http information input by a user;
and filling a preset http request template by using http information input by a user to generate an http request.
10. The system of claim 7, wherein the response information is preset in the request loading processor, and specifically:
the request loading processor receives response information copied from the response playback processor and the corresponding relation between the response information and the http request.
11. The system according to claim 7, wherein the response playback processor returns pre-recorded response information corresponding to the http request after receiving the http request, specifically:
finding response information corresponding to the http request according to a corresponding relation between a preset http request and the response information;
and returning the found response information to the reverse proxy server according to a preset sending delay fixed value or a random value in a sending delay interval.
12. The system of claim 7, wherein the request loading processor obtains the test result of the reverse proxy server according to the comparison result, and specifically comprises:
if the information in the two response messages is different, judging that the function of the reverse proxy server is abnormal, and sending an alarm mail to a preset user mailbox; the alarm mail comprises the following steps: receiving abnormal response information from a reverse proxy server, an http request corresponding to the abnormal response information, and response information corresponding to a local preset http request;
if the information in the two response messages is the same, judging that the reverse proxy server is normal in function, and sending a test report to a preset user mailbox; the test report includes: the number of the transmitted http requests, the number of response information corresponding to each response time period, the average value of the response time, and the return value in the received response information.
CN201210431552.9A 2012-11-01 2012-11-01 A kind of test method and system of reverse proxy Active CN103795762B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210431552.9A CN103795762B (en) 2012-11-01 2012-11-01 A kind of test method and system of reverse proxy

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210431552.9A CN103795762B (en) 2012-11-01 2012-11-01 A kind of test method and system of reverse proxy

Publications (2)

Publication Number Publication Date
CN103795762A CN103795762A (en) 2014-05-14
CN103795762B true CN103795762B (en) 2019-07-02

Family

ID=50671042

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210431552.9A Active CN103795762B (en) 2012-11-01 2012-11-01 A kind of test method and system of reverse proxy

Country Status (1)

Country Link
CN (1) CN103795762B (en)

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105988917B (en) * 2015-02-26 2020-08-04 小米科技有限责任公司 Abnormal information acquisition method and device
CN105450476B (en) * 2015-12-07 2019-03-19 北京先进数通信息技术股份公司 A kind of regression test system and test method
CN105959179B (en) * 2016-06-08 2019-02-05 微梦创科网络科技(中国)有限公司 A reverse proxy nginx test system and method
CN106209995B (en) * 2016-06-29 2019-11-12 武汉斗鱼网络科技有限公司 A WEB development and debugging system and method based on reverse proxy server
CN106802864A (en) * 2016-12-30 2017-06-06 中国银联股份有限公司 A kind of method of testing and device based on financial sector
CN107040433A (en) * 2017-05-10 2017-08-11 福建网龙计算机网络信息技术有限公司 A kind of automated testing method and system
CN107480179B (en) * 2017-07-04 2020-06-16 阿里巴巴集团控股有限公司 Detection method and device and electronic equipment
CN108111345B (en) * 2017-12-19 2021-04-13 易知成都数据服务有限公司 Visual reverse proxy configuration and test method
CN109960647A (en) * 2017-12-26 2019-07-02 腾讯科技(深圳)有限公司 A kind of method for testing software and device calculate equipment and storage medium
CN109743302A (en) * 2018-12-24 2019-05-10 中电福富信息科技有限公司 A kind of audit playback system of https/http agreement
CN109525679A (en) * 2019-01-08 2019-03-26 郑州云海信息技术有限公司 A kind of web file server test method based on http protocol
CN110691133B (en) * 2019-09-29 2020-11-24 河南信大网御科技有限公司 Web service mimicry system and method applied to network communication equipment
CN113381976B (en) * 2021-05-11 2022-06-24 北京丁牛科技有限公司 Smuggling attack testing method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1805381A (en) * 2005-01-13 2006-07-19 中兴通讯股份有限公司 Multi-network element emulation test system and implementation method
CN1848777A (en) * 2006-01-19 2006-10-18 华为技术有限公司 A protocol simulation test device
WO2008137522A3 (en) * 2007-05-04 2010-05-20 Sitespect, Inc. Method and system for testing variations of website content
CN102684934A (en) * 2011-03-17 2012-09-19 阿里巴巴集团控股有限公司 Method and system for monitoring property of web application program and web server

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7925692B2 (en) * 2007-01-15 2011-04-12 Microsoft Corporation Method and system for testing internet software

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1805381A (en) * 2005-01-13 2006-07-19 中兴通讯股份有限公司 Multi-network element emulation test system and implementation method
CN1848777A (en) * 2006-01-19 2006-10-18 华为技术有限公司 A protocol simulation test device
WO2008137522A3 (en) * 2007-05-04 2010-05-20 Sitespect, Inc. Method and system for testing variations of website content
CN102684934A (en) * 2011-03-17 2012-09-19 阿里巴巴集团控股有限公司 Method and system for monitoring property of web application program and web server

Also Published As

Publication number Publication date
CN103795762A (en) 2014-05-14

Similar Documents

Publication Publication Date Title
CN103795762B (en) A kind of test method and system of reverse proxy
CN104767775B (en) Web application information push method and system
CN103428042B (en) Server is carried out the method and system of stress test
CN105991412B (en) Information push method and device
US20080144655A1 (en) Systems, methods, and computer program products for passively transforming internet protocol (IP) network traffic
CN110798471A (en) Air conditioner management method and related device
CN106201794B (en) A kind of detection method and device of server
CN105306534A (en) Information verification method based on open platform and open platform
CN108809890A (en) Leak detection method, test server and client
CN109783357A (en) The method and device of test application program, computer equipment, storage medium
CN112988485A (en) Simulation test method and device for power Internet of things equipment
CN111711544B (en) Link dial testing method and device, electronic equipment and storage medium
CN103607476A (en) System and method for distributed multi-stage persistence of huge number of messages
US8880108B2 (en) Short message processing method and apparatus
US20200366967A1 (en) Method and system for monitoring quality of streaming media
CN102571575A (en) Session information creation method, device and system
CN105450479A (en) Method and apparatus for monitoring module
CN111930548B (en) Fault simulation system for multi-cluster distributed service
CN104539478A (en) Pressure test device and method for instant communication system
CN105721274B (en) Method and device for integrating multiple instant messaging
CN105554569B (en) A kind of method, apparatus and system monitoring Key Quality Indicator
CN104468771B (en) The determination method and device in geographical location
CN109831335B (en) Data monitoring method, monitoring terminal, storage medium and data monitoring system
CN108737350B (en) Information processing method and client
CN105681291A (en) Method and system for realizing unified authentication of multiple clients

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
EXSB Decision made by sipo to initiate substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant