CN111310081A - Webpage access method, device, computer and computer storage medium - Google Patents

Webpage access method, device, computer and computer storage medium Download PDF

Info

Publication number
CN111310081A
CN111310081A CN202010038201.6A CN202010038201A CN111310081A CN 111310081 A CN111310081 A CN 111310081A CN 202010038201 A CN202010038201 A CN 202010038201A CN 111310081 A CN111310081 A CN 111310081A
Authority
CN
China
Prior art keywords
character string
global
check
short address
check bit
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010038201.6A
Other languages
Chinese (zh)
Inventor
钱坤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Property and Casualty Insurance Company of China Ltd
Original Assignee
Ping An Property and Casualty Insurance Company of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Property and Casualty Insurance Company of China Ltd filed Critical Ping An Property and Casualty Insurance Company of China Ltd
Priority to CN202010038201.6A priority Critical patent/CN111310081A/en
Publication of CN111310081A publication Critical patent/CN111310081A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention provides a webpage access method, which comprises the following steps: receiving a webpage access request based on a short address, wherein the short address has an initial character string with a preset length; intercepting a first character string and at least one second character string from the initial character string of the short address, generating at least one check bit according to the first character string, and judging whether the at least one check bit is matched with the at least one second character string; if the at least one check bit is matched with the at least one second character string, whether a long address corresponding to the short address exists or not is inquired in a prestored form; and if the long address corresponding to the short address is inquired in the prestored form, accessing the target webpage based on the long address. The invention also provides a webpage access device, a computer and a computer storage medium.

Description

Webpage access method, device, computer and computer storage medium
Technical Field
The invention relates to the technical field of security protection, in particular to a webpage access method, a webpage access device, a computer and a computer storage medium.
Background
The web page access is a network request realized by depending on an address link, and the web page corresponding to the address link can be jumped to by clicking the address link. However, the conventional address link has a long character string, which is inconvenient to memorize and convey, so with the development of the internet, more and more companies have introduced a short address service, that is, an original address link is converted into a short address corresponding to the original address link according to a certain rule, and the character string length of the short address is far shorter than that of the original address link, but a user cannot directly access a webpage based on the short address, and needs to search the original address link corresponding to the short address according to the short address to realize the short address.
Therefore, in the short address service, the mapping relationship between the short address and the original address link needs to be stored in the database, the original address link corresponding to the short address is queried according to the short address, and then the web page is accessed according to the original address link. Due to the short address character string, some illegal users can generate a large number of short address links in a traversal mode, and frequently call a background interface to frequently send network requests. The background can frequently query the pre-stored database, which easily causes a large amount of IO stream operation and communication overhead, so that the availability of the system is reduced, and even easily causes an avalanche effect to make the whole system unavailable.
Disclosure of Invention
The invention provides a webpage access method in a first aspect, which comprises the following steps:
receiving a webpage access request based on a short address, wherein the short address has an initial character string with a preset length;
intercepting a first character string and at least one second character string from the initial character string of the short address, generating at least one check bit according to the first character string, and judging whether the at least one check bit is matched with the at least one second character string;
if the at least one check bit is matched with the at least one second character string, whether a long address corresponding to the short address exists or not is inquired in a prestored form;
and if the long address corresponding to the short address is inquired in the prestored form, accessing the target webpage based on the long address.
According to a preferred embodiment of the present invention, the step of generating at least one check bit according to the first character string specifically includes:
and carrying out binary conversion on the first character string to generate a global ID, and generating at least one check bit based on a preset rule according to the global ID.
According to a preferred embodiment of the present invention, the step of generating at least one parity bit based on a preset rule according to the global ID specifically includes:
generating a first check bit according to the global ID and a first algorithm;
and generating a second check bit according to the global ID, a second algorithm and the first check bit.
According to the preferred embodiment of the present invention, the step of generating the first parity according to the global ID and the first algorithm specifically includes:
randomly generating a weight corresponding to each bit character in the global ID character string one by one, and randomly generating a plurality of first check codes;
selecting a first target check code from the plurality of first check codes according to the character string length of the global ID;
calculating the weighted sum of each character in the character string of the global ID based on the weight of each character in the character string of the global ID;
and coding the weighted sum according to the selected first target check code to generate a first check bit.
According to a preferred embodiment of the present invention, the step of generating the second parity according to the global ID, the second algorithm and the first parity specifically includes:
splicing the first check digit and the character string of the global ID to serve as an initial character string, and intercepting partial characters in the initial character string to serve as a target character string;
selecting a second target check code from the plurality of second check codes according to the character string length of the global ID;
generating an initial check value according to the target character string;
and encoding the initial check value by the second target check code to obtain the second check bit.
Another aspect of the present invention provides a web page accessing apparatus, including:
the request receiving unit is used for receiving a webpage access request based on a short address, and the short address has an initial character string with a preset length;
a determining unit, configured to intercept a first character string and at least one second character string from the initial character string of the short address, generate at least one check bit according to the first character string, and determine whether the at least one check bit matches the at least one second character string;
the query unit is used for querying whether a long address corresponding to the short address exists in a prestored form when the at least one check bit is judged to be matched with the at least one second character string;
and the webpage access unit is used for accessing a target webpage based on the long address when the long address corresponding to the short address is inquired in the prestored form.
According to a preferred embodiment of the present invention, the determining unit is specifically configured to:
intercepting a first character string and at least one second character string from the initial character string of the short address, carrying out binary conversion on the first character string to generate a global ID, generating at least one check bit based on a preset rule according to the global ID, and judging whether the at least one check bit is matched with the at least one second character string.
According to a preferred embodiment of the present invention, the determining unit is specifically configured to:
intercepting a first character string and at least one second character string from the initial character string of the short address, carrying out binary conversion on the first character string to generate a global ID, generating a first check bit based on a first algorithm according to the global ID, generating a second check bit based on a second algorithm different from the first algorithm and the first check bit according to the global ID, and judging whether the at least one check bit is matched with the at least one second character string.
Another aspect of the present invention provides a computer comprising a processor and a memory, the processor being configured to implement the steps of the web page access method as described above when executing a computer program stored in the memory.
Another aspect of the present invention provides a computer storage medium having stored thereon a computer program or instructions which, when executed by a processor, implement the steps of the web page access method as described above.
According to the webpage access method provided by the embodiment of the invention, before the inquiry in the pre-stored form, the validity of the short address is verified by the initial character string of the short address, the short address with an illegal initial character string format can be filtered, the inquiry is not carried out aiming at the illegal short address, compared with the inquiry operation carried out without difference, the inquiry frequency is effectively reduced, and the problems that the response speed of the network access request is reduced and even the network access interface is crashed due to the fact that the table look-up operation is carried out frequently according to the frequent webpage access requests can be effectively avoided by effectively reducing the inquiry frequency. Particularly, in some platform activities, for example, pages for getting tickets, a large number of short addresses are generated maliciously and frequently, and webpage access requests are sent frequently, and the webpage access method provided by the embodiment can effectively filter out a large number of illegal short addresses. On the other hand, only the legal short address is queried, so that the query efficiency is improved, and the response speed to the network access request is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are some examples of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a web page access method according to an embodiment of the present invention.
Fig. 2 is a schematic structural diagram of a web page access device according to a second embodiment of the present invention.
FIG. 3 is a schematic structural diagram of a computer implementing the preferred embodiment of the web page access method of the present invention.
The following detailed description will further illustrate the invention in conjunction with the above-described figures.
Detailed Description
So that the manner in which the above recited objects, features and advantages of the present invention can be understood in detail, a more particular description of the invention, briefly summarized above, may be had by reference to the embodiments thereof which are illustrated in the appended drawings. In addition, the embodiments and features of the embodiments of the present application may be combined with each other without conflict.
In the following description, numerous specific details are set forth to provide a thorough understanding of the present invention, and the described embodiments are merely a subset of the embodiments of the present invention, rather than a complete embodiment. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention.
Example one
Referring to fig. 1, the method for accessing a web page provided by the embodiment includes:
step S1, receiving a web page access request based on a short address, where the short address is an initial string with a preset length;
step S2, intercepting a first string and at least one second string from the initial string of the short address, generating at least one check bit according to the first string, and determining whether the at least one check bit matches the at least one second string;
step S3, if the check digit is matched with the second character string, inquiring whether a long address corresponding to the short address exists in a prestored form;
and step S4, if the long address corresponding to the short address is inquired in the prestored form, accessing the target webpage based on the long address.
The webpage access method provided by the embodiment is applied to the condition of webpage access based on the short address. The short address has a character string shorter than the long address, which is convenient for memorizing, storing, transmitting and the like, when accessing the webpage based on the short address, the corresponding webpage can not be accessed directly according to the short address to obtain the corresponding network service, and the original long address corresponding to the short address needs to be searched and restored first, and then the webpage access is directly performed based on the long address.
In step S1, a web page access request based on a short address is received, where the short address is an initial string having a predetermined length. Generally, the initial string is composed of numbers, letters, special characters, etc. or any combination thereof, the short address has a shorter string than the long address corresponding to the short address, and the initial string of the short address is obtained by converting the long address corresponding to the short address through a predetermined algorithm.
In step S2, a part of the initial string of the short address is intercepted as the first string according to a first predetermined rule, and another part of the initial string of the short address is intercepted as the second string according to a first predetermined rule. The first character string may be a continuous character string or a discontinuous character string in the initial character string of the short address, the second character string may also be a continuous character string or a discontinuous character string in the initial character string of the short address, and the first character string and the second character string have no overlapping part, and the second character string is one or more.
The first preset rule mainly refers to an intercepting rule of the first character string and the second character string. In one embodiment, in step S1, the initial string of short addresses is composed of only digits, and in step S2, consecutive characters in the initial string are truncated to be the first string or the second string, respectively. For example, the initial string is specifically: 123456789 truncates the consecutive character "3456" as the first string and truncates the two consecutive characters "12" and "89" as the two second strings, respectively. In another embodiment, in step S1, the initial string of the short address is composed of only digits, and in step S2, non-consecutive characters in the initial string are intercepted as the first string or the second string, respectively. For example, the initial string is specifically: 123456789 truncates the two non-consecutive characters "34" and "67" as a first string, truncates the non-consecutive characters "1" and "5" as a second string, and truncates the non-consecutive characters "2" and "9" as another second string. Such as the above interception rules, are not described in detail herein.
Further, in step S2, the generating at least one check digit according to the first character string specifically includes:
and carrying out binary conversion on the first character string to generate a global ID, and generating at least one check bit based on a second preset rule according to the global ID.
The first character string is subjected to a system conversion, for example, the first character string in the system of 64 is converted into a global ID in the system of 10. And generating at least one check bit according to the global ID, in this embodiment, the number of the check bits is equal to the number of the second character strings, and if the number of the intercepted second character strings is two, generating two check bits according to the generated global ID.
In this embodiment, the step of generating two check bits based on the second preset rule is: and generating a first check bit according to the global ID based on a first algorithm, and generating a second check bit according to the global ID based on a second algorithm.
In this embodiment, the first algorithm is an identity card number generation algorithm, and the step of generating the first check digit based on the first algorithm according to the global ID specifically includes:
randomly generating a weight corresponding to each bit character in the global ID character string one by one, and randomly generating a plurality of first check codes;
selecting a first target check code from the plurality of first check codes according to the character string length of the global ID;
calculating the weighted sum of each character in the character string of the global ID based on the weight of each character in the character string of the global ID;
and coding the weighted sum according to the selected first target check code to generate a first check bit.
In this embodiment, each weight of the randomly generated one-to-one corresponding characters in the global ID is greater than 0 and smaller than 11; the number of the randomly generated first check codes is 10, and the values of the 10 first check codes are integers from 0 to 10. Further, in this embodiment, the string of the global ID has a minimum of 18 bits and a maximum of 19 bits.
In this embodiment, the second algorithm is an IMEI algorithm, and the step of generating the second parity bits based on the second algorithm according to the global ID specifically includes:
splicing the first check digit and the character string of the global ID to serve as an initial character string, and intercepting partial characters in the initial character string to serve as a target character string;
selecting a second target check code from the plurality of second check codes according to the character string length of the global ID;
generating an initial check value according to the target character string;
and encoding the initial check value by the second target check code to obtain the second check bit.
In this embodiment, the number of the randomly generated first check codes is 10, and the 10 first check codes are all composed of letters a-Z or a-Z.
The step of generating an initial check value according to the target character string further comprises:
multiplying the characters at the even number positions in the target character string by 2 respectively to calculate the sum of the ones and the tens of the numerical value of each character at the even number positions multiplied by 2 respectively to generate a plurality of first sum values;
summing odd-numbered characters of the target string and the plurality of first sum values to generate a second sum value;
and generating an initial check value according to the second sum value, specifically, if the ones digit of the second sum value is 0, the initial check value is 0, and if the ones digit of the second sum value is not 0, the initial check value is a difference value between the number 10 and the ones digit.
It should be understood that, in other embodiments, other algorithms may be used to obtain the first parity bit and the second parity bit, and the algorithm for generating the first parity bit and the second parity bit is not limited in the embodiments of the present invention. In addition, in other embodiments, the number of the second character string and the generated check bits may not be two (but the number of the second character string and the number of the generated check bits are equal), and the greater the number of the check bits, the more accurate the validity check of the short address is.
Further, the one-to-one correspondence between the at least one check digit and the at least one second character string, and in step S2, the specific step of determining whether the at least one check digit and the at least one second character string are matched is: and respectively judging whether each check bit is the same as the corresponding second character string. In this embodiment, the corresponding relationship between the check bits and the second character string is determined according to the following manner: the generated check bits are numbered according to an algorithm for generating check bits, for example, the check bits generated according to the first algorithm are labeled as first check bits, the check bits generated according to the second algorithm are labeled as second check bits, the two generated second character strings are respectively "12" and "89", the two generated second character strings are respectively corresponding to the check bits one by one according to the arrangement sequence of the "12" and the "89" in the initial character string of the short address, in this embodiment, before the "12" appears in the "89", the "12" is first corresponding to the first check bit, and then the "89" is corresponding to the second check bit.
In this embodiment, the two check bits include a first check bit and a second check bit, and the two second strings are two, when the first check bit and the second check bit generated according to the global ID are the same as the two second strings intercepted from the short address in a one-to-one correspondence, it is determined that the at least one check bit matches the at least one second string, and when any check bit is different from the corresponding second string, it is determined that the at least one check bit does not match the at least one second string.
If yes, i.e. it is determined that the at least one check digit matches the at least one second string, step S3 is executed: and inquiring whether a long address corresponding to the short address exists in a prestored form.
The pre-stored form is pre-stored with a plurality of mapping relationships (one-to-one correspondence) between short addresses and long addresses, and all short addresses in the form satisfy the relationship between the first character string and the at least one second character string (a first character string and at least one second character string are intercepted from the initial character string of the short addresses by a first preset rule, a global ID is obtained according to the first character string, at least one check bit is generated according to the global ID and a second preset rule, and the at least one check bit is matched with the at least one second character string). That is, in the step S1, after receiving the network access request based on the short address, the short address is verified in the step S1 through the step S2, and it is verified whether the first string and the second string extracted from the initial string of the short address match the relationship. When it is determined that the short address received in step S1 satisfies the above relationship, it is determined that: for the pre-stored form, the initial string format of the short address received in step S1 is legal, that is, the initial string format of the short address received in step S1 is the same as the string format of the short address stored in the pre-stored form, and the pre-stored form may store the short address and the corresponding long address. Therefore, when the determination in step S2 is yes, step S3 is executed.
If the determination in step S2 is no, that is, it is determined that the at least one parity bit does not match the at least one second string, then the determination is: for the pre-stored form, the format of the initial string of the short address received in step S1 is illegal, that is, the format of the initial string of the short address received in step S1 is different from the format of the string of the short address stored in the pre-stored form, and the pre-stored form cannot store the short address and the corresponding long address. Therefore, when the determination in step S2 is no, the flow ends, and the search operation is not performed in the pre-stored form.
In step S3, if the long address corresponding to the short address is found in the pre-stored form, step S4 is executed: and accessing the target webpage based on the long address. If the long address corresponding to the short address is not found in the pre-stored form in step S3, the target web page cannot be accessed according to the network access request received in step S1, and the process ends.
In the web page access method provided by the above embodiment, the web page access request is based on the short address, but cannot directly access the web page based on the short address, and the target web page needs to be accessed based on the long address corresponding to the short address. However, the short address in the received network access request does not necessarily correspond to the long address, and therefore, it is necessary to query whether the long address corresponding to the short address exists in the pre-stored form, so as to directly access the target web page based on the long address corresponding to the short address. The pre-stored form stores a plurality of short address and long address mappings, and the character string of each short address in the pre-stored form conforms to a certain rule (a first character string and at least one second character string are intercepted from the initial character string of the short address by a first preset rule, a global ID is obtained according to the first character string, at least one check bit is generated according to the global ID and a second preset rule, and the at least one check bit is matched with the at least one second character string). Before the query step is executed, the initial character string of the short address in the current webpage access request is verified, whether the initial character string meets the rule is verified, and the query operation is executed in a prestored form only for the short address meeting the rule (the short address judged to be legal in the initial character string format).
Therefore, according to the webpage access method provided by the embodiment, before the query is performed in the pre-stored form, the validity of the short address is verified through the initial character string of the short address, the short address with an illegal initial character string format can be filtered, the query is not performed on the illegal short address, compared with the query operation without difference, the query frequency is effectively reduced, and the problems that the response speed of the network access request is slow and even the network access interface is broken down due to the fact that the query frequency is effectively reduced and the table look-up operation is frequently performed according to frequent webpage access requests can be effectively avoided. Particularly, in some platform activities, for example, pages for getting tickets, a large number of short addresses are generated maliciously and frequently, and webpage access requests are sent frequently, and the webpage access method provided by the embodiment can effectively filter out a large number of illegal short addresses. On the other hand, only the legal short address is queried, so that the query efficiency is improved, and the response speed to the network access request is improved.
Example two
Referring to fig. 2, the web page accessing apparatus 1 provided in this embodiment includes:
a request receiving unit 11, configured to receive a web page access request based on a short address, where the short address is an initial string with a preset length;
a determining unit 12, configured to intercept a first character string and at least one second character string from the initial character string of the short address, generate at least one check bit according to the first character string, and determine whether the at least one check bit matches the at least one second character string;
the query unit 13 is configured to query whether a long address corresponding to the short address exists in a pre-stored form when it is determined that the at least one check bit matches the at least one second character string;
and the web page access unit 14 is configured to, when a long address corresponding to the short address is queried in the pre-stored form, access a target web page based on the long address.
The web page access device 1 according to the present embodiment is applied to a case where a web page is accessed based on a short address. The short address has a character string shorter than the long address, which is convenient for memorizing, storing, transmitting and the like, when accessing the webpage based on the short address, the corresponding webpage can not be accessed directly according to the short address to obtain the corresponding network service, and the original long address corresponding to the short address needs to be searched and restored first, and then the webpage access is directly performed based on the long address.
The request receiving unit 11 is configured to receive a web page access request based on a short address, where the short address is an initial string having a predetermined length. Generally, the initial string is composed of numbers, letters, special characters, etc. or any combination thereof, the short address has a shorter string than the long address corresponding to the short address, and the initial string of the short address is obtained by converting the long address corresponding to the short address through a predetermined algorithm.
The determining unit 12 intercepts a part of the initial string of the short address as the first string according to a first predetermined rule, and intercepts another part of the initial string of the short address as the second string according to a first predetermined rule. The first character string may be a continuous character string or a discontinuous character string in the initial character string of the short address, the second character string may also be a continuous character string or a discontinuous character string in the initial character string of the short address, and the first character string and the second character string have no overlapping part, and the second character string is one or more.
The first preset rule mainly refers to an intercepting rule of the first character string and the second character string. In an embodiment, the initial string of the short address received by the request receiving unit 11 is composed of only digits, and the determining unit 12 is configured to intercept consecutive characters in the initial string as the first string or the second string, respectively. For example, the initial string is specifically: 123456789 truncates the consecutive character "3456" as the first string and truncates the two consecutive characters "12" and "89" as the two second strings, respectively. In another embodiment, the initial string of the short address received by the request receiving unit 11 is composed of only digits, and the determining unit 12 is configured to intercept non-consecutive characters in the initial string as the first string or the second string, respectively. For example, the initial string is specifically: 123456789 truncates the two non-consecutive characters "34" and "67" as a first string, truncates the non-consecutive characters "1" and "5" as a second string, and truncates the non-consecutive characters "2" and "9" as another second string. Such as the above interception rules, are not described in detail herein.
Further, the determining unit 21 is specifically configured to:
and carrying out binary conversion on the first character string to generate a global ID, and generating at least one check bit based on a second preset rule according to the global ID.
The first character string is subjected to binary conversion, for example, the first character string in the 64 th order is converted into the global ID in the 10 th order. And generating at least one check bit according to the global ID, in this embodiment, the number of the check bits is equal to the number of the second character strings, and if the number of the intercepted second character strings is two, generating two check bits according to the generated global ID.
In this embodiment, the determining unit 12 is further specifically configured to: and generating a first check bit according to the global ID based on a first algorithm, and generating a second check bit according to the global ID based on a second algorithm.
In this embodiment, the first algorithm is an identity card number generation algorithm, and the determining unit 12 is specifically configured to:
randomly generating a weight corresponding to each bit character in the global ID character string one by one, and randomly generating a plurality of first check codes;
selecting a first target check code from the plurality of first check codes according to the character string length of the global ID;
calculating the weighted sum of each character in the character string of the global ID based on the weight of each character in the character string of the global ID;
and coding the weighted sum according to the selected first target check code to generate a first check bit.
In this embodiment, each weight of the randomly generated one-to-one corresponding characters in the global ID is greater than 0 and smaller than 11; the number of the randomly generated first check codes is 10, and the value of the 10 first check codes is an integer from 0 to 10; the string of global IDs is at least 18 bits and at most 19 bits.
In this embodiment, the determining unit 12 is further configured to:
splicing the first check digit and the character string of the global ID to serve as an initial character string, and intercepting partial characters in the initial character string to serve as a target character string;
selecting a second target check code from the plurality of second check codes according to the character string length of the global ID;
generating an initial check value according to the target character string;
and encoding the initial check value by the second target check code to obtain the second check bit.
In this embodiment, the number of the randomly generated first check codes is 10, and the 10 first check codes are all composed of letters a-Z or a-Z.
Further, the manner of generating the initial check value according to the target character string by the determining unit 12 is as follows:
multiplying the characters at the even number positions in the target character string by 2 respectively to calculate the sum of the ones and the tens of the numerical value of each character at the even number positions multiplied by 2 respectively to generate a plurality of first sum values;
summing odd-numbered characters of the target string and the plurality of first sum values to generate a second sum value;
and generating an initial check value according to the second sum value, specifically, if the ones digit of the second sum value is 0, the initial check value is 0, and if the ones digit of the second sum value is not 0, the initial check value is a difference value between the number 10 and the ones digit.
It should be understood that, in other embodiments, other algorithms may be used to obtain the first parity bit and the second parity bit, and the algorithm for generating the first parity bit and the second parity bit is not limited in the embodiments of the present invention. In addition, in other embodiments, the number of the second character string and the generated check bits may not be two (but the number of the second character string and the number of the generated check bits are equal), and the greater the number of the check bits, the more accurate the validity check of the short address is.
Still further, the at least one check digit corresponds to the at least one second character string one to one, and the determining unit is specifically configured to: and respectively judging whether each check bit is the same as the corresponding second character string. In this embodiment, the corresponding relationship between the check bits and the second character string is determined according to the following manner: the generated check bits are numbered according to an algorithm for generating check bits, for example, the check bits generated according to the first algorithm are labeled as first check bits, the check bits generated according to the second algorithm are labeled as second check bits, the two generated second character strings are respectively "12" and "89", the two generated second character strings are respectively corresponding to the check bits one by one according to the arrangement sequence of the "12" and the "89" in the initial character string of the short address, in this embodiment, before the "12" appears in the "89", the "12" is first corresponding to the first check bit, and then the "89" is corresponding to the second check bit.
In this embodiment, the two check bits include a first check bit and a second check bit, and the two second strings are two, when the first check bit and the second check bit generated according to the global ID are the same as the two second strings intercepted from the short address in a one-to-one correspondence, it is determined that the at least one check bit matches the at least one second string, and when any check bit is different from the corresponding second string, it is determined that the at least one check bit does not match the at least one second string.
If the determination unit 12 determines that the at least one check bit matches the at least one second character string, the query unit 13 queries whether a long address corresponding to the short address exists in a pre-stored form.
The pre-stored form is pre-stored with a plurality of mapping relationships (one-to-one correspondence) between short addresses and long addresses, and all short addresses in the form satisfy the relationship between the first character string and the at least one second character string (a first character string and at least one second character string are intercepted from the initial character string of the short addresses by a first preset rule, a global ID is obtained according to the first character string, at least one check bit is generated according to the global ID and a second preset rule, and the at least one check bit is matched with the at least one second character string). That is, after the request receiving unit 11 receives the network access request based on the short address, the determining unit 12 verifies the short address received in the request receiving unit 11, and verifies whether the first character string and the second character string intercepted from the initial character string of the short address conform to the above relationship. When the short address received in the request receiving unit 11 is judged to conform to the above relationship, it is judged that: for the pre-stored form, the initial string format of the short address received in the request receiving unit 11 is legal, that is, the initial string format of the short address received in the request receiving unit 11 is the same as the string format of the short address stored in the pre-stored form, and the pre-stored form may store the short address and the long address corresponding to the short address. Therefore, when the judging unit 12 judges yes, the inquiring unit 13 inquires.
If the determining unit 12 determines that the at least one parity bit does not match the at least one second string, it determines that: for the pre-stored form, the format of the initial string of the short address received in the request receiving unit 11 is illegal, that is, the format of the initial string of the short address received in the request receiving unit 11 is different from the format of the string of the short address stored in the pre-stored form, and the pre-stored form cannot store the short address and the long address corresponding to the short address. Therefore, when the judging unit 12 judges no, the flow is ended, and the inquiring unit 13 does not perform the search operation in the pre-stored form.
If the query unit 13 queries the long address corresponding to the short address from the pre-stored form, the web page access unit 14 accesses the target web page based on the long address. If the query unit 13 does not query the long address corresponding to the short address in the pre-stored form, the target web page cannot be accessed according to the network access request received by the request receiving unit 11.
As described above, in the web page access device 1 according to the present embodiment, the web page access request is based on the short address, but the web page cannot be directly accessed based on the short address, and the target web page needs to be accessed based on the long address corresponding to the short address. However, the short address in the received network access request does not necessarily correspond to the long address, and therefore, it is necessary to query whether the long address corresponding to the short address exists in the pre-stored form, so as to directly access the target web page based on the long address corresponding to the short address. The pre-stored form stores a plurality of short address and long address mappings, and the character string of each short address in the pre-stored form conforms to a certain rule (a first character string and at least one second character string are intercepted from the initial character string of the short address by a first preset rule, a global ID is obtained according to the first character string, at least one check bit is generated according to the global ID and a second preset rule, and the at least one check bit is matched with the at least one second character string). Before inquiring, the initial character string of the short address in the current webpage access request is verified, whether the initial character string accords with the rule is verified, and the inquiring operation is executed in a prestored form only aiming at the short address which accords with the rule (the short address which is judged to be legal in the initial character string format).
Therefore, in the web page access apparatus 1 provided in this embodiment, before querying in the pre-stored form, the validity of the short address is verified by the initial character string of the short address, so that the short address with an illegal initial character string format can be filtered out, the query is not performed on the illegal short address, and compared with the query operation performed without difference, the query frequency is effectively reduced, and by effectively reducing the query frequency, the problem that the response speed to the network access request is slowed down, or even the network access interface is crashed can be effectively avoided by performing the table lookup operation frequently according to frequent web page access requests. Especially, in some platform activities, for example, pages for getting tickets, a large number of short addresses are generated maliciously and frequently sending web page access requests, and the web page access device 1 provided by this embodiment can effectively filter out a large number of illegal short addresses. On the other hand, only the legal short address is queried, so that the query efficiency is improved, and the response speed to the network access request is improved.
Please refer to fig. 3, which is a schematic structural diagram of a computer implementing the preferred embodiment of the web page accessing method of the present invention.
The computer 2 is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and its hardware includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The computer 2 may also be, but is not limited to, any electronic product that can interact with a user through a keyboard, a mouse, a remote controller, a touch panel, or a voice control device, for example, a Personal computer, a tablet computer, a smart phone, a Personal Digital Assistant (PDA), a game machine, an Internet Protocol Television (IPTV), an intelligent wearable device, and the like.
The computer 2 may also be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices.
The Network where the computer 2 is located includes, but is not limited to, the internet, a wide area Network, a metropolitan area Network, a local area Network, a Virtual Private Network (VPN), and the like.
In one embodiment of the present invention, the computer 2 includes, but is not limited to, a memory 21, a processor 22, and a computer program stored in the memory 21 and executable on the processor 22.
Those skilled in the art will appreciate that the depicted diagram is merely an example of a computer 2 and is not meant to be limiting with respect to computer 2 and may include more or less components than those shown, or some components may be combined, or different components, e.g., computer 2 may also include input-output devices, network access devices, buses, etc.
The Processor 22 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. The processor 22 is an operation core and a control center of the computer 2, and various interfaces and lines are used to connect various parts of the whole computer 2, and execute an operating system of the computer 2 and various installed application programs, program codes and the like.
The processor 22 executes the operating system of the computer 2 and various installed application programs. The processor 22 executes the application program to implement the steps in the above-described web page access method embodiments, such as the steps shown in fig. 1.
Illustratively, the computer program may be divided into one or more modules/units, which are stored in the memory 21 and executed by the processor 22 to accomplish the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of the computer program in the computer 2. For example, the computer program may be divided into a request receiving unit 11, a judging unit 12, an inquiring unit 13, and a web page accessing unit 14.
The memory 21 may be used for storing the computer programs and/or modules, and the processor 22 implements various functions of the computer 2 by executing or executing the computer programs and/or modules stored in the memory 21 and calling data stored in the memory 21. The memory 21 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, etc.) created according to the use of the electronic device, etc. Further, the memory 21 may include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Memory Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other non-volatile solid state storage device.
The memory 21 may be an external memory and/or an internal memory of the computer 2. Further, the memory 21 may be a circuit with a storage function without an actual form in an integrated circuit, or the memory 21 may also be a memory with an actual form, such as a memory stick, a TF Card (Trans-flash Card), and the like.
The integrated modules/units of the computer 2 may be stored in a computer-readable storage medium if implemented in the form of software functional units and sold or used as separate products. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented.
Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM).
With reference to fig. 1, the memory 21 of the computer 2 stores a plurality of instructions to implement a web page access method, and the processor 22 executes the plurality of instructions to implement: receiving a webpage access request based on a short address, wherein the short address is an initial character string with a preset length; intercepting a first character string and at least one second character string from the initial character string of the short address, generating at least one check bit according to the first character string, and judging whether the at least one check bit is matched with the at least one second character string; if the at least one check bit is matched with the at least one second character string, whether a long address corresponding to the short address exists or not is inquired in a prestored form; and if the long address corresponding to the short address is inquired in the prestored form, accessing the target webpage based on the long address.
Specifically, the processor 22 may refer to the description of the relevant steps in the embodiment corresponding to fig. 1, and details thereof are not repeated herein.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof.
The present embodiments are, therefore, to be considered in all respects as illustrative and not restrictive, and the scope of the invention is not to be limited by the foregoing description.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system may also be implemented by one unit or means through software or hardware. The terms second, etc. are used to denote names, but not any particular order.
Although the present invention has been described in detail with reference to the preferred embodiments, it will be understood by those skilled in the art that various changes may be made and equivalents may be substituted without departing from the spirit and scope of the invention.

Claims (10)

1. A method for accessing a web page, comprising the steps of:
receiving a webpage access request based on a short address, wherein the short address has an initial character string with a preset length;
intercepting a first character string and at least one second character string from the initial character string of the short address, generating at least one check bit according to the first character string, and judging whether the at least one check bit is matched with the at least one second character string;
if the at least one check bit is matched with the at least one second character string, whether a long address corresponding to the short address exists or not is inquired in a prestored form;
and if the long address corresponding to the short address is inquired in the prestored form, accessing the target webpage based on the long address.
2. The method for accessing a web page according to claim 1, wherein the step of generating at least one check digit according to the first character string specifically comprises:
and carrying out binary conversion on the first character string to generate a global ID, and generating at least one check bit based on a preset rule according to the global ID.
3. The method for accessing a web page according to claim 2, wherein the step of generating at least one check bit based on a preset rule according to the global ID specifically comprises:
generating a first check bit according to the global ID and a first algorithm;
and generating a second check bit according to the global ID, a second algorithm and the first check bit.
4. The method for accessing a web page according to claim 3, wherein the step of generating the first check bit according to the global ID and the first algorithm specifically comprises:
randomly generating a weight corresponding to each bit character in the global ID character string one by one, and randomly generating a plurality of first check codes;
selecting a first target check code from the plurality of first check codes according to the character string length of the global ID;
calculating the weighted sum of each character in the character string of the global ID based on the weight of each character in the character string of the global ID;
and coding the weighted sum according to the selected first target check code to generate a first check bit.
5. The method for accessing a web page according to claim 4, wherein the step of generating the second parity bit according to the global ID, the second algorithm and the first parity bit specifically comprises:
splicing the first check digit and the character string of the global ID to serve as an initial character string, and intercepting partial characters in the initial character string to serve as a target character string;
selecting a second target check code from the plurality of second check codes according to the character string length of the global ID;
generating an initial check value according to the target character string;
and encoding the initial check value by the second target check code to obtain the second check bit.
6. A web page access apparatus, comprising:
the request receiving unit is used for receiving a webpage access request based on a short address, and the short address has an initial character string with a preset length;
a determining unit, configured to intercept a first character string and at least one second character string from the initial character string of the short address, generate at least one check bit according to the first character string, and determine whether the at least one check bit matches the at least one second character string;
the query unit is used for querying whether a long address corresponding to the short address exists in a prestored form when the at least one check bit is judged to be matched with the at least one second character string;
and the webpage access unit is used for accessing a target webpage based on the long address when the long address corresponding to the short address is inquired in the prestored form.
7. The web page access apparatus according to claim 6, wherein the determining unit is specifically configured to:
intercepting a first character string and at least one second character string from the initial character string of the short address, carrying out binary conversion on the first character string to generate a global ID, generating at least one check bit based on a preset rule according to the global ID, and judging whether the at least one check bit is matched with the at least one second character string.
8. The web page access apparatus according to claim 7, wherein the determining unit is specifically configured to:
intercepting a first character string and at least one second character string from the initial character string of the short address, carrying out binary conversion on the first character string to generate a global ID, generating a first check bit based on a first algorithm according to the global ID, generating a second check bit based on a second algorithm different from the first algorithm and the first check bit according to the global ID, and judging whether the at least one check bit is matched with the at least one second character string.
9. A computer, characterized in that the computer comprises a processor and a memory, the processor being adapted to carry out the steps of the web page access method according to any one of claims 1-5 when executing a computer program stored in the memory.
10. A computer storage medium having stored thereon a computer program or instructions, which, when executed by a processor, carry out the steps of the web page access method according to any one of claims 1-5.
CN202010038201.6A 2020-01-14 2020-01-14 Webpage access method, device, computer and computer storage medium Pending CN111310081A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010038201.6A CN111310081A (en) 2020-01-14 2020-01-14 Webpage access method, device, computer and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010038201.6A CN111310081A (en) 2020-01-14 2020-01-14 Webpage access method, device, computer and computer storage medium

Publications (1)

Publication Number Publication Date
CN111310081A true CN111310081A (en) 2020-06-19

Family

ID=71145158

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010038201.6A Pending CN111310081A (en) 2020-01-14 2020-01-14 Webpage access method, device, computer and computer storage medium

Country Status (1)

Country Link
CN (1) CN111310081A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114070620A (en) * 2021-11-16 2022-02-18 中国平安人寿保险股份有限公司 Short address access method and device, computer equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114070620A (en) * 2021-11-16 2022-02-18 中国平安人寿保险股份有限公司 Short address access method and device, computer equipment and storage medium
CN114070620B (en) * 2021-11-16 2024-04-02 中国平安人寿保险股份有限公司 Short address access method, device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109040341B (en) Intelligent contract address generation method and device, computer equipment and readable storage medium
CN110198313B (en) Method and device for generating strategy
US8725862B1 (en) Server selection based upon time and query dependent hashing
US20030131266A1 (en) Generating and maintaining encrypted passwords
CN111859368A (en) Weak password generation method, password detection method, device and electronic equipment
CN111756750B (en) Secure access method, device, equipment and storage medium
CN109376277B (en) Method and device for determining equipment fingerprint homology
CN109951541A (en) A kind of serial number generation method and server
CN111522574B (en) Differential packet generation method and related equipment
CN111310081A (en) Webpage access method, device, computer and computer storage medium
CN111753312A (en) Data processing method, device, equipment and system
CN112711696A (en) Request access method, device, electronic equipment and storage medium
CN112784566A (en) Document generation method, device, equipment and storage medium
CN111753162A (en) Data crawling method, device, server and storage medium
CN115002211B (en) Method, device, equipment and medium for realizing after-sale micro-service based on cloud protogenesis
CN108600255B (en) Mock service management method, device, computer equipment and storage medium
CN111212153A (en) IP address checking method, device, terminal equipment and storage medium
CN111899018B (en) Order data processing method, device, server and storage medium
CN115438333A (en) Authority distribution method and device
CN113961600A (en) Data query method and device, computer equipment and storage medium
CN113285933A (en) User access control method and device, electronic equipment and storage medium
US10540379B2 (en) Searching base encoded text
CN113312540A (en) Information processing method, device, equipment, system and readable storage medium
CN111756749A (en) Secure access method, device, equipment and storage medium
CN113194127B (en) Data storage method, data transmission method and computing equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination