Summary of the invention
The object of the present invention is to provide and a kind ofly can realize the autosynchronous implementation method by CDN downloaded resources of data and device, server, client.
First aspect, the invention provides a kind of implement device by CDN downloaded resources, comprising:
Blocking module, for tackling the raw page data that source server sends to client; Described raw page data includes the address information of described source server and the static resource address information at described source server;
Modified module, for static resource in the raw page data of interception to be adjusted to the chained address pointing to corresponding CDN server in the address information of described source server, obtains amended web data; Wherein, the address information of described source server and the static resource address information at described source server is carried in described chained address;
Sending module, for amended web data is sent to client, downloads corresponding static resource to make described client from the CDN server of correspondence.
Optionally, described modified module is used for static resource in the raw page data of interception to be revised as the chained address pointing to corresponding CDN server and the content-length adjusted in web data in the address information of described source server, obtains amended web data.
Optionally, described chained address also carries the reference address information of static resource, and the reference address information of described static resource obtains from described web data.
Second aspect, the invention provides a kind of client, comprising:
First receiver module, for receiving web data; In described web data, the address of static resource is the chained address pointing to CDN server, and described chained address carries address information and the address information of static resource in source server of the source server at static resource place;
Download request module, downloads corresponding static resource for the address according to static resource to corresponding CDN request;
Second receiver module, for receiving the static resource that CDN server returns.
Optionally, the static resource that CDN server returns is the address information of described CDN server according to the source server at the static resource place of carrying in described chained address, and the address information of static resource in source server is downloaded to source server.
Optionally, described chained address also carries the reference address information of static resource.
The third aspect, the invention provides a kind of server, and described server comprises:
Receiver module, for receiving the static resource download request that client is initiated according to the address of static resource in web data; In described web data, the address of static resource is the chained address pointing to CDN server, and described chained address carries address information and the address information of static resource in source server of the source server at static resource place;
Judge module, for judge the static resource download request that described first receiver module receives ask download static resource whether buffer memory;
Sending module, for judge at described judge module corresponding static resource buffer memory time, the corresponding static resource of buffer memory is sent to described client; When described judge module judges the non-buffer memory of corresponding static resource, according to the address information of the source server at the static resource place of carrying in the chained address that corresponding static resource is corresponding and the address information of static resource in source server to the corresponding static resource of corresponding source server request, buffer memory after receiving corresponding static resource is also sent to described client.
Optionally, described chained address also carries the reference address information of static resource;
Described server also comprises:
Addressed module, after judging the non-buffer memory of corresponding static resource at described judge module, described sending module according to the original address of corresponding static resource to before the corresponding static resource of corresponding source server Address requests, the address of corresponding source server is extracted from the chained address of correspondence, when the address failure of extracting corresponding source server, determine the address of corresponding source server according to the reference address Referer in the chained address of correspondence.
5th aspect, the invention provides a kind of implementation method by CDN downloaded resources, wherein, comprising:
The raw page data that interception source server sends to client; Described raw page data includes the address information of described source server and the static resource address information at described source server;
Static resource in the raw page data of interception is adjusted to the chained address pointing to corresponding CDN server in the address information of described source server, obtains amended web data; Wherein, the address information of described source server and the static resource address information at described source server is carried in described chained address;
Amended web data is sent to client, from the CDN server of correspondence, downloads corresponding static resource to make described client.
Preferably, described chained address of static resource in the raw page data of interception being revised as the CDN server pointing to correspondence in the address information of described source server, obtains amended web data and comprises:
Static resource in the raw page data of interception is revised as the content-length in the chained address and adjustment web data pointing to corresponding CDN server in the address information of described source server, obtains amended web data.
Preferably, described chained address also carries the reference address information of static resource, and the reference address information of described static resource obtains from described web data.
5th aspect, the invention provides a kind of implementation method by CDN downloaded resources, comprising:
Receive web data; In described web data, the address of static resource is the chained address pointing to CDN server, and described chained address carries address information and the address information of static resource in source server of the source server at static resource place;
Corresponding static resource is downloaded to corresponding CDN server request in address according to static resource;
Receive the static resource that CDN server returns.
Optionally, the static resource that CDN server returns be described CDN server according to the address information of the source server at the static resource place of carrying in described chained address and static resource the address information in source server download to source server.
Optionally, described chained address also carries the reference address information of static resource.
6th aspect, the invention provides a kind of implementation method by CDN downloaded resources, comprising:
Receive the static resource download request that client is initiated according to the address of static resource in web data; In described web data, the address of static resource is the chained address pointing to CDN server, and described chained address carries address information and the address information of static resource in source server of the source server at static resource place;
Judge ask download static resource whether buffer memory;
If buffer memory, the corresponding static resource of buffer memory is sent to described client;
If non-buffer memory, according to the address information of the source server at the static resource place of carrying in the chained address that corresponding static resource is corresponding and the address information of static resource in source server to the corresponding static resource of corresponding source server request, buffer memory after receiving the corresponding static resource that corresponding source server returns also is sent to described client.
Optionally, described chained address also carries the reference address information of static resource;
Ask download the non-buffer memory of static resource, according to the address information of the source server at the static resource place of carrying in the chained address that corresponding static resource is corresponding and the address information of static resource in source server to before the corresponding static resource of corresponding source server request, described method also comprises: the address information extracting corresponding source server from the chained address of correspondence, when the address information failure of extracting corresponding source server, determine the address of corresponding source server according to the reference address information in the chained address of correspondence.
In the present invention, the raw page data that interception source server sends to client; Described raw page data includes the address information of described source server and the static resource address information at described source server; Static resource in the raw page data of interception is adjusted to the chained address pointing to corresponding CDN server in the address information of described source server, obtains amended web data; Wherein, the address information of described source server and the static resource address information at described source server is carried in described chained address; Amended web data is sent to client, from the CDN server of correspondence, downloads corresponding static resource to make described client.Such client can jump to corresponding CDN server request static resource, if corresponding static resource is not cached to CDN server, the address in source server of the address and static resource that can trigger the source server of CDN server indicated by chained address is initiatively to the corresponding static resource of source server request.So just achieve the active synchronization of CDN server to source server.
In specification of the present invention, describe a large amount of detail.But can understand, embodiments of the invention can be put into practice when not having these details.In some instances, be not shown specifically known method, structure and technology, so that not fuzzy understanding of this description.
Similarly, be to be understood that, to disclose and to help to understand in each inventive aspect one or more to simplify the present invention, in the description above to exemplary embodiment of the present invention, each feature of the present invention is grouped together in single embodiment, figure or the description to it sometimes.But, the method for the disclosure should not explained the following intention in reflection: namely the present invention for required protection requires feature more more than the feature clearly recorded in each claim.Or rather, as claims below reflect, all features of disclosed single embodiment before inventive aspect is to be less than.Therefore, the claims following embodiment are incorporated to this embodiment thus clearly, and wherein each claim itself is as independent embodiment of the present invention.
It will be understood by those skilled in the art that adaptively to change the module in the equipment in embodiment and they are arranged and be in one or more equipment that this embodiment is different.Module in embodiment or unit or assembly can be combined into a module or unit or assembly, and multiple submodule or subelement or sub-component can be put them in addition.Except at least some in such feature and/or process or unit is mutually exclusive part, any combination can be adopted to combine all processes of all features disclosed in this specification (comprising adjoint claim, summary and accompanying drawing) and so disclosed any method or equipment or unit.Unless expressly stated otherwise, each feature disclosed in this specification (comprising adjoint claim, summary and accompanying drawing) can by providing identical, equivalent or similar object alternative features replaces.
In addition, those skilled in the art can understand, although embodiments more described herein to comprise in other embodiment some included feature instead of further feature, the combination of the feature of different embodiment means and to be within scope of the present invention and to form different embodiments.Such as, in the following claims, the one of any of embodiment required for protection can use with arbitrary compound mode.
All parts embodiment of the present invention with hardware implementing, or can realize with the software module run on one or more processor, or realizes with their combination.It will be understood by those of skill in the art that the some or all functions that microprocessor or digital signal processor (DSP) can be used in practice to realize according to the some or all parts in the equipment of a kind of browser terminal of the embodiment of the present invention.The present invention can also be embodied as part or all equipment for performing method as described herein or device program (such as, computer program and computer program).Realizing program of the present invention and can store on a computer-readable medium like this, or the form of one or more signal can be had.Such signal can be downloaded from internet website and obtain, or provides on carrier signal, or provides with any other form.
The present invention will be described instead of limit the invention to it should be noted above-described embodiment, and those skilled in the art can design alternative embodiment when not departing from the scope of claims.In the claims, any reference symbol between bracket should be configured to limitations on claims.Word " comprises " not to be got rid of existence and does not arrange element in the claims or step.Word "a" or "an" before being positioned at element is not got rid of and be there is multiple such element.The present invention can by means of including the hardware of some different elements and realizing by means of the computer of suitably programming.In the unit claim listing some devices, several in these devices can be carry out imbody by same hardware branch.Word first, second and third-class use do not represent any order.Can be title by these word explanations.
Last it is noted that above each embodiment is only in order to illustrate technical scheme of the present invention, be not intended to limit; Although with reference to foregoing embodiments to invention has been detailed description, those of ordinary skill in the art is to be understood that: it still can be modified to the technical scheme described in foregoing embodiments, or carries out equivalent replacement to wherein some or all of technical characteristic; And these amendments or replacement, do not make the essence of appropriate technical solution depart from the scope of various embodiments of the present invention technical scheme, it all should be encompassed in the middle of the scope of claim of the present invention and specification.
Embodiment
Below in conjunction with drawings and Examples, the specific embodiment of the present invention is described in further detail.Following examples for illustration of the present invention, but are not used for limiting the scope of the invention.
As shown in Figure 1, be the schematic flow sheet of a kind of implementation method by CDN downloaded resources that one embodiment of the invention provides, the method can be performed by the functional module being positioned at source server side or the device comprising this functional module, and the method can comprise:
Step 101, the raw page data that interception source server sends to client; This raw page data includes the address information of this source server and the static resource address information at this source server.
Step 102, is adjusted to the chained address pointing to corresponding CDN server, obtains amended web data in the address information of this source server by static resource in the raw page data of interception; Wherein, the address information of described source server and the static resource address information at described source server is carried in described chained address;
Step 103, is sent to client by amended web data, downloads corresponding static resource to make client from the CDN server of correspondence.
In the embodiment of the present invention, client can jump to corresponding CDN server request static resource after receiving corresponding web data, if corresponding static resource is not cached to CDN server, the address of the source server of CDN server indicated by chained address and the address of static resource in source server can be triggered initiatively to the corresponding static resource of source server request.So just achieve the active synchronization of CDN server to source server.
Each above-mentioned step all can be accomplished in several ways, and such as step 101, can identify, tackle after recognizing web data according to the form of web data to the data that source server is sent to client; Or the data needing interception also can be registered in source server, source server is added when sending web data in web data and tackles mark accordingly, and tackle after monitoring the data with interception mark, or realize, to the interception of raw page data, will not enumerate at this by other existing modes.
Be understood that, in the embodiment of the present invention, the raw page data of indication is actual refers to that source server sends to the web data of client, " original " here two word be to distinguish with amended web data.Here the raw page data domain name that can be client input according to user, to web data corresponding to the webpage of source server request, also can be that source server is initiatively to the web data of client push.
In the specific implementation, the address information of source server may be the domain-name information of source server, or IP information, and the address information of static resource in source server may be the routing information of this static resource in source server or label information.The address information of certain source server and/or the static resource address information in source server also can show as other forms, and its concrete form can not affect enforcement of the present invention, and corresponding technical scheme also should fall into protection scope of the present invention.
In the embodiment of the present invention, the static resource of indication can be specially js, the picture of css form.
For step 102, in the specific implementation, before the address information of source server, directly can add the domain name of corresponding CDN server at static resource, add static resource to static resource in the address information of source server afterwards after the address information of source server, forms the address information in source server of address information and static resource and the chained address of sensing CDN server that carry source server.Like this after amended web data is sent to client, when client downloads static resource according to the Address requests of static resource, its download request can jump in corresponding CDN server.Understandable, in the embodiment of the present invention, the CDN server of the correspondence of indication is for object client, in general, refers to that client falls into the CDN server of its coverage, can realize like this downloading nearby.
When embody rule, in above-mentioned steps 102 except comprise static resource in the raw page data by interception to be revised as in the address information of source server point to corresponding CDN server chained address except, the process of the content-length (Content length) in the heading of adjustment web data can also be comprised.Like this, client is after receiving corresponding web data, and whether the web data that can send according to the checking of this content-length exists mistake.
When embody rule, reference address (Referer) information of static resource also may be comprised in raw page data, now in a step 102, the reference address information of static resource can also be carried in the chained address in amended web data.The benefit done like this is, when this chained address of client-requested, corresponding CDN server can obtain the reference address information determining corresponding static resource according to this chained address, if so corresponding CDN server correctly can not obtain the address information of source server in chained address, can by the address information of this reference address information determination source server.When embody rule, this reference address information can be positioned at the end of whole chained address.
When embody rule, in step 102, static resource in the raw page data of interception is adjusted in the address information of source server the chained address pointing to corresponding CDN server and can refers to the chained address of static resources all in raw page data being revised as the CDN server pointing to correspondence in the address information of source server, also only can refer to the chained address of the address information of part static resource in source server being revised as and pointing to corresponding CDN server.For the static resource that address is not modified, client, after receiving this web data, can download this part static resource directly to source server request.
On the other hand, one embodiment of the present of invention additionally provide the another kind of implementation method by CDN downloaded resources, and the method by client executing, as shown in Figure 2, can be the schematic flow sheet of the method, comprising:
Step 201, receives web data; In described web data, the address of static resource is the chained address pointing to CDN server, and described chained address carries address information and the address information of static resource in source server of the source server at static resource place;
Step 202, corresponding static resource is downloaded to corresponding CDN server request in the address according to static resource;
Step 203, receives the static resource that CDN server returns.
In the method that the embodiment of the present invention provides, when client downloads corresponding static resource according to the address of static resource to the CDN server request of correspondence, during the chained address of i.e. this sensing CDN server of request access, its access request can be jumped in CDN server, CDN server the address information in source server can be downloaded corresponding static resource and be cached to CDN server according to the address information of the source server at the static resource place of carrying in chained address and static resource from server, such one side, can realize downloading nearby by CDN server, can make on the other hand CDN server according to the address information of source server and static resource the address information in source server initiatively to the static resource of the non-buffer memory of source server request, what CDN server can be made automatically to realize with source server is synchronous.
Here the web data that received web data can obtain for the step 102 in Fig. 1.Accordingly, the chained address in web data here also can carry the reference address information of static resource.The implementation procedure of each step in step 201-step 203 can be corresponding to prior art process consistent, do not repeat them here.
Again on the one hand, one embodiment of the present of invention additionally provide another implementation method downloaded by CDN, and the method can be performed by CDN server, as shown in Figure 3, are the schematic flow sheet of the method, comprise:
Step 301, receives the static resource download request that client is initiated according to the address of static resource in web data; The static resource download request that this web data can be oestrused according to the address of static resource for client in the step 202 in Fig. 2 when corresponding static resource is downloaded in corresponding CDN server request, accordingly, now in web data, the address of static resource is the chained address pointing to CDN server, and chained address carries address information and the address information of static resource in source server of the source server at static resource place;
Step 302, judge ask download static resource whether buffer memory; If not, turn to step 303, if not, turn to step 305;
Step 303, according to the address information of the source server at the static resource place of carrying in the chained address that corresponding static resource is corresponding and the address information of static resource in source server to the corresponding static resource of corresponding source server request, rear steering step 304;
Step 304, receives buffer memory after the corresponding static resource that corresponding source server returns, rear steering step 305.
Step 305, is sent to client by the corresponding static resource of buffer memory;
In the embodiment of the present invention, after the static resource download request that reception client is initiated according to the address of static resource in web data, judge the static resource of asking whether buffer memory, if, then the corresponding resource of buffer memory is sent to client, if not, then to the corresponding static resource of source server request at corresponding static resource place, buffer memory after receiving corresponding static resource.Like this, for the static resource occurring to upgrade, CDN server can according to first for the download request of this static resource to the corresponding static resource of source server request, what automatically realize with source server is synchronous.For the static resource not occurring to upgrade, CDN server, due to having downloaded according to the flow process of above-mentioned steps 303 and step 304 before and the corresponding static resource of buffer memory, can return corresponding static resource directly to client.So just achieve the download nearby of static resource.
It is to be noted, although shown in Fig. 3 be, after the step 304, turn to the step of step 305, but in actual applications, after requesting corresponding static resource first, also first static resource can be sent to client, buffer memory more afterwards, the precedence relationship sending static resource and caching static resource to client does not affect enforcement of the present invention.
When embody rule, for the static resource received from source server, when carrying out buffer memory, using the address information of this static resource in source server as the label information of this static resource in local cache, or according to the address information of this static resource in source server, static resource can be cached to corresponding address in CDN server.Such CDN server, when receiving the download request for this static resource next time, can find out this static resource easily and be sent to client.Certainly, in actual applications, also static resource can be stored according to other mode, such as the memory address that conversion map obtains in this locality is carried out according to the rule preset in the address of this static resource in source server, be cached to this locality afterwards, or after static resource is stored into this locality, record static resource is stored in the address in source server and is stored in the corresponding relation of local address, CDN server is follow-up also can be found this static resource when receiving the download request for this static resource and be sent to client, the mode that the embodiment of the present invention provides should not be construed as the restriction to protection scope of the present invention.
When embody rule, in step 303, also should comprise the source server address information obtaining corresponding static resource place and the process obtaining the address information of static resource in source server, to send request to source server according to the address information of source server and the address information of static resource in source server afterwards and download corresponding static resource, this request comprises the address information of static resource in source server, with to the corresponding static resource of source server request.Further, in step 303, when the address information of source server is the domain name of source server, when the address information of static resource in source server is the path in source server, after path in the service of source can being placed on the domain name of source server, generate the link that is pointed to source server, and initiate download request, to download corresponding static resource to source server request for this link.
Below in conjunction with concrete application scenarios, complete embodiment of the present invention is described in detail.As shown in Figure 4, in this application scenarios, comprise source server, intercept server, client and CDN server, wherein, intercept server is deployed in the side near source server in the route between source server and client, be connected with client with source server respectively by network, CDN server is connected with client with source server respectively by network.Wherein, intercept server is here in order to perform the method described in Fig. 1, and client is in order to perform the method in Fig. 2, and CDN server, in order to perform the method in Fig. 3, supposes that its domain name of binding is www.cdn1XXX1.com; Suppose that the domain name that source server is bound is www.1XXX1.com simultaneously.Suppose in addition intercept server in the client registered in advance need the event of interception response, source server, when sending the web data needing the event of interception response corresponding, adds and tackles label accordingly in the heading of this web data.
The idiographic flow of the method can as shown in Figure 5, comprise:
Step 501, client receives the domain name www.1XXX1.com of user's input, sends access request to source server.Rear steering step 502.
Step 502, source server receives the access request that client sends, and sends web data to client.Rear steering step 503.
Suppose that source server sends to Partial Fragment in the web data of client in source file part as shown in Figure 6, wherein comprise the static resource of the picture of a css form, path link href="/bootstrap/css/bootstrap.min.css " of this static resource in source server, the reference address of this static resource is rel=" stylesheet ", and reference address is arranged in this static file after the path of source server.In addition, in the label information of this web data, carry the domain name www.1XXX1.com of source server.And suppose to carry in the label information in this web data for representing the interception mark that these web data needs are tackled.
Step 503, intercept server tackles this web data, path link href="/bootstrap/css/bootstrap.min.css " corresponding to static resource is wherein replaced with one and point to described CDN server, and comprise the domain name of source server and a chained address in the path of this static resource in source server, and revise the content-length of this web data.Rear steering step 505.
Owing to carrying interception mark in this web data, according to interception mark, intercept server can determine that this web data needs to be blocked.
The concrete form of this chained address can be
www.cdn1XXX1.com/ bootstrap/css/bootstrap.min.css? web_real_domain=
www.1XXX1.com" rel=" stylesheet "; wherein the domain name of CDN server comprises www.cdn1XXX1.com; the path/bootstrap/css/bootstrap.min.css of this static resource in source server; domain name (web_real_domain) www.1XXX1.com of source server, the reference address rel=" stylesheet " of this static information.Web data content modification in Fig. 6 can be as shown in Figure 7 after the amendment of step 504.
Step 504, amended web data is sent to client by intercept server.
Step 505, client receives the amended web data that intercept server sends.Rear steering step 506.
Step 506, is client to the address www.cdn1XXX1.com/bootstrap/css/bootstrap.min.css of the static resource in this web data? web_real_domain=www.1XXX1.com " rel=" stylesheet " initiates download request.Rear steering step 507.In actual applications, client also may need other resources in accessed web page data, such as dynamic resource etc., and these are not the contents of institute of the present invention major concern, be not also described in detail at this.Because this download request points to the link address of CDN server, then this download request can be diverted this CDN server.
Step 507, CDN server receives the download request that client sends, and to judge in own services device if not, then to turn to the whether corresponding static resource of buffer memory step 508, if so, then turn to step 512.
Concrete, CDN server extracts the path/bootstrap/css/bootstrap.min.css of this static resource in source server from the chained address of this static resource of request, judges self whether buffer memory corresponding static resource in this path.
Step 508, the chained address www.1XXX1.com of CDN server extraction source server from the chained address of this static resource of request, and the path/bootstrap/css/bootstrap.min.css of this static resource in source server.Rear steering step 509.
If if could not successfully " from the chained address of this static resource of request the chained address of extraction source server " in step 508, then can extract the reference address rel=" stylesheet " of this static resource, obtain the chained address of source server afterwards according to this reference address.
Step 509, CDN server generates one for the link www.1XXX1.com/bootstrap/css/bootstrap.min.css to this static resource of source server request, concurrent the download request for this link.Rear steering step 510.
Step 510, source server receives the download request that CDN sends, and extracts the path bootstrap/css/bootstrap.min.css of static resource in source server asked, the static resource stored under this path is sent to CDN server.Rear steering step 511.
Step 511, CDN server receives the static resource that source server sends, under this static resource being stored in the path of bootstrap/css/bootstrap.min.css.Rear steering step 512.
Step 512, the static resource of buffer memory is sent to client by CDN server.
So far, complete the process that static resource is downloaded by CDN server, if this static resource is the static resource occurring to upgrade, be so no in the judged result of step 507, CDN server is voluntarily to this static resource of source server request, in this way, the automatic synchronization of the static resource of renewal is achieved.In subsequent process, if the download request having other client to initiate for this static resource again, according to above-mentioned flow process, can be yes in the judged result of step 507, directly jump to step 512, the static resource of buffer memory is sent to client.The download nearby of static resource is so just achieved by CDN server.
The structural representation of a kind of implement device by CDN downloaded resources that Fig. 8 provides for one embodiment of the invention, what this embodiment provided can be used as intercept server by the implement device of CDN downloaded resources is applied in the method shown in Fig. 5, this device can comprise: blocking module 801, modified module 802 and sending module 803, wherein
Blocking module 801, for tackling the raw page data that source server sends to client; Described raw page data includes the address information of described source server and the static resource address information at described source server;
Modified module 802, for static resource in the raw page data of interception to be adjusted to the chained address pointing to corresponding CDN server in the address information of described source server, obtains amended web data; Wherein, the address information of described source server and the static resource address information at described source server is carried in described chained address;
Sending module 803, for amended web data is sent to client, downloads corresponding static resource to make described client from the CDN server of correspondence.
The implement device by CDN downloaded resources that the present embodiment provides, the raw page data that interception source server sends to client; Described raw page data includes the address information of described source server and the static resource address information at described source server; Static resource in the raw page data of interception is adjusted to the chained address pointing to corresponding CDN server in the address information of described source server, obtains amended web data; Wherein, the address information of described source server and the static resource address information at described source server is carried in described chained address; Amended web data is sent to client, from the CDN server of correspondence, downloads corresponding static resource to make described client.Such client can jump to corresponding CDN server request static resource, if corresponding static resource is not cached to CDN server, the address in source server of the address and static resource that can trigger the source server of CDN server indicated by chained address is initiatively to the corresponding static resource of source server request.So just achieve the active synchronization of CDN server to source server.
It is pointed out that the implement device by CDN downloaded resources itself that the embodiment of the present invention provides can be a functional module or the device for having corresponding function.Such as in actual applications, this device itself can be a functional module of source server or CDN server.
During embody rule, modified module 802 may be used for static resource in the raw page data by interception and is revised as the content-length in the chained address and adjustment web data pointing to corresponding CDN server in the address information of described source server, obtains amended web data.
During embody rule, above-mentioned chained address also carries the reference address information of static resource, and the reference address information of described static resource obtains from described web data.
One embodiment of the present of invention additionally provide a kind of client, and as shown in Figure 9, this client comprises the first receiver module 901, download request module 902 and the second receiver module 903, wherein,
First receiver module 901, for receiving web data; In described web data, the address of static resource is the chained address pointing to CDN server, and described chained address carries address information and the address information of static resource in source server of the source server at static resource place;
Download request module 902, downloads corresponding static resource for the address according to static resource to corresponding CDN request;
Second receiver module 903, for receiving the static resource that CDN server returns.
When the client that the embodiment of the present invention provides downloads corresponding static resource according to the address of static resource to the CDN server request of correspondence, during the chained address of i.e. this sensing CDN server of request access, its access request can be jumped in CDN server, CDN server the address information in source server can be downloaded corresponding static resource and be cached to CDN server according to the address information of the source server at the static resource place of carrying in chained address and static resource from server, such one side, can realize downloading nearby by CDN server, can make on the other hand CDN server according to the address information of source server and static resource the address information in source server initiatively to the static resource of the non-buffer memory of source server request, what CDN server can be made automatically to realize with source server is synchronous.
In some instances, the static resource that CDN server returns be described CDN server according to the address information of the source server at the static resource place of carrying in described chained address and static resource the address information in source server download to source server.
When embody rule, chained address here also carries the reference address information of static resource.
One embodiment of the present of invention additionally provide a kind of CDN server, and as shown in Figure 10, server comprises receiver module 1001, judge module 1002 and sending module 1003, wherein,
Receiver module 1001, for receiving the static resource download request that client is initiated according to the address of static resource in web data; In described web data, the address of static resource is the chained address pointing to CDN server, and described chained address carries address information and the address information of static resource in source server of the source server at static resource place;
Judge module 1002, for judge the static resource download request that the first receiver module 1001 receives ask download static resource whether buffer memory;
Sending module 1003, for judge at judge module 1002 corresponding static resource buffer memory time, the corresponding static resource of buffer memory is sent to described client; When judge module 1002 judges the non-buffer memory of corresponding static resource, according to the address information of the source server at the static resource place of carrying in the chained address that corresponding static resource is corresponding and the address information of static resource in source server to the corresponding static resource of corresponding source server request, buffer memory after receiving corresponding static resource is also sent to described client.
The CDN server that the embodiment of the present invention provides, after the static resource download request that reception client is initiated according to the address of static resource in web data, judge the static resource of asking whether buffer memory, if, then the corresponding resource of buffer memory is sent to client, if not, then to the corresponding static resource of source server request at corresponding static resource place, buffer memory after receiving corresponding static resource.Like this, for the static resource occurring to upgrade, CDN server can according to first for the download request of this static resource to the corresponding static resource of source server request, what automatically realize with source server is synchronous.
Optionally, above-mentioned chained address also carries the reference address information of static resource;
This CDN server also comprises:
Addressed module 1004, after judging the non-buffer memory of corresponding static resource at judge module 1002, sending module 1003 according to the original address of corresponding static resource to before the corresponding static resource of corresponding source server Address requests, the address of corresponding source server is extracted from the chained address of correspondence, when the address failure of extracting corresponding source server, determine the address of corresponding source server according to the reference address Referer in the chained address of correspondence.
Embodiments of the invention disclose:
A1, a kind of implement device by CDN downloaded resources, is characterized in that, comprising:
Blocking module, for tackling the raw page data that source server sends to client; Described raw page data includes the address information of described source server and the static resource address information at described source server;
Modified module, for static resource in the raw page data of interception to be adjusted to the chained address pointing to corresponding CDN server in the address information of described source server, obtains amended web data; Wherein, the address information of described source server and the static resource address information at described source server is carried in described chained address;
Sending module, for amended web data is sent to client, downloads corresponding static resource to make described client from the CDN server of correspondence.
A2, device as described in claim A1, it is characterized in that, described modified module, specifically for static resource in the raw page data of interception is revised as the chained address pointing to corresponding CDN server and the content-length adjusted in web data in the address information of described source server, obtain amended web data.
A3, device as described in claim A1, it is characterized in that, described chained address also carries the reference address information of static resource, and the reference address information of described static resource obtains from described web data.
B4, a kind of client, is characterized in that, comprising:
First receiver module, for receiving web data; In described web data, the address of static resource is the chained address pointing to CDN server, and described chained address carries address information and the address information of static resource in source server of the source server at static resource place;
Download request module, downloads corresponding static resource for the address according to static resource to corresponding CDN request;
Second receiver module, for receiving the static resource that CDN server returns.
B5, client as described in claim B4, it is characterized in that, the static resource that CDN server returns is the address information of described CDN server according to the source server at the static resource place of carrying in described chained address, and the address information of static resource in source server is downloaded to source server.
B6, client as described in claim B4, it is characterized in that, described chained address also carries the reference address information of static resource.
C7, a kind of server, is characterized in that, described server comprises:
Receiver module, for receiving the static resource download request that client is initiated according to the address of static resource in web data; In described web data, the address of static resource is the chained address pointing to CDN server, and described chained address carries address information and the address information of static resource in source server of the source server at static resource place;
Judge module, for judge the static resource download request that described first receiver module receives ask download static resource whether buffer memory;
Sending module, for judge at described judge module corresponding static resource buffer memory time, the corresponding static resource of buffer memory is sent to described client; When described judge module judges the non-buffer memory of corresponding static resource, according to the address information of the source server at the static resource place of carrying in the chained address that corresponding static resource is corresponding and the address information of static resource in source server to the corresponding static resource of corresponding source server request, buffer memory after receiving corresponding static resource is also sent to described client.
C8, server as described in claim C7, it is characterized in that, described chained address also carries the reference address information of static resource;
Described server also comprises:
Addressed module, after judging the non-buffer memory of corresponding static resource at described judge module, described sending module according to the original address of corresponding static resource to before the corresponding static resource of corresponding source server Address requests, the address of corresponding source server is extracted from the chained address of correspondence, when the address failure of extracting corresponding source server, determine the address of corresponding source server according to the reference address Referer in the chained address of correspondence.
D9, a kind of implementation method by CDN downloaded resources, is characterized in that, comprising:
The raw page data that interception source server sends to client; Described raw page data includes the address information of described source server and the static resource address information at described source server;
Static resource in the raw page data of interception is adjusted to the chained address pointing to corresponding CDN server in the address information of described source server, obtains amended web data; Wherein, the address information of described source server and the static resource address information at described source server is carried in described chained address;
Amended web data is sent to client, from the CDN server of correspondence, downloads corresponding static resource to make described client.
D10, method as described in claim D9, is characterized in that, describedly static resource in the raw page data of interception is revised as the chained address pointing to corresponding CDN server in the address information of described source server, obtains amended web data and comprise:
Static resource in the raw page data of interception is revised as the content-length in the chained address and adjustment web data pointing to corresponding CDN server in the address information of described source server, obtains amended web data.
D11, method as described in claim D9, it is characterized in that, described chained address also carries the reference address information of static resource, and the reference address information of described static resource obtains from described web data.
E12, a kind of implementation method by CDN downloaded resources, is characterized in that, comprising:
Receive web data; In described web data, the address of static resource is the chained address pointing to CDN server, and described chained address carries address information and the address information of static resource in source server of the source server at static resource place;
Corresponding static resource is downloaded to corresponding CDN server request in address according to static resource;
Receive the static resource that CDN server returns.
E13, as required the method as described in E12, to it is characterized in that,
The static resource that CDN server returns be described CDN server according to the address information of the source server at the static resource place of carrying in described chained address and static resource the address information in source server download to source server.
E14, as described in claim E12 method, it is characterized in that, described chained address also carries the reference address information of static resource.
F15, a kind of implementation method by CDN downloaded resources, is characterized in that, comprising:
Receive the static resource download request that client is initiated according to the address of static resource in web data; In described web data, the address of static resource is the chained address pointing to CDN server, and described chained address carries address information and the address information of static resource in source server of the source server at static resource place;
Judge ask download static resource whether buffer memory;
If buffer memory, the corresponding static resource of buffer memory is sent to described client;
If non-buffer memory, according to the address information of the source server at the static resource place of carrying in the chained address that corresponding static resource is corresponding and the address information of static resource in source server to the corresponding static resource of corresponding source server request, buffer memory after receiving the corresponding static resource that corresponding source server returns also is sent to described client.
F16, method as described in claim F15, it is characterized in that, described chained address also carries the reference address information of static resource;
Ask download the non-buffer memory of static resource, according to the address information of the source server at the static resource place of carrying in the chained address that corresponding static resource is corresponding and the address information of static resource in source server to before the corresponding static resource of corresponding source server request, described method also comprises: the address information extracting corresponding source server from the chained address of correspondence, when the address information failure of extracting corresponding source server, determine the address of corresponding source server according to the reference address information in the chained address of correspondence.