Invention content
The present invention provides a kind of video request processing method and processing device, sends whether the user of request is legal to differentiateUser, to prevent stolen chain.
The present invention provides a kind of video request processing method, including:
The first request of the acquisition request video fragment address that user terminal is sent is received, first request includes userThe Internet protocol address of terminal;
Internet protocol address and preset target string in being asked according to first carry out hash calculating, obtain firstCryptographic Hash;
First cryptographic Hash and the video fragment address are sent to user terminal, wherein first cryptographic HashIt is invisible to user;
The second request of the acquisition request video fragment that user terminal is sent is received, second request includes video fragmentAddress, the Internet protocol address of user terminal and the first cryptographic Hash;
Internet protocol address and preset target string in being asked according to second carry out hash and are calculated secondCryptographic Hash;
First cryptographic Hash is compared with second cryptographic Hash;
When comparing consistent, the corresponding video fragment in video fragment address is sent to user terminal.
The advantageous effect of the present embodiment is:In the first request for receiving user terminal requests acquisition video fragment addressWhen, the first cryptographic Hash is calculated according to the Internet protocol address of user terminal and preset target string, and in userWhen terminal is according to video fragment Address requests video fragment, the Internet protocol address again according to user terminal and preset meshThe second cryptographic Hash is calculated in mark character string, when the first cryptographic Hash compares consistent with the second cryptographic Hash, is sent to user terminalVideo fragment, the i.e. user terminal when checking request video fragment address and the use according to video fragment Address requests video fragmentWhen family terminal is the same user terminal, video fragment just is sent to the terminal, to prevent stolen chain.
In one embodiment, the method further includes:
Change the character in the target string at random according to prefixed time interval.
The advantageous effect of the present embodiment is, target string is made to be changed according to prefixed time interval, to make basis shouldThe calculated cryptographic Hash of the Internet protocol address of target string and user terminal has timeliness, improves video fragmentSafety, to significantly more efficient to prevent stolen chain.
In one embodiment, the method further includes:
When comparing inconsistent, the target string before the last be modified is obtained;
According to second request in Internet protocol address and described the last time be modified before target stringIt carries out hash and third cryptographic Hash is calculated;
First cryptographic Hash is compared with the third cryptographic Hash;
When first cryptographic Hash and the third cryptographic Hash compare consistent, video fragment address is sent to user terminalCorresponding video fragment.
The advantageous effect of the present embodiment is:When comparing inconsistent, the target word before being modified with the last timeThe internet protocol address of symbol string and user terminal carries out hash and third cryptographic Hash is calculated, when third cryptographic Hash and the first HashWhen the comparison result of value is consistent, the corresponding video fragment in video fragment address still is sent to user terminal, is avoided due to firstCryptographic Hash timeliness it is too short and cause validated user request failure the case where.
In one embodiment, the method further includes:
When first cryptographic Hash and the third cryptographic Hash compare inconsistent, door chain is carried out to second requestProcessing.
The advantageous effect of the present embodiment is:When the first cryptographic Hash and third cryptographic Hash compare inconsistent, asked to secondIt asks and carries out door chain processing, avoid robber's chain and happen.
In one embodiment, described to include to the second request progress door chain processing:
Refuse to send the video fragment corresponding to the video fragment address to user terminal;
According to the internet protocol address of user terminal error message is sent to the user terminal.
The advantageous effect of the present embodiment is:The corresponding video fragment in video fragment address is sent to user by refusal,Prevent illegal user from successfully obtaining video fragment, to prevent stolen chain, pass through, error message is sent to user terminal,It is not the source address of the video to make the video address that user knows that it is accessed.
The present invention also provides a kind of video request processing units, including:
First receiving module, the first request of the acquisition request video fragment address for receiving user terminal transmission, instituteState the Internet protocol address that the first request includes user terminal;
First computing module, Internet protocol address and preset target string in being used to ask according to first carry outHash calculates, and obtains the first cryptographic Hash;
First sending module, for first cryptographic Hash and the video fragment address to be sent to user terminal,In, first cryptographic Hash is invisible to user;
Second receiving module, the second request of the acquisition request video fragment for receiving user terminal transmission, described theTwo requests include video fragment address, the Internet protocol address of user terminal and the first cryptographic Hash;
Second computing module, Internet protocol address and preset target string in being used to ask according to second carry outThe second cryptographic Hash is calculated in hash;
First comparing module, for first cryptographic Hash to be compared with second cryptographic Hash;
Second sending module, for when comparing consistent, it is broken to send the corresponding video in video fragment address to user terminalPiece.
In one embodiment, described device further includes:
Module is changed, for changing the character in the target string at random according to prefixed time interval.
In one embodiment, described device further includes:
Acquisition module, for when comparison is inconsistent, obtaining the target string before the last be modified;
Third computing module, for according to second request in Internet protocol address and described the last time be modifiedTarget string before carries out hash and third cryptographic Hash is calculated;
Second comparing module, for first cryptographic Hash to be compared with the third cryptographic Hash;
Third sending module, for when first cryptographic Hash and the third cryptographic Hash compare consistent, to user's endEnd sends the corresponding video fragment in video fragment address.
In one embodiment, described device further includes:
Processing module, for when first cryptographic Hash and the third cryptographic Hash compare inconsistent, to described secondRequest carries out door chain processing.
In one embodiment, the processing module, including:
Refuse submodule, for when first cryptographic Hash and the third cryptographic Hash compare inconsistent, refuse toFamily terminal sends the video fragment corresponding to the video fragment address;
Sending submodule, for sending error message to the user terminal according to the internet protocol address of user terminal.
Other features and advantages of the present invention will be illustrated in the following description, also, partly becomes from specificationIt obtains it is clear that understand through the implementation of the invention.The purpose of the present invention and other advantages can be by the explanations writeSpecifically noted structure is realized and is obtained in book, claims and attached drawing.
Below by drawings and examples, technical scheme of the present invention will be described in further detail.
Specific implementation mode
Hereinafter, preferred embodiments of the present invention will be described with reference to the accompanying drawings, it should be understood that preferred reality described hereinApply example only for the purpose of illustrating and explaining the present invention and is not intended to limit the present invention.
Fig. 1 is a kind of flow chart of video request processing method in one embodiment of the invention, as shown in Figure 1, in the present inventionVideo request processing method can be used for providing in the terminal applies of Video service or the background server corresponding to website, this methodInclude the following steps S11-S17:
In step s 11, receive the acquisition request video fragment address that user terminal is sent first is asked, and described firstRequest includes the Internet protocol address of user terminal;
In step s 12, Internet protocol address and preset target string in being asked according to first are hashedIt calculates, obtains the first cryptographic Hash;
In step s 13, first cryptographic Hash and the video fragment address are sent to user terminal, wherein instituteIt is invisible to user to state the first cryptographic Hash;
In step S14, the second request of the acquisition request video fragment that user terminal is sent, second request are receivedIncluding video fragment address, the Internet protocol address of user terminal and the first cryptographic Hash;
In step S15, Internet protocol address and preset target string in being asked according to second are hashedThe second cryptographic Hash is calculated;
In step s 16, first cryptographic Hash is compared with second cryptographic Hash;
In step S17, when comparing consistent, the corresponding video fragment in video fragment address is sent to user terminal.
For example, in net cast, in order to realize live streaming, server is as unit of a prefixed time interval by videoMultiple video fragments are divided into, these video fragments can be with independent play-out, also, in order to avoid user occurs when watching videoSluggishness can cache several video fragments in the server, for example, three video fragments can be cached, pass through offer in userWhen the website of Video service or terminal applies watching video live broadcast, to the website of the offer Video service or the backstage of terminal appliesThe request that server sends acquisition request corresponding video fragment address includes the IP (Internet of requesting party in the requestProtocol, Internet protocol) address, when receiving the request in server, by the IP address of requesting party and it is stored in clothesThe target string of business device local carries out hash calculating, obtains cryptographic Hash, the cryptographic Hash and video fragment address are issued userTerminal, when user terminal is according to fragment Address requests video fragment, which carries in the request of request video fragment,The cryptographic Hash is invisible to user, works as user.It, can be broken according to the video when user terminal receives the video fragment addressPiece address sends the request for obtaining video fragment to server again, can also regenerate new video fragment address, and willThe address is sent to other users, and other users can ask regarding corresponding to the video fragment address according to the address to serverFrequency fragment.When server receives user terminal according to video fragment Address requests video fragment, according to the user terminalIP address and local preset target string carry out hash and a cryptographic Hash are calculated, and are asked with what the user terminal was sentIt asks the cryptographic Hash of middle carrying to compare, when the alignment is identical, the corresponding video fragment in video fragment address is sent to user terminal.
The advantageous effect of the present embodiment is:In the first request for receiving user terminal requests acquisition video fragment addressWhen, the first cryptographic Hash is calculated according to the Internet protocol address of user terminal and preset target string, and in userWhen terminal is according to video fragment Address requests video fragment, the Internet protocol address again according to user terminal and preset meshThe second cryptographic Hash is calculated in mark character string, when the first cryptographic Hash compares consistent with the second cryptographic Hash, is sent to user terminalVideo fragment, the i.e. user terminal when checking request video fragment address and the use according to video fragment Address requests video fragmentWhen family terminal is the same user terminal, video fragment just is sent to the terminal, to prevent stolen chain.
In one embodiment, the method further includes:
Change the character in the target string at random according to prefixed time interval.
For example, a time interval is preset, according to the prefixed time interval, random change is stored in server localCharacter in target string, in this way, when user receives the video fragment Address requests of server feedback, it is necessary to changeThe just request according to the video fragment address to server transmission to video fragment before target string changes, otherwise, ifIt sends and asks to server again after changing Deng local target string, server is according to IP address and local characterThe cryptographic Hash being calculated of going here and there can not just be compared with the cryptographic Hash for being sent to the user unanimously, i.e., when target string changesWhen, the cryptographic Hash carried in the request to video fragment will fail, and can not pass through verification.In this way, being imparted for cryptographic HashTimeliness increases and steals chain difficulty, improves the safety of video fragment.
The advantageous effect of the present embodiment is, target string is made to be changed according to prefixed time interval, to make basis shouldThe calculated cryptographic Hash of the Internet protocol address of target string and user terminal has timeliness, improves video fragmentSafety, to significantly more efficient to prevent stolen chain.
In one embodiment, as shown in Fig. 2, the method further includes following steps S21-S24:
In the step s 21, when comparing inconsistent, the target string before the last be modified is obtained;
In step S22, before Internet protocol address and described the last time in being asked according to second are modifiedTarget string carry out hash third cryptographic Hash is calculated;
In step S23, first cryptographic Hash is compared with the third cryptographic Hash;
In step s 24, it when first cryptographic Hash and the third cryptographic Hash compare consistent, is sent to user terminalThe corresponding video fragment in video fragment address.
For example, since the target string of server local changes according to preset time, thus, it is possible in meshMark character string receives request of the user to video fragment address when soon changing, and works as server to user terminalWhen sending video fragment address and cryptographic Hash, target string is changed just, in this way, user terminal has little time root at allAccording to the video fragment Address requests video fragment, it is contemplated that such situation can cause request to fail, thus server is recordableThe last time be modified before target string, when according to the IP address of user terminal and the target string at current timeWhen carrying out the cryptographic Hash difference carried in the cryptographic Hash that is calculated of hash and request, according to the IP address of user terminal and mostTarget string before being closely once modified carries out hash and a cryptographic Hash is calculated, and the cryptographic Hash is taken with requestThe cryptographic Hash of band is compared, and when the alignment is identical, still can send corresponding video fragment to the user terminal.
The advantageous effect of the present embodiment is:When comparing inconsistent, the target word before being modified with the last timeThe internet protocol address of symbol string and user terminal carries out hash and third cryptographic Hash is calculated, when third cryptographic Hash and the first HashWhen the comparison result of value is consistent, the corresponding video fragment in video fragment address still is sent to user terminal, is avoided due to firstCryptographic Hash timeliness it is too short and cause validated user request failure the case where.
In one embodiment, the method further includes:
When first cryptographic Hash and the third cryptographic Hash compare inconsistent, door chain is carried out to second requestProcessing.
The advantageous effect of the present embodiment is:When the first cryptographic Hash and third cryptographic Hash compare inconsistent, asked to secondIt asks and carries out door chain processing, avoid robber's chain and happen.
In one embodiment, described to include to the second request progress door chain processing:
Refuse to send the video fragment corresponding to the video fragment address to user terminal;
According to the internet protocol address of user terminal error message is sent to the user terminal.
For example, it is compared when according to above-mentioned steps S23, obtains the first cryptographic Hash and compared still not with third cryptographic HashWhen consistent, it is determined that the user terminal be it is illegal, thus, refuse to send regarding corresponding to video fragment address to user terminalFrequency fragment, meanwhile, error message is sent to user terminal according to the internet protocol address of the user terminal.Under normal conditions, noLegal user is not aware that the video in oneself orientation is to steal chain video, thus, it can be with written form pair in the error messageUser reminds, meanwhile, it can be to the source address of user's pushing video.
The advantageous effect of the present embodiment is:The corresponding video fragment in video fragment address is sent to user by refusal,Prevent illegal user from successfully obtaining video fragment, to prevent stolen chain, pass through, error message is sent to user terminal,It is not the source address of the video to make the video address that user knows that it is accessed.
Fig. 3 is a kind of block diagram of video request processing unit in one embodiment of the invention, as shown in figure 3, being regarded in the present inventionFrequency request processing unit can be used for providing in the terminal applies of Video service or the background server corresponding to website, the device packetInclude following module:
First receiving module 31, the first request of the acquisition request video fragment address for receiving user terminal transmission,First request includes the Internet protocol address of user terminal;
First computing module 32, for according to first request in Internet protocol address and preset target string intoRow hash calculates, and obtains the first cryptographic Hash;
First sending module 33, for first cryptographic Hash and the video fragment address to be sent to user terminal,Wherein, first cryptographic Hash is invisible to user;
Second receiving module 34, the second request of the acquisition request video fragment for receiving user terminal transmission are describedSecond request includes video fragment address, the Internet protocol address of user terminal and the first cryptographic Hash;
Second computing module 35, for according to second request in Internet protocol address and preset target string intoThe second cryptographic Hash is calculated in row hash;
First comparing module 36, for first cryptographic Hash to be compared with second cryptographic Hash;
Second sending module 37, for when comparing consistent, the corresponding video in video fragment address to be sent to user terminalFragment.
In one embodiment, described device further includes:
Module is changed, for changing the character in the target string at random according to prefixed time interval.
In one embodiment, as shown in figure 4, described device further includes:
Acquisition module 41, for when comparison is inconsistent, obtaining the target string before the last be modified;
Third computing module 42, Internet protocol address and the last progress in being used to ask according to second are moreTarget string before changing carries out hash and third cryptographic Hash is calculated;
Second comparing module 43, for first cryptographic Hash to be compared with the third cryptographic Hash;
Third sending module 44, for when first cryptographic Hash and the third cryptographic Hash compare consistent, to userTerminal sends the corresponding video fragment in video fragment address.
In one embodiment, described device further includes:
Processing module, for when first cryptographic Hash and the third cryptographic Hash compare inconsistent, to described secondRequest carries out door chain processing.
In one embodiment, the processing module, including:
Refuse submodule, for when first cryptographic Hash and the third cryptographic Hash compare inconsistent, refuse toFamily terminal sends the video fragment corresponding to the video fragment address;
Sending submodule, for sending error message to the user terminal according to the internet protocol address of user terminal.
It should be understood by those skilled in the art that, the embodiment of the present invention can be provided as method, system or computer programProduct.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the present inventionApply the form of example.Moreover, the present invention can be used in one or more wherein include computer usable program code computerThe shape for the computer program product implemented in usable storage medium (including but not limited to magnetic disk storage and optical memory etc.)Formula.
The present invention be with reference to according to the method for the embodiment of the present invention, the flow of equipment (system) and computer program productFigure and/or block diagram describe.It should be understood that can be realized by computer program instructions every first-class in flowchart and/or the block diagramThe combination of flow and/or box in journey and/or box and flowchart and/or the block diagram.These computer programs can be providedInstruct the processor of all-purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produceA raw machine so that the instruction executed by computer or the processor of other programmable data processing devices is generated for realThe device for the function of being specified in present one flow of flow chart or one box of multiple flows and/or block diagram or multiple boxes.
These computer program instructions, which may also be stored in, can guide computer or other programmable data processing devices with spyDetermine in the computer-readable memory that mode works so that instruction generation stored in the computer readable memory includes referring toEnable the manufacture of device, the command device realize in one flow of flow chart or multiple flows and/or one box of block diagram orThe function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device so that countSeries of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, in computer orThe instruction executed on other programmable devices is provided for realizing in one flow of flow chart or multiple flows and/or block diagram oneThe step of function of being specified in a box or multiple boxes.
Obviously, various changes and modifications can be made to the invention without departing from essence of the invention by those skilled in the artGod and range.In this way, if these modifications and changes of the present invention belongs to the range of the claims in the present invention and its equivalent technologiesWithin, then the present invention is also intended to include these modifications and variations.