Summary of the invention
For the machine conductively-closed sending test request when testing web page quality in correlation technique, cause the problem that cannot test, at present effective solution is not yet proposed, for this reason, fundamental purpose of the present invention is to provide a kind of method and apparatus sending web access requests, to solve the problem.
To achieve these goals, according to an aspect of the present invention, provide a kind of method sending web access requests, the method comprises: the test request receiving test website, wherein, carry testing time in described test request, circulation performs following step, until the number of the request of access generated equals described testing time; Generate the first request of access of access first webpage; After the Preset Time of interval, generate the second request of access of access second webpage; Wherein, described request of access comprises described first request of access and described second request of access, and when circulating execution above-mentioned steps, the value of the described Preset Time in each circulation is incomplete same, and described first webpage and described second webpage belong to described website.
Further, after the first request of access generating access first webpage, described method also comprises: use the described Preset Time that function generator generates; Or from tables of data, reading described Preset Time according to cycle index, preserve the corresponding relation of multiple described Preset Time and described cycle index in described tables of data, the value of described multiple described Preset Time is variant.
Further, the described Preset Time using function generator to generate comprises: according to Preset Time R described in following formulae discovery, wherein, described formula is: R=(1+s) * b, described b is the default time period, s ∈ [0,1], described s are the decimal that described function generator generates.
Further, described request of access is the request of the webpage downloaded on described website.
Further, after described first request of access of generation or described second request of access, described first request of access or described second request of access are sent to the Website server of described website.
To achieve these goals, according to a further aspect in the invention, provide a kind of device sending web access requests, this device comprises: processing module, for receiving the test request of test website, wherein, in described test request, carry testing time, circulation performs following step, until the number of the request of access generated equals described testing time; First generation module, for generating the first request of access of access first webpage; Second generation module, for after the Preset Time of interval, generates the second request of access of access second webpage; Wherein, described request of access comprises described first request of access and described second request of access, and when circulating execution above-mentioned steps, the value of the described Preset Time in each circulation is incomplete same, and described first webpage and described second webpage belong to described website.
Further, described device also comprises: the 3rd generation module, for after the first request of access generating access first webpage, uses the described Preset Time that function generator generates; Or the 4th generation module, for after the first request of access generating access first webpage, from tables of data, described Preset Time is read according to cycle index, preserve the corresponding relation of multiple described Preset Time and described cycle index in described tables of data, the value of described multiple described Preset Time is variant.
Further, described 3rd generation module comprises: generate submodule, for according to Preset Time R described in following formulae discovery, wherein, described formula is: R=(1+s) * b, and described b is the default time period, s ∈ [0,1], described s are the decimal that described function generator generates.
Further, described request of access is the request of the webpage downloaded on described website.
Further, described device also comprises sending module, for after described first request of access of generation or described second request of access, described first request of access or described second request of access is sent to the Website server of described website.
Adopt the present invention, in the process that website is tested, after the first request of access sent by terminal, certain interval of time (Preset Time namely in above-described embodiment), and then generate the second request of access, and, after each generation first request of access, the Preset Time at interval is incomplete same, thus between the request of access that terminal is sent to webpage, there is the time interval, and the interval that same terminal sends request of access is incomplete same, also the request of access namely sent uses different frequencies in time, Website server does not have the ability of the request of access differentiating interval different time.By the embodiment of the present invention, solve the machine conductively-closed frequently sending test request when web page quality is tested, cause the problem that cannot test, achieve and same terminal can be used to send multiple request of access with the effect of testing webpage.
Embodiment
The present invention program is understood better in order to make those skilled in the art person, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the embodiment of a part of the present invention, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, should belong to the scope of protection of the invention.
It should be noted that, term " first ", " second " etc. in instructions of the present invention and claims and above-mentioned accompanying drawing are for distinguishing similar object, and need not be used for describing specific order or precedence.Should be appreciated that the data used like this can be exchanged in the appropriate case, so as embodiments of the invention described herein can with except here diagram or describe those except order implement.In addition, term " comprises " and " having " and their any distortion, intention is to cover not exclusive comprising, such as, contain those steps or unit that the process of series of steps or unit, method, system, product or equipment is not necessarily limited to clearly list, but can comprise clearly do not list or for intrinsic other step of these processes, method, product or equipment or unit.
Fig. 1 is the process flow diagram of the method for transmission web access requests according to the embodiment of the present invention, and the method comprises the steps: as shown in Figure 1
Step S102, receives the test request of test website.
Wherein, testing time is carried in test request.After receiving test request, circulation performs following step, until the number of the request of access generated equals testing time.
Step S104, generates the first request of access of access first webpage.
Step S106, after the Preset Time of interval, generates the second request of access of access second webpage.
Wherein, request of access comprises the first request of access and the second request of access, and when circulating execution above-mentioned steps, the value of the Preset Time in each circulation is incomplete same, and the first webpage and the second webpage belong to website.
Particularly, the value of the Preset Time in all cyclings is incomplete same.
Adopt the embodiment of the present invention, in the process that website is tested, after the first request of access sent by terminal, certain interval of time (Preset Time namely in above-described embodiment), and then generate the second request of access, and, after each generation first request of access, the Preset Time at interval is incomplete same, thus between the request of access that terminal is sent to webpage, there is the time interval, and the interval that same terminal sends request of access is incomplete same, also the request of access namely sent uses different frequencies in time, Website server does not have the ability of the request of access differentiating interval different time.By the embodiment of the present invention, solve the machine conductively-closed frequently sending test request when web page quality is tested, cause the problem that cannot test, achieve and same terminal can be used to send multiple request of access with the effect of testing webpage.
In the above-described embodiments, can comprise the URL of tested webpage, testing time to tested webpage in test request, e.g., test request is: the test sending 10,000 times to Baidu (www.baidu.com).Terminal then generates 10,000 request of access according to this test request.
Such as, this request of access can be the request of downloading web pages, and the request of access generated in test process can be the request of accessing different webpages, but different webpages belongs to same website.
In the process of two webpages of download site; one is had to suspend mechanism (namely above-mentioned interval Preset Time); utilize this mechanism to suspend to send request to server, after namely suspending the regular hour, then send next request to Website server.
As shown in Figure 2, above-described embodiment can comprise the steps:
Step S202: download the first webpage.
Particularly, first send request of access (first request of access namely in above-described embodiment) to server, download previous webpage (i.e. the first webpage).
Step S204: suspend and download.
Particularly, after having downloaded previous webpage, time-out has been sent next request of access to same Website server by system, the time out of this part and above-mentioned Preset Time.
Step S206: download the second webpage.
After time-out after a while, recur to Website server and send next request of access (the second request of access namely in above-described embodiment), download a rear webpage.
According to the above embodiment of the present invention, after the first request of access generating access first webpage, method can also comprise: use the Preset Time that function generator generates; Or from tables of data, reading Preset Time according to cycle index, preserve the corresponding relation of multiple Preset Time and cycle index in tables of data, the value of multiple Preset Time is variant.
Tables of data can be the time and cycle index that preset.Table 1 shows a kind of form of tables of data:
Table 1
Cycle index |
Preset Time (unit: ms) |
1 |
50 |
2 |
55 |
3 |
60 |
4 |
70 |
5 |
75 |
6 |
65 |
7 |
60 |
As shown in table 1, can read Preset Time according to cycle index, as at first time circulation time, Preset Time is 50ms, second time circulation time, and Preset Time is 55ms ..., the like.
In an optional embodiment of the present invention, the Preset Time using function generator to generate can comprise: according to following formulae discovery Preset Time R, wherein, formula is: R=(1+s) * b, and b is the default time period, s ∈ [0,1], s is the decimal that function generator generates.
In this embodiment, the time interval (Preset Time namely in above-described embodiment) of presetting dynamically produces.The time interval of different time-outs may be different.First, obtain the time out parameter pre-setting a benchmark, be designated as base and (be above-mentioned b, the time period of presetting), and obtaining the random function generator (function generator namely in above-described embodiment) preset, this function generator generates the decimal random () (being the s in above-described embodiment) between 0 to 1 randomly.The formula that then each time interval interval (the Preset Time R namely in above-described embodiment) suspended generates is:
interval=(1+random())*base。
Obtain the time interval (Preset Time namely in above-described embodiment) by above-mentioned formula, size is between base and 2 times base.And then suspend the time of interval size, after treating the EOT end of timeout, then send next request to Website server.
Need to further illustrate, in above-described embodiment, after generation first request of access or the second request of access, the first request of access or the second request of access are sent to the Website server of website.
Pass through the above embodiment of the present invention, frequently send request to Website server relative to not free compartment of terrain, adopting dynamic interval can prevent from better being identified this by Website server is that program is sending request to it, suffers to be shielded the situation of closing IP.Existing Website server None-identified dynamic interval, thus dynamic interval can circumvent the detection of Website server better.
It should be noted that, can perform in the computer system of such as one group of computer executable instructions in the step shown in the process flow diagram of accompanying drawing, and, although show logical order in flow charts, but in some cases, can be different from the step shown or described by order execution herein.
Fig. 3 is the schematic diagram of the device of transmission web access requests according to the embodiment of the present invention.As shown in Figure 3, this device can comprise: processing module 10, first generation module 30 and the second generation module 50.
Wherein, processing module 10, for receiving the test request of test website, wherein, carries testing time in test request, and circulation performs following step, until the number of the request of access generated equals testing time; First generation module 30 is for generating the first request of access of access first webpage; Second generation module 50, for after the Preset Time of interval, generates the second request of access of access second webpage; Wherein, request of access comprises the first request of access and the second request of access, and when circulating execution above-mentioned steps, the value of the Preset Time in each circulation is incomplete same, and the first webpage and the second webpage belong to website.
Particularly, the value of the Preset Time in all cyclings is incomplete same.
Adopt the present invention, in the process that website is tested, after the first request of access sent by terminal, certain interval of time (Preset Time namely in above-described embodiment), and then generate the second request of access, and, after each generation first request of access, the Preset Time at interval is incomplete same, thus between the request of access that terminal is sent to webpage, there is the time interval, and the interval that same terminal sends request of access is incomplete same, also the request of access namely sent uses different frequencies in time, Website server does not have the ability of the request of access differentiating interval different time.Pass through the embodiment of the present invention, solve the machine conductively-closed frequently sending test request when web page quality being tested in prior art, cause the problem that cannot test, achieve and same terminal can be used to send multiple request of access with the effect of testing webpage.
In the above-described embodiments, can comprise the URL of tested webpage, testing time to tested webpage in test request, e.g., test request is: the test sending 10,000 times to Baidu (www.baidu.com).Terminal then generates 10,000 request of access according to this test request.
Such as, this request of access can be the request of downloading web pages, and the request of access generated in test process can be the request of accessing different webpages, but different webpages belongs to same website.
In the process of two webpages of download site; one is had to suspend mechanism (namely above-mentioned interval Preset Time); utilize this mechanism to suspend to send request to server, after namely suspending the regular hour, then send next request to Website server.
In the above embodiment of the present invention, device also comprises: the 3rd generation module, for after the first request of access generating access first webpage, uses the Preset Time that function generator generates; Or the 4th generation module, for after the first request of access generating access first webpage, from tables of data, read Preset Time according to cycle index, preserve the corresponding relation of multiple Preset Time and cycle index in tables of data, the value of multiple Preset Time is variant.
Wherein, tables of data can be the time and cycle index that preset.
In an optional embodiment of the present invention, the 3rd generation module can comprise: generate submodule, for according to following formulae discovery Preset Time R, wherein, formula is: R=(1+s) * b, and b is the default time period, s ∈ [0,1], s are the decimal that function generator generates.
In this embodiment, the time interval (Preset Time namely in above-described embodiment) of presetting dynamically produces.The time interval of different time-outs may be different.First, obtain the time out parameter pre-setting a benchmark, be designated as base and (be above-mentioned b, the time period of presetting), and obtaining the random function generator (function generator namely in above-described embodiment) preset, this function generator generates the decimal random () (being the s in above-described embodiment) between 0 to 1 randomly.The formula that then each time interval interval (the Preset Time R namely in above-described embodiment) suspended generates is:
interval=(1+random())*base。
Obtain the time interval (Preset Time namely in above-described embodiment) by above-mentioned formula, size is between base and 2 times base.And then suspend the time of interval size, after treating the EOT end of timeout, then send next request to Website server.
Request of access in the above embodiment of the present invention can be the request of the webpage in download site.
Need is that device can also comprise sending module with further illustrating, and for after generation first request of access or the second request of access, the first request of access or the second request of access is sent to the Website server of website.
The modules provided in the present embodiment is identical with the using method that the corresponding step of embodiment of the method provides, application scenarios also can be identical.It is noted, of course, that the scheme that above-mentioned module relates to can be not limited to content in above-described embodiment one and scene, and above-mentioned module may operate in terminal or mobile terminal, can pass through software or hardware implementing.
As can be seen from the above description, present invention achieves following technique effect:
Adopt the present invention, in the process that website is tested, after the first request of access sent by terminal, certain interval of time (Preset Time namely in above-described embodiment), and then generate the second request of access, and, after each generation first request of access, the Preset Time at interval is incomplete same, thus between the request of access that terminal is sent to webpage, there is the time interval, and the interval that same terminal sends request of access is incomplete same, also the request of access namely sent uses different frequencies in time, Website server does not have the ability of the request of access differentiating interval different time.Pass through the embodiment of the present invention, solve the machine conductively-closed frequently sending test request when web page quality being tested in prior art, cause the problem that cannot test, achieve and same terminal can be used to send multiple request of access with the effect of testing webpage.
Obviously, those skilled in the art should be understood that, above-mentioned of the present invention each module or each step can realize with general calculation element, they can concentrate on single calculation element, or be distributed on network that multiple calculation element forms, alternatively, they can realize with the executable program code of calculation element, thus, they can be stored and be performed by calculation element in the storage device, or they are made into each integrated circuit modules respectively, or the multiple module in them or step are made into single integrated circuit module to realize.Like this, the present invention is not restricted to any specific hardware and software combination.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, for a person skilled in the art, the present invention can have various modifications and variations.Within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.