The present invention relates to the field of data communications, and in particular, to a method and an apparatus for filtering a uniform resource locator (URL).
The URL filtering technology has been widely applied in the communications field, and has become a mature technology in the field of application content security. Based on different categories to which web pages belong, this technology can filter out web pages of set categories, for example, news web pages, according to requirements of a user.
When a connection request is detected by a security device having a URL filtering function, the security device obtains a category to which a URL belongs by remotely querying a categorizing server according to the URL to be connected as requested in the connection request, and then buffers the category in a local memory. In the prior art, if the category to which a URL belongs has been obtained, a filtering operation can be performed directly according to the buffered category to which the URL belongs when the user visits the URL again within an aging time period for the buffering; however, after the aging time period for the buffering expires, the category to which the URL belongs needs to be obtained by means of remote query again.
However, in a practical condition, many web pages include dynamic content; in other words, specific content and the category of the same web page that is requested to be visited may vary within different time periods. In this case, if the categorizing server does not identify variations of the web page content in a timely manner, or the categorizing server has been updated but the category to which the URL belongs, which is buffered on the security device, is still within the aging time period, the category to which the URL belongs cannot be updated in a timely manner. In this case, it is very likely that some URL connection requests that should have been filtered out are allowed to pass through, which causes inaccurate identification of URL categories and further makes it impossible to accurately implement the filtering function.
In view of this, embodiments of the present invention provide a method and an apparatus for filtering a uniform resource locator (URL), so as to address a problem in the prior art that a URL cannot be accurately filtered because a categorizing server may not be updated in a timely manner.
To achieve the foregoing objective, the present invention provides the following technical solutions:
A method for filtering a URL, including: receiving a URL connection request initiated by a client; finding, among web page categories corresponding to each URL in a prestored category information table, a first category corresponding to a URL carried in the URL connection request; determining whether the first category conforms to a predetermined URL passing through policy, where the URL passing through policy includes unblocked web page categories; if the first category conforms to the predetermined URL passing through policy, sending the URL connection request to a server corresponding to the URL connection request and receiving web page content returned by the server; determining a second category corresponding to the URL according to the web page content, determining whether the second category conforms to the predetermined URL passing through policy and, if the second category conforms to the predetermined URL passing through policy, sending the web page content to the client; if the second category does not conform to the predetermined URL passing through policy, blocking the web page content.
An apparatus for filtering a uniform resource locator URL includes: a request receiving module configured to receive a URL connection request initiated by a client; a first category obtaining module configured to find, among web page categories corresponding to each URL in a prestored category information table, a first category corresponding to a URL carried in the URL connection request; a passing through determining module configured to determine whether the first category conforms to a predetermined URL passing through policy, where the URL passing through policy includes unblocked web page categories; a request sending module configured to, when a determination result of the passing through determining module is yes, send the URL connection request to a server corresponding to the URL connection request and receive web page content returned by the server; a category determining module configured to determine a second category corresponding to the URL according to the web page content, and determine whether the second category conforms to the predetermined URL passing through policy; a content returning module configured to send the web page content to the client when a determination result of the category determining module is yes; and a blocking module configured to block the web page content when the determination result of the category determining module is no.
The embodiments of the present invention disclose a method and an apparatus for filtering a URL. According to the method, a first category corresponding to a URL carried in a URL connection request can be found in a prestored category information table; the URL connection request is forwarded to a corresponding server in a case in which the URL connection request conforms to a predetermined URL passing through policy; a second category corresponding to the URL is determined according to web page content returned by the server; and it is determined whether the second category conforms to the predetermined URL passing through policy, and, if the second category conforms to the predetermined URL passing through policy, the web page content is sent to a client; if the second category does not conform to the predetermined URL passing through policy, the web page content is blocked. According to the foregoing method and apparatus for filtering a URL, a category to which the URL belongs can be determined in real time, and it is ensured that, in a case in which the web page content varies or the category is not updated in a timely manner, an unblocked URL connection request that should in fact have been blocked may be blocked in a timely manner, thereby implementing a function of accurate category filtration.
To describe the technical solutions in the embodiments of the present invention more clearly, the following briefly introduces the accompanying drawings required for describing the embodiments. The accompanying drawings in the following description show merely the embodiments of the present invention, and a person of ordinary skill in the art may still derive other drawings from these accompanying drawings without creative efforts.
The following clearly describes the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. The described embodiments are merely a part rather than all of the embodiments of the present invention. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
Step 101: Receive a URL connection request initiated by a client.
Step 102: Find, among web page categories corresponding to each URL in a pre-stored category information table, a first category corresponding to a URL carried in the URL connection request.
Optionally, the pre-stored category information table may be a locally buffered one or be pre-stored on a remote categorizing server. Certainly, a user may also locally store pre-existing category information corresponding to all URLs and periodically update the category information to satisfy the need of filtering the URL connection request to some extent.
The pre-stored category information table may use multiple forms, for example, in a form of a recording table or in a form of a file. Certainly, the storage form is not merely limited to the foregoing two forms, and any form that can indicate a correspondence between URLs and web page categories may be used.
Certainly, if the category information corresponding to the URL carried in the URL connection request is not included in the locally buffered category information table, or if an aging time period has expired for the previously buffered category information, the pre-stored category information table needs to be obtained from the remote categorizing server and locally buffered, and then the first category corresponding to the URL carried in the URL connection request is found according to the correspondence between URLs and web page categories in the category information table.
Step 103: Determine whether the first category conforms to a predetermined URL passing through policy, where the URL passing through policy includes unblocked web page categories, and if the first category conforms to the predetermined URL passing through policy, proceed to step 104.
The URL passing through policy specifies that URLs that are not filtered out conform to the URL passing through policy, and those filtered out do not conform to the URL passing through policy. When the first category conforms to the predetermined URL passing through policy, proceed to step 104 to perform a corresponding step, and when the first category does not conform to the predetermined URL passing through policy, the URL connection request is blocked.
Step 104: Send the URL connection request to a server corresponding to the URL connection request and receive web page content returned by the server.
When the category of the URL to be connected as requested in the URL connection request conforms to a user-defined passing through policy, a related apparatus sends the URL connection request to a corresponding server which, when receiving the connection request, returns, to the related apparatus, web page content to be visited as requested in the connection request.
Step 105: Determine a second category corresponding to the URL according to the web page content.
Optionally, reference may be made to
Step 201: Decode the web page content to extract an identifying keyword of the web page content;
The extracted identifying keyword herein is, for example, star, MicroBlog, short message, or the like, and certainly, it may also be some sensitive character fields such as atypical pneumonia and US president.
Step 202: Determine the second category corresponding to the URL as a web page category corresponding to the extracted identifying keyword according to a correspondence between identifying keywords and web page categories stored in a local lexicon list.
Some keywords or sensitive characters in the local lexicon list may be categorized as follows: identifying keywords corresponding to the recreational and entertainment category, including background, qq space, greeting short message, funny short message, and the like; identifying keywords corresponding to the news category, including military, finance, reports, newspapers, and the like; and identifying keywords corresponding to the sports category, including streetball, basketball, football, sailing, aerobics, and the like. If the data content extracted in step 301 includes the keyword “football”, the web page category of the URL corresponding to the data content may be identified as the sports category, and if the execution body of the method for filtering a URL stipulates that URLs for the sports category cannot be visited, the web page content including the data content is blocked.
Certainly, the method for determining the second category of the URL according to the web page content is not limited to the foregoing procedure. For example, the purpose of determining the second category according to the web page content may also be achieved by extracting a semantic relationship from the web page content, matching the semantic relationship with a semantic relationship template pre-stored in a semantics library, and using a web page category corresponding to the matched semantic relationship template as the second category. Specific manners of determining the second category according to the web page content are not enumerated herein, and any method capable of determining the second category of the URL according to the web page content shall fall within the protection scope of the present invention.
Step 106: Determine whether the second category conforms to the predetermined URL passing through policy, and if the second category conforms to the predetermined URL passing through policy, proceed to step 107, and if the second category does not conform to the predetermined URL passing through policy, go to step 108.
Step 107: Send the web page content to the client.
When the second category determined in step 106 is of an unblocked web page category in the user-defined passing through policy, the returned web page content is returned to the client, so as to normally provide a service for the client.
Step 108: Block the web page content.
When the second category determined in step 106 is not of an unblocked web page category in the user-defined passing through policy, the web page content is blocked directly, the client cannot connect to the URL, and the correspondingly returned web page content is blocked.
According to the method in this embodiment, a first category corresponding to a URL carried in a URL connection request can be found in a pre-stored category information table; when the first category conforms to a predetermined URL passing through policy, the URL connection request is allowed to pass through; the URL connection request is forwarded to a corresponding server; a second category corresponding to the URL is determined according to web page content returned by the server; and it is determined whether the second category conforms to the predetermined URL passing through policy, and, if the second category conforms to the predetermined URL passing through policy, the web page content is sent to a client; and if the second category does not conform to the predetermined URL passing through policy, the web page content is blocked. According to the method for filtering a URL disclosed in the present invention, a category to which a URL belongs can be determined in real time, and it is ensured that, in a case in which the web page content varies constantly or the category is not updated in a timely manner, an unblocked URL connection request that should in fact have been blocked may be blocked in a timely manner, thereby implementing a function of accurate category filtration and improving accuracy of URL filtering.
Step 301: Receive a URL connection request initiated by a client.
Step 302: Find, among web page categories corresponding to each URL in a pre-stored category information table, a first category corresponding to a URL carried in the URL connection request.
Step 303: Determine whether the first category conforms to a predetermined URL passing through policy. If the first category conforms to the predetermined URL passing through policy, go to step 306, and if the first category does not conform to the predetermined URL passing through policy, proceed to step 304.
Step 304: Block the URL connection request, and proceed to step 305.
Step 305: Filter blocked URL connection requests to obtain a URL connection request carrying a predetermined label, and proceed to step 306.
In a practical condition, content of some web pages varies dynamically, so it is possible that a category to which a URL belongs before a certain time point does not conform to the URL passing through policy but a category to which the same URL actually belongs after the time point conforms to the URL passing through policy and the URL category is not updated in a timely manner. This leads to a case in which the URL connection request that should have been unblocked is blocked. To avoid this case, a user may use the method described in this step, where the predetermined label may be a specific keyword or may be a certain fixed connection address, a user name, or the like.
Step 306: Send the URL connection request to a server corresponding to the URL connection request, and receive web page content returned by the server.
Step 307: Determine a second category corresponding to the URL according to the web page content.
Step 308: Determine whether the second category conforms to the predetermined URL passing through policy. If the second category conforms to the predetermined URL passing through policy, proceed to step 309, and if the second category does not conform to the predetermined URL passing through policy, go to step 310.
Step 309: Send the web page content to the client, and go to step 311.
Step 310: Block the web page content.
Step 311: Update a web page category corresponding to the URL carried in the URL connection request in the prestored category information table into the second category.
Optionally, the procedure shown in
Step 321: Receive a URL connection request initiated by a client;
Step 322: Find, among web page categories corresponding to each URL in a prestored category information table, a first category corresponding to a URL carried in the URL connection request;
Step 323: Determine whether the first category conforms to a predetermined URL passing through policy. If the first category conforms to the predetermined URL passing through policy, go to step 326; and if the first category does not conform to the predetermined URL passing through policy, proceed to step 324.
Step 324: Determine whether the URL connection request carries a predetermined label. If the URL connection request carries a predetermined label, go to step 326; and if the URL connection request does not carry a predetermined label, proceed to step 325.
Step 325: Block the URL connection request.
Step 326: Send the URL connection request to a server corresponding to the URL connection request, and receive web page content returned by the server.
Step 327: Determine a second category corresponding to the URL according to the web page content.
Step 328: Determine whether the second category conforms to the predetermined URL passing through policy. If the second category conforms to the predetermined URL passing through policy, proceed to step 329; and if the second category does not conform to the predetermined URL passing through policy, go to step 330.
Step 329: Send the web page content to the client, and go to step 331.
Step 330: Block the web page content.
Step 331: Update a web page category corresponding to the URL carried in the URL connection request in the pre-stored category information table into the second category.
When it is determined according to the method disclosed in this embodiment that the second category of the returned web page content conforms to the predetermined URL passing through policy, it can be learned that the first category corresponding to the URL that is locally buffered or remotely obtained from a categorizing server is inaccurate. Then, the locally buffered first category corresponding to the URL may be updated into the second category determined according to the web page content, or a URL category changing request is sent to the remote categorizing server, so that related subsequent actions can be performed by the categorizing server according to the URL category changing request.
According to the method for filtering a URL in this embodiment, it is determined whether a URL connection request initiated by a client conforms to a predetermined URL passing through policy according to a pre-stored first category of a URL; the URL connection request is forwarded to a corresponding server in a case in which the URL connection request satisfies the predetermined URL filtering policy; a second category is determined according to web page content returned by the server; and it is determined whether the second category conforms to the predetermined URL passing through policy, and, if the second category does not conform to the predetermined URL passing through policy, the returned web page content is blocked. This can avoid some cases in which a URL connection request should have been unblocked but is blocked because a category is not updated in a timely manner. According to the method for filtering a URL disclosed in the present invention, a category to which a URL belongs can be determined in real time, and it is ensured that, in a case in which the category is not updated in a timely manner, an unblocked URL connection request that should in fact have been blocked is blocked in a timely manner, and some blocked URL connection requests that should in fact have been unblocked are unblocked in a timely manner, thereby implementing a function of accurate category filtration.
Referring to
It should be noted that, the apparatus for filtering a URL according to the embodiment of the present invention is not merely limited to the foregoing structure. For example, the first category obtaining module 402 and the passing through determining module 403 may be integrated into one separate module to complete obtaining of the first category of the URL connection request and determining of whether the first category conforms to the predetermined passing through policy. For another example, the content returning module 406 and the blocking module 407 may be one module.
In other embodiments, the apparatus for filtering a URL may further include a category updating module configured to, in a case in which the category determining module 405 determines that the second category does not conform to the predetermined URL passing through policy, update the web page category corresponding to the URL carried in the URL connection request in the locally buffered category information table into the second category.
Further, referring to
The apparatus for filtering a URL may further include a label filtering module 701 configured to: filter blocked URL connection requests to obtain URL connection requests carrying a predetermined label each; trigger the request sending module 404 to send the URL connection request to a server corresponding to the URL connection request and receive web page content returned by the server; the category determining module 405 determines a second category corresponding to the URL according to the web page content, and determines whether the second category conforms to the predetermined URL passing through policy; and if the second category conforms to the predetermined URL passing through policy, the content returning module 406 sends the web page content to the client, and if the second category does not conform to the predetermined URL passing through policy, the blocking module 407 blocks the web page content.
Further, referring to
The apparatus in this embodiment can find, in a pre-stored category information table, a first category corresponding to a URL connection request; passing through the URL connection request, where when the first category conforms to a predetermined URL passing through policy, the URL connection request is allowed to pass through; forward the URL connection request to a corresponding server; determine a second category corresponding to a URL according to web page content returned by the server; and determine whether the second category conforms to the predetermined URL passing through policy, and, if the second category conforms to the predetermined URL passing through policy, send the web page content to a client; and if the second category does not conform to the predetermined URL passing through policy, block the web page content. According to the apparatus for filtering a URL disclosed in the present invention, a category to which a URL belongs can be determined in real time, and it is ensured that, in a case in which the category is not updated in a timely manner, an unblocked URL connection request that should in fact have been blocked is blocked in a timely manner, thereby implementing a function of accurate category filtration.
In addition, an embodiment of the present invention further discloses a gateway. As shown in
Embodiments in this specification are described in a progressive manner, and for identical or similar portions between different embodiments, reference may be made to each other so that each of the embodiments focuses on differences from the other embodiments. The apparatus disclosed in the embodiments is described relatively simply because it corresponds to the method disclosed in the embodiments, and for portions related to those of the method, reference may be made to the description of the method.
It should further be noted that, terms used herein to express relationships such as first and second are only intended to distinguish one entity or operation from another, but not necessarily dictate or imply any such actual relationships or sequence between these entities or operations. Moreover, terms “comprise”, “include”, or any other variants thereof are intended to cover non-exclusive inclusion so that a process, method, article, or device that includes a series of elements not only includes these very elements, but may also include other elements not expressly listed, or also include elements inherent to this process, method, article, or device. Without being subject to further limitations, an element defined by a phrase “including a . . . ” does not exclude presence of other identical elements in the process, method, article, or device that includes the very element.
Steps of methods or algorithms described with reference to the embodiments disclosed herein may be implemented directly by hardware, a software module executed by a processor, or a combination thereof. The software module may be disposed in a random access memory (RAM), a memory, a read only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a movable disk, a compact disc ROM (CD-ROM), or a storage medium of any other form that is well known in the art.
The embodiments disclosed above are described to enable a person skilled in the art to implement or use the present invention. Various modifications to these embodiments will be obvious to a person skilled in the art, and the general principles defined herein may also be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention is not intended to be limited to these embodiments illustrated herein, but shall be construed in the widest scope consistent with the principles and novel features disclosed herein.
Number | Date | Country | Kind |
---|---|---|---|
2011 1 0459686 | Dec 2011 | CN | national |
2012 1 0022574 | Feb 2012 | CN | national |
This application is a continuation of International Application No. PCT/CN2012/081548, filed on Sep. 18, 2012, which claims priority to Chinese Patent Application No. 201110459686.7, filed on Dec. 31, 2011 and Chinese Patent Application No. 201210022574.X, filed on Feb. 1, 2012, all of which are hereby incorporated by reference in their entireties.
Number | Name | Date | Kind |
---|---|---|---|
6266664 | Russell-Falla | Jul 2001 | B1 |
6389472 | Hughes | May 2002 | B1 |
20030014659 | Zhu | Jan 2003 | A1 |
20030163731 | Wigley et al. | Aug 2003 | A1 |
20040107177 | Covill et al. | Jun 2004 | A1 |
20050021796 | McClain et al. | Jan 2005 | A1 |
20050102274 | Chen | May 2005 | A1 |
20080209057 | Martini et al. | Aug 2008 | A1 |
20100115615 | Hubbard et al. | May 2010 | A1 |
20100318681 | Shi | Dec 2010 | A1 |
20110289434 | Kieft | Nov 2011 | A1 |
20120167231 | Garcia et al. | Jun 2012 | A1 |
20130091580 | Maha et al. | Apr 2013 | A1 |
Number | Date | Country |
---|---|---|
101035128 | Sep 2007 | CN |
101163161 | Apr 2008 | CN |
101261644 | Sep 2008 | CN |
101350810 | Jan 2009 | CN |
102073722 | May 2011 | CN |
102077201 | May 2011 | CN |
102137121 | Jul 2011 | CN |
102185859 | Sep 2011 | CN |
102271331 | Dec 2011 | CN |
102624703 | Aug 2012 | CN |
Entry |
---|
Partial English Translation and Abstract of Chinese Patent Application No. CN101350810A, Aug. 9, 2014, 2 pages. |
Partial English Translation and Abstract of Chinese Patent Application No. CN102073722A, Aug. 13, 2014, 2 pages. |
Partial English Translation and Abstract of Chinese Patent Application No. CN101163161A, Jul. 23, 2014, 34 pages. |
Partial English Translation and Abstract of Chinese Patent Application No. CN101261644A, Jul. 23, 2014, 36 pages. |
Partial English Translation and Abstract of Chinese Patent Application No. CN102271331A, Aug. 9, 2014, 2 pages. |
Li, S., et al., “A Model of Web Purifying Based on URL Filter and Content Filter,” Computer Technology and Development, vol. 16, No. 1, Jan. 2006, 4 pages. |
Li, S., et al., “A Model of Web Purifying Based on URL Filter and Content Filter,” English Translation, Computer Technology and Development, vol. 16, No. 1, Jan. 2006, 10 pages. |
Foreign Communication From a Counterpart Application, Chinese Application No. 201210022574.X, Chinese Office Action dated Mar. 27, 2014, 11 pages. |
Foreign Communication From a Counterpart Application, PCT Application No. PCT/CN2012/081548, International Search Report dated Jan. 3, 2014, 3 pages. |
Foreign Communication From a Counterpart Application, PCT Application No. PCT/CN2012/081548, Written Opinion dated Jan. 3, 2014, 10 pages. |
Number | Date | Country | |
---|---|---|---|
20140298445 A1 | Oct 2014 | US |
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2012/081548 | Sep 2012 | US |
Child | 14307014 | US |