Summary of the invention
Technical problem to be solved by this invention provides a kind of point-to-point document down loading method, server and client, with the fail safe of protection user's download.
For solving the problems of the technologies described above, the present invention provides technical scheme following:
A kind of point-to-point document down loading method comprises:
On server, set up and safeguard an illegal library;
Said server receives request that first client sends when downloading first request message of first file, judges according to said illegal library whether said first file is legal, obtains first judged result;
When said first judged result representes that said first file is legal; Said server sends the response message of the client-side information that carries second client that can supply to download said first file to said first client, makes said first client to be connected to said second client and to bring in and download said first file according to said client-side information is point-to-point;
When said first judged result represented that said first file is illegal, said server sent the message of refusal download to said first client.
Preferably, also carry control information in the said response message, said control information is the identification information of one or more Resource Block of from said first file, choosing of said server;
Said point-to-point document down loading method also comprises:
When said server receives second request message of said first client transmission; Judge according to said illegal library whether said first file is legal; Obtain second judged result; Wherein, when said second request message was said first client downloads to corresponding first Resource Block of said identification information, the request message of said first Resource Block was downloaded in the request of transmission;
When said second judged result represented that said first file is legal, said server sent the message that continues to download and arrives said first client;
When said second judged result represented that said first file is illegal, said server sent the message of refusal continuation download to said first client.
Preferably, also carry said first Resource Block in the message that said continuation is downloaded, continue from said second client downloads other Resource Block except that said first Resource Block to indicate said first client.
Preferably, the identification information that comprises illegal file in the said illegal library;
Saidly judge according to said illegal library that said first file is whether legal and be: whether the sign of judging said first file is present in the said illegal library, if, confirm that said first file is illegal, otherwise, confirm that said first file is legal.
Preferably, the identification information of said illegal file is the MD5 value of said illegal file.
Preferably, saidly on server, set up and safeguard that an illegal library comprises:
Whether said server detects file to be downloaded through detection module legal, and upgrade said illegal library according to testing result.
A kind of server comprises:
Illegal library is set up module, is used for setting up and safeguarding an illegal library;
Judge module is used for receiving request that first client sends when downloading first request message of first file at said server, judges according to said illegal library whether said first file is legal, obtains first judged result;
First respond module; Be used for when said first judged result representes that said first file is legal; Transmission is carried the response message of client-side information of second client that can supply to download said first file to said first client, makes said first client to be connected to said second client and to bring in and download said first file according to said client-side information is point-to-point;
Second respond module is used for when said first judged result representes that said first file is illegal, and the message of sending the refusal download is to said first client.
Preferably, also carry control information in the said response message, said control information is the identification information of one or more Resource Block of from said first file, choosing of said server;
Said judge module also is used for; When said server receives second request message of said first client transmission; Judge according to said illegal library whether said first file is legal, obtains second judged result, wherein; When said second request message was said first client downloads to corresponding first Resource Block of said identification information, the request message of said first Resource Block was downloaded in the request of transmission;
Said server also comprises:
The 3rd respond module is used for when said second judged result representes that said first file is legal, sends the message that continues to download and arrives said first client;
The 4th respond module is used for when said second judged result representes that said first file is illegal, and the message of sending refusal continuation download is to said first client.
Preferably, also carry said first Resource Block in the message that said continuation is downloaded, continue from said second client downloads other Resource Block except that said first Resource Block to indicate said first client.
Preferably, the identification information that comprises illegal file in the said illegal library;
Saidly judge according to said illegal library that said first file is whether legal and be: whether the sign of judging said first file is present in the said illegal library, if, confirm that said first file is illegal, otherwise, confirm that said first file is legal.
Preferably, the identification information of said illegal file is the MD5 value of said illegal file.
Preferably, said illegal library is set up in the module and is comprised:
Detection module, whether legal, and upgrade said illegal library according to testing result if being used to detect file to be downloaded.
A kind of client comprises:
Request module, first request message that is used to send request download first file is to server;
Receiver module; Be used to receive that said server sends carries the response message of the client-side information of second client that can supply to download said first file; Wherein, Said response message is said server when receiving said first request message, confirms to send under the legal situation of said first file according to illegal library;
Download module is used for when said receiver module receives said response message, is connected to said second client and brings in and download said first file according to said client-side information is point-to-point.
Preferably, also carry control information in the said response message that said receiver module receives, said control information is the identification information of one or more Resource Block of from said first file, choosing of said server;
The described request module also is used for, and when said download module downloaded to first Resource Block of said identification information correspondence, the request of transmission was downloaded second request message of said first Resource Block to said server;
Said receiver module also is used for; Receive the message of the continuation download of said server transmission; Wherein, the message that said continuation is downloaded is said server when receiving said second request message, confirms to send under the legal situation of said first file according to said illegal library;
Said download module also is used for; When said receiver module receives the message of said continuation download; If carry said first Resource Block in the message that said continuation is downloaded; Then continue from said second client downloads other Resource Block except that said first Resource Block,, then continue from said first Resource Block of said second client downloads and other Resource Block if do not carry said first Resource Block in the message that said continuation is downloaded.
Compared with prior art, the invention has the beneficial effects as follows:
Among the present invention; Server is controlled user's P2P file download process; When server receives the request message of the file in download that client sends, judge whether the request downloaded files is legal, only when the request downloaded files is legal, just can provide relevant information to supply client downloads; So, can protect the fail safe of user's download.
Because whether file legal is not unalterable, might be in process of downloading, file by legal become illegal.Therefore; In the present invention; Server can also be chosen one or more Resource Block as controll block from file, client downloads need be to the download of server requests to controll block during to controll block; Server can rejudge the legitimacy of file then, and this has further improved the fail safe of user's download.
Embodiment
For making the object of the invention, technical scheme and advantage clearer, will combine accompanying drawing and specific embodiment to describe the present invention below.
With reference to Fig. 1, the point-to-point document down loading method of the embodiment of the invention mainly comprises the steps:
Step 101: on server, set up and safeguard an illegal library;
In the P2P network, a lot of files carry invalid information, and the invalid information among the present invention mainly is meant the information of following two aspects, and one of which is based on the consideration of fail safe, as comprising wooden horse or virus in the file; Its two, based on the regulation of law or policy, as comprising yellow information, illegal speech information etc. in the file.
Said illegal library is similar to a blacklist storehouse, comprising the identification information that illegal file is arranged.For the file of client upload to server, can judge whether current file carries invalid information through the mode of manual examination and verification, carry invalid information if confirm it, then it is joined illegal library.Particularly, (Message Digest Algorithm 5 MD5) or the unique identification of other algorithm computation outfiles, and joins this identification information in the illegal library can to pass through Message Digest Algorithm 5.
MD5 is disclosed algorithm, and this algorithm as input, is exported one 128 information " fingerprint " to the information of random length.For example; Uniform resource locator (Uniform Resource Locator with file; URL), file size and file are revised the date at last and are combined into a character string in order; With the input of this character string as the MD5 algorithm, the MD5 value that will obtain through the MD5 algorithm computation is as the identification information of this document.
For the file of client upload, can also judge whether current file carries invalid information through the mode (server is provided with detection module) that detects automatically, carry invalid information if confirm it, then it is joined illegal library.For example; The mode that detects perhaps pattern recognition through keyword detects automatically; Application number discloses a kind of Sensitive Image Detection Method efficiently and system thereof for the one Chinese patent application of " 200810240942.1 "; Wherein adopted the method for pattern recognition to detect sensitive video frequency, application number has wherein adopted keyword to detect responsive text for the one Chinese patent application of " 200810239345.7 " discloses a kind of signal auditing method, Apparatus and system.Certainly, can adopt the additive method that provides in the prior art to detect automatically, the present invention does not limit the mode of automatic detection yet.
In addition, in the P2P technology, server not necessarily can storage file (the only identification information of storage file and the client-side information that can supply to download this document), therefore, also can import said illegal library from the outside.
And whether file is legal is not unalterable yet.For example, carrying out virus when detecting, because virus base is incomplete, it is legal to detect file according to this virus base, still, upgraded virus base after, it is illegal to detect this document again according to new virus base.Again for example, the information of carrying in the file is legal in certain stage, but because the change of law can be judged it again for illegal according to new law.Based on this, the present invention also dynamically updates illegal library.
Step 102: when first client need be downloaded first file, the request of transmission was downloaded first request message of first file to server;
Carry the identification information of first file in said first request message, for example the MD5 value of first file.Occasion verifying the user also carries user profile in said first request message, judges for server whether this user has the download authority.
Step 103: during said first request message that said server receives that first client sends; Judge according to said illegal library whether said first file is legal,, then get into step 104 if said first file is illegal; If said first file is legal, then get into step 105;
Saidly judge according to said illegal library that said first file is whether legal and be: whether the sign of judging said first file is present in the said illegal library, if, confirm that said first file is illegal, otherwise, confirm that said first file is legal.
In the occasion that need verify the user; Whether legal said server also can judge whether this user has the download authority according to the user profile of carrying in said first request message, if the download authority is arranged, carry out the judgement of said first file again; If do not download authority; Whether legal do not carry out the judgement of said first file, directly return error message, refusing user's is downloaded this document.
Step 104: said server sends the message of refusal download to said first client, downloads flow process and finishes;
Wherein, go back the illegal information of said first file of portability in the message that said refusal is downloaded, inform that first client does not reattempt this document is downloaded.
Step 105: said server sends the response message of the client-side information that carries second client that can supply to download said first file to said first client;
Store the identification information and the client-side information that can supply to download this document of first file in the server, the client that can supply to download said first file is meant, stores the client of said first file and current online.Server can supply to download the client of said first file according to the identification information inquiry of first file when definite said first file is legal, and Query Result is fed back to said first client.
Step 106: when said first client receives said response message, point-to-point said first file of said second client downloads that is connected to.
In the above-described embodiments; Server is controlled user's P2P file download process; When server receives the request message of the file in download that client sends, judge whether the request downloaded files is legal, only when the request downloaded files is legal, just can provide relevant information to supply client downloads; So, can protect the fail safe of user's download.
As previously mentioned and since file whether legal be not unalterable, might be in process of downloading, file by legal become illegal.Therefore; In other embodiments of the invention; Server can also be chosen one or more Resource Block as controll block from file, client downloads need be to the download of server requests to controll block during to controll block; Server can rejudge the legitimacy of file then, and this has further improved the fail safe of user's download.
The concrete realization as follows:
In step 105, also carry control information in the said response message, said control information is the identification information of one or more Resource Block (controll block) of from said first file, choosing of said server.
When the client upload file registered to server to server or with file, server can be chosen one or more Resource Block as controll block from this document.The mode of choosing is picked at random or chooses according to ad hoc fashion, for example, chooses according to fixed intervals, and promptly every separated predetermined number Resource Block is chosen a Resource Block as controll block.
The identification information of Resource Block can be the MD5 value of Resource Block, also can be Resource Block sequence number hereof.
In step 106, point-to-point said first file of said second client downloads that is connected to of said first client specifically comprises:
(1) when said first client downloads during to controll block, the request of transmission is downloaded second request message of said controll block to said server;
Said first client is during from said first file of said second client downloads; Can judge whether the current resource piece is controll block (being the corresponding Resource Block of said identification information); If; Then need download this controll block to server requests, otherwise, continue from the said second client downloads Resource Block.
When (2) said server receives said second request message, judge according to said illegal library whether said first file is legal, obtains a judged result;
Saidly judge according to said illegal library that said first file is whether legal and be: whether the sign of judging said first file is present in the said illegal library, if, confirm that said first file is illegal, otherwise, confirm that said first file is legal.
(3) when said judged result representes that said first file is legal, said server sends the message that continues to download and arrives said first client;
Wherein, the first client downloads controll block has following two kinds of implementations again:
Do not carry said controll block in the message that mode one, said continuation are downloaded, when said first client receives the message of said continuation download, continue the Resource Block that begins from said controll block from said second client downloads;
Carry said controll block in the message that mode two, said continuation are downloaded; When said first client receives the message of said continuation download; Directly from this message, obtain said controll block, and continue from said second client downloads other Resource Block except that said controll block.
(4) when said judged result representes that said first file is illegal, said server sends the message of refusal continuation download to said first client.
Below provide a concrete realization flow of the point-to-point document down loading method of the embodiment of the invention,, comprise the steps: with reference to Fig. 2
Step 201: customer end A is applied for registration of a file a to server;
Step 202: whether server verification customer end A has the authority of upload file;
Step 203: check successfully, confirm that customer end A has the authority of upload file, Md5 value and the Resource Block information of server requirement customer end A upload file a;
According to the difference of concrete implementation, in this step, server also can require customer end A upload file a.
Step 204: the verification failure, confirm that customer end A does not have the authority of upload file, server returns error message to customer end A, finishes;
Step 205: the relevant information of customer end A upload file a is to server, upload finish after, file a registers successfully;
In this step, customer end A also can be uploaded onto the server file a.
Step 206: server judges whether file a is legal, and upgrades illegal library according to judged result;
In addition, in the implementation of subsequent step, the illegal fileinfo that comprises in the illegal library also might change.
Step 207: server is chosen one or more Resource Block of file a as controll block;
Step 208: customer end B is to server requests file in download a;
Step 209: whether server verification customer end B has authority file in download a;
Step 210: when definite customer end B did not have right file in download a, server returned error message to customer end B, finished;
Step 211: when definite customer end B had authority file in download a, whether whether server is present in the said illegal library according to the MD5 value of file a was come verification file a legal;
Step 212: when definite file a was illegal, server returned error message to customer end B, finished;
Step 213: when definite file a was legal, server provided current online and stores user's (comprising customer end A) of file a to customer end B, and simultaneously said controll block information is offered customer end B;
Step 214: customer end B is connected to customer end A (or other clients) and carries out the download of file a;
Step 215: customer end B runs into controll block in the process of file in download a, downloads said controll block to server requests;
Step 216: whether server verification file a again is legal;
Step 217: when definite file a was illegal, server returned error message to customer end B, finished;
Step 218: when definite file a is legal, return said controll block to client, customer end B continues from client downloads file a.
Carry out above-mentioned steps 215-218 repeatedly, accomplish, perhaps, in downloading process, confirm to withdraw from when file a is illegal until downloading.
Below introduce the relevant device of realizing said method.
Fig. 3 is the structural representation of the server of the embodiment of the invention, and with reference to Fig. 3, said server 30 comprises:
Illegal library is set up module 31, is used for setting up and safeguarding an illegal library;
Judge module 32 is used for receiving request that first client sends when downloading first request message of first file at said server 30, judges according to said illegal library whether said first file is legal, obtains first judged result;
First respond module 33; Be used for when said first judged result representes that said first file is legal; Transmission is carried the response message of client-side information of second client that can supply to download said first file to said first client, makes said first client to be connected to said second client and to bring in and download said first file according to said client-side information is point-to-point;
Second respond module 34 is used for when said first judged result representes that said first file is illegal, and the message of sending the refusal download is to said first client.
Preferably, also carry control information in the said response message, said control information is the identification information of one or more Resource Block of from said first file, choosing of said server 30;
Said judge module 32 also is used for; When said server 30 receives second request message of said first client transmission; Judge according to said illegal library whether said first file is legal, obtains second judged result, wherein; When said second request message was said first client downloads to corresponding first Resource Block of said identification information, the request message of said first Resource Block was downloaded in the request of transmission;
Said server 30 also comprises:
The 3rd respond module (figure does not show) is used for when said second judged result representes that said first file is legal, sends the message that continues to download and arrives said first client;
The 4th respond module (figure does not show) is used for when said second judged result representes that said first file is illegal, and the message of sending refusal continuation download is to said first client.
Preferably, also carry said first Resource Block in the message that said continuation is downloaded, continue from said second client downloads other Resource Block except that said first Resource Block to indicate said first client.
Preferably, the identification information that comprises illegal file in the said illegal library;
Saidly judge according to said illegal library that said first file is whether legal and be: whether the sign of judging said first file is present in the said illegal library, if, confirm that said first file is illegal, otherwise, confirm that said first file is legal.
Preferably, the identification information of said illegal file is the MD5 value of said illegal file.
Preferably, said illegal library is set up in the module 31 and is comprised:
Detection module (figure does not show), whether legal, and upgrade said illegal library according to testing result if being used to detect file to be downloaded.Can comprise wooden horse detecting unit, text identification unit and media file detecting unit etc. in this detection module.
Fig. 4 is the structural representation of the client of the embodiment of the invention, and with reference to Fig. 4, said client 40 comprises:
Request module 41, first request message that is used to send request download first file is to server;
Receiver module 42; Be used to receive that said server sends carries the response message of the client-side information of second client that can supply to download said first file; Wherein, Said response message is said server when receiving said first request message, confirms to send under the legal situation of said first file according to illegal library;
Download module 43 is used for when said receiver module 42 receives said response message, is connected to said second client and brings in and download said first file according to said client-side information is point-to-point.
Preferably, also carry control information in the said response message that said receiver module 42 receives, said control information is the identification information of one or more Resource Block of from said first file, choosing of said server;
Described request module 41 also is used for, and when said download module 43 downloaded to first Resource Block of said identification information correspondence, the request of transmission was downloaded second request message of said first Resource Block to said server;
Said receiver module 42 also is used for; Receive the message of the continuation download of said server transmission; Wherein, the message that said continuation is downloaded is said server when receiving said second request message, confirms to send under the legal situation of said first file according to said illegal library;
Said download module 43 also is used for; When said receiver module 42 receives the message of said continuation download; If carry said first Resource Block in the message that said continuation is downloaded; Then continue from said second client downloads other Resource Block except that said first Resource Block,, then continue from said first Resource Block of said second client downloads and other Resource Block if do not carry said first Resource Block in the message that said continuation is downloaded.
In sum; Among the present invention, server is controlled user's P2P file download process, when server receives the request message of the file in download that client sends; Judge whether the request downloaded files is legal; Only when the request downloaded files is legal, just can provide relevant information to supply client downloads, so, can protect the fail safe of user's download.
Because whether file legal is not unalterable, might be in process of downloading, file by legal become illegal.Therefore; In the present invention; Server can also be chosen one or more Resource Block as controll block from file, client downloads need be to the download of server requests to controll block during to controll block; Server can rejudge the legitimacy of file then, and this has further improved the fail safe of user's download.
Should be noted that at last; Above embodiment is only unrestricted in order to technical scheme of the present invention to be described; Those of ordinary skill in the art is to be understood that; Can make amendment or be equal to replacement technical scheme of the present invention, and not break away from the spirit of technical scheme of the present invention, it all should be encompassed in the middle of the claim scope of the present invention.