Web page file parsing method, device, equipment and storage medium

By performing initial parsing of web page files in a security proxy device and converting the encoding format, the parsing failure caused by not using the preset encoding format is solved, and efficient web page file parsing and business continuity are achieved.

CN118839082BActive Publication Date: 2025-01-10ARRAY NETWORKS BEIJING
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411320473.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-20
Publication Date
2025-01-10
Estimated Expiration
2044-09-20

AI Technical Summary

Technical Problem

In a security proxy device, when the web page file does not adopt the preset encoding format, the parsing failure will lead to the inability to process normally, hindering client access and causing discontinuity of business.

Method used

The web page file parsing method is adopted. After the initial parsing fails, it is converted from the original encoding format to the target encoding format, and then parsing it to ensure that the parsing is successful and the address information is rewritten to point to the secure access to the web page.

Benefits of technology

Improves the efficiency of web page file parsing, avoids business interruptions caused by parsing failure, and ensures the continuity of client access.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118839082B_ABST
    Figure CN118839082B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a web page file parsing method, device, equipment and storage medium, the method comprising: receiving a web page file, the web page file including a network resource and address information corresponding to the network resource; performing a primary parsing process on the web page file; if the parsing fails, converting the web page file from an original encoding format to a target encoding format, and parsing the converted web page file; rewriting the address information in the parsed web page file so that the rewritten address information points to a secure access web page corresponding to the network resource. With the present invention, no matter what type of encoding format is used to encode the web page file, the primary parsing process is directly performed first, and if the parsing fails, the web page file is converted from the original encoding format to the target encoding format. The parsing of the web page file can be achieved with an overall high parsing efficiency of the web page file.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network security technology, and in particular to a web page file parsing method, device, equipment and storage medium. Background Art

[0002] In the related art, when a client requests a network resource in an internal server of an enterprise, the server will carry the network resource in a web page file and send it to a security proxy device, which will process the web page file and then forward it to the client. This can shield the client from direct access to the server and ensure the security of the server. Before the security proxy device processes the web page file, it first needs to parse the web page file so that the security proxy device can normally process the parsed web page file. During the parsing process, the parsing process can only be performed normally if the web page file is encoded in a preset encoding format. If the web page file is not encoded in a preset encoding format, the parsing will fail, resulting in the security proxy device being unable to process the web page file normally, thereby hindering the client's access and causing business discontinuity. Summary of the invention

[0003] The embodiment of the present invention provides a web page file parsing method, device, equipment and storage medium, which are used to successfully parse the web page file and complete the parsing of the web page file at a higher processing efficiency.

[0004] In a first aspect, an embodiment of the present invention provides a web page file parsing method, which is applied to a security proxy device, and the method includes:

[0005] Receiving a web page file, wherein the web page file includes a network resource and address information corresponding to the network resource;

[0006] Performing initial parsing processing on the web page file;

[0007] If the parsing fails, converting the web page file from the original encoding format to the target encoding format, and parsing the converted web page file;

[0008] The address information in the parsed web page file is rewritten so that the rewritten address information points to the secure access web page corresponding to the network resource.

[0009] Optionally, after performing the initial parsing process on the webpage file, the method further includes:

[0010] If the parsing is successful, the address information in the parsed web page file is rewritten so that the rewritten address information points to the secure access web page corresponding to the network resource.

[0011] Optionally, the performing initial parsing processing on the webpage file includes:

[0012] Determining at least one parsing unit included in the web page file;

[0013] According to the order of each parsing unit in the web page file, each parsing unit is subjected to a primary parsing process in turn;

[0014] If the parsing fails, the web page file is converted from the original encoding format to the target encoding format, and the converted web page file is parsed, including:

[0015] If any parsing unit fails to parse, the parsing unit that failed to parse is converted from the original encoding format to the target encoding format, and the parsing process is performed on the converted parsing unit.

[0016] Optionally, the parsing unit includes the entire web page file, a single character or a single file block.

[0017] Optionally, if the parsing fails, converting the webpage file from an original encoding format to a target encoding format includes:

[0018] Determine the type of parsing failure;

[0019] If the parsing failure type is an encoding format error, the web page file is converted from the original encoding format to the target encoding format.

[0020] Optionally, the target encoding format includes a wide-byte encoding format and / or a specific character encoding format, and the specific character encoding format includes a utf-8 character encoding format and / or a GBK character encoding format.

[0021] Optionally, the parsing process is performed by a parser, and the converting of the web page file from an original encoding format to a target encoding format includes:

[0022] Determine an encoding format supported by the parser among the wide byte encoding format and the specific character encoding format as a target encoding format;

[0023] The web page file is converted from the original encoding format to the target encoding format through the parser.

[0024] In a second aspect, an embodiment of the present invention provides a web page file parsing device, which is arranged in a security proxy device, and the device includes:

[0025] A receiving module, used for receiving a web page file, wherein the web page file includes a network resource and address information corresponding to the network resource;

[0026] A parsing module, used for performing a primary parsing process on the web page file;

[0027] A conversion module, used for converting the web page file from an original encoding format to a target encoding format if the parsing fails, and performing parsing processing on the converted web page file;

[0028] The rewriting module is used to rewrite the address information in the parsed web page file so that the rewritten address information points to the secure access web page corresponding to the network resource.

[0029] Optionally, the rewriting module is further used to:

[0030] If the parsing is successful, the address information in the parsed web page file is rewritten so that the rewritten address information points to the secure access web page corresponding to the network resource.

[0031] Optionally, the parsing module is used to determine at least one parsing unit included in the web page file; and perform initial parsing processing on each parsing unit in sequence according to the order of each parsing unit in the web page file;

[0032] The conversion module is used for converting the failed parsing unit from the original encoding format to the target encoding format if any parsing unit fails to parse, and performing parsing processing on the converted parsing unit.

[0033] Optionally, the parsing unit includes the entire web page file, a single character or a single file block.

[0034] Optionally, the conversion module is used to:

[0035] Determine the type of parsing failure;

[0036] If the parsing failure type is an encoding format error, the web page file is converted from the original encoding format to the target encoding format.

[0037] Optionally, the target encoding format includes a wide-byte encoding format and / or a specific character encoding format, and the specific character encoding format includes a utf-8 character encoding format and / or a GBK character encoding format.

[0038] Optionally, the parsing process is performed by a parser, and the conversion module is used to:

[0039] Determine an encoding format supported by the parser among the wide byte encoding format and the specific character encoding format as a target encoding format;

[0040] The web page file is converted from the original encoding format to the target encoding format through the parser.

[0041] In a third aspect, an embodiment of the present invention provides a security proxy device, which includes a processor and a memory, wherein the memory stores executable code, and when the executable code is executed by the processor, the processor can at least implement the web page file parsing method in the first aspect.

[0042] In a fourth aspect, an embodiment of the present invention provides a non-transitory machine-readable storage medium having executable code stored thereon. When the executable code is executed by a processor of a security proxy device, the processor can at least implement the web page file parsing method in the first aspect.

[0043] By adopting the present invention, no matter what type of encoding format is used to encode the web page file, the initial parsing process is directly performed first. If the parsing fails, the web page file is converted from the original encoding format to the target encoding format. The additional computing overhead caused by the initial parsing process resulting in the parsing failure is much smaller than the overall computing overhead generated by traversing all the characters in a large number of web page files one by one. By adopting the present invention, the parsing of web page files can be achieved with an overall higher parsing efficiency of web page files. By adopting the present invention, it is ensured that the security proxy device can perform related processing on the web page files normally in the future, avoid hindering the access of the client, and ensure the continuity of the business. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0045] Figure 1 A schematic diagram of a network architecture provided by an embodiment of the present invention;

[0046] Figure 2 A schematic diagram of a flow chart of a web page file parsing method provided by an embodiment of the present invention;

[0047] Figure 3 A schematic diagram of the structure of a web page file parsing device provided by an embodiment of the present invention;

[0048] Figure 4 A schematic diagram of the structure of a security proxy device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0050] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two.

[0051] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.

[0052] In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.

[0053] Definition of terms:

[0054] Character: In computer and telecommunication technology, a character is a unit of glyph, glyph-like unit or basic information of a symbol. In simple terms, a character is a general term for various words and symbols. A character can be a Chinese character, an English letter, an Arabic numeral, a punctuation mark, a graphic symbol or a control symbol, etc.

[0055] Character set: A character set refers to a collection of multiple characters. Different character sets contain different numbers of characters, different characters, and different character encoding methods. For example, GB2312 is the simplified Chinese character set of China's national standard; GB2312 includes simplified Chinese characters (6763) and general symbols, serial numbers, numbers, Latin letters, Japanese kana, etc., a total of 7445 graphic characters; the ASCII character set only contains 128 characters, and the main characters included in the ASCII character set are English letters, Arabic letters, and some simple control characters. In addition to the above examples, other commonly used character sets include GBK character set, GB18030 character set, Big5 character set, Unicode character set, etc.

[0056] Character Encoding: Character encoding refers to a mapping rule according to which a certain character can be mapped into other forms of data for storage and transmission in a computer. For example, the ASCII character encoding stipulates that the lower 7 bits of a single byte are used to encode all characters. Under this encoding rule, the encoding of the letter A is 65 (ASCII code), which is represented as 0x41 in a single byte. Therefore, when writing to a storage device, it is 01000001 in binary. Each character set has its own character encoding rule. Common character set encoding rules also include UTF-8 encoding, GBK encoding, Big5 encoding, etc.

[0057] Wide Character: ASCII-encoded characters represented by English only require 1 byte to represent, but non-ASCII-encoded characters represented by Chinese characters and others often require at least 2 bytes to store. Characters that can be stored in a single byte are called narrow characters, and characters that require at least 2 bytes to store are called wide characters.

[0058] Wide Byte: Wide byte refers to a storage method. Generally, narrow characters are stored in one byte, and wide characters are stored in 2 or more characters. This storage method causes some characters in strings in the form of "No. 1" and "Server a" to be stored in 1 byte, while another part of the characters are stored in 2 bytes. Therefore, wide bytes are introduced. In wide bytes, both wide characters and narrow characters are stored using 2 (in some cases 4, depending on the specific implementation) bytes.

[0059] To facilitate the understanding of the specific implementation process of the technical solution in this embodiment, the related technologies are described below: The network resources within an enterprise need to be protected. To achieve this goal, a security proxy device is often used. For example, an SSL VPN device is a type of security proxy device. As Figure 1 shown, a security proxy device can be set between the enterprise's internal local area network and the external wide area network. When a client requests network resources in an enterprise internal server, instead of directly accessing the enterprise internal server by the client, the client is allowed to access the enterprise internal server through the security proxy device in a secure access manner. The response result (web page file) of the enterprise internal server also needs to be returned to the client through the security proxy device. In this way, the client is prevented from directly accessing the enterprise internal server, which plays a certain role in protecting the network resources stored in the enterprise internal server.

[0060] Among them, the above-mentioned secure access method, for example, allows the security proxy device to rewrite the specific content of the original internal web page file using standard rewriting rules. In particular, it is necessary to rewrite the address information (such as URL link) corresponding to the network resource in the original internal web page file, so that the rewritten address information points to the secure access web page that the client needs to access. This secure access method can be implemented only through a browser without the need to install an additional VPN client, so this secure access method is easy to apply and has universal applicability.

[0061] Before rewriting the specific content of the original internal web page file, the original internal web page file needs to be parsed, and then the parsing result can be rewritten. Specifically, the original internal web page file can be parsed by the parser in the browser, but these parsers can only support web page files encoded in wide byte encoding format, specific character encoding format, etc., and web page files encoded in encoding formats that the parser does not support cannot be successfully parsed.

[0062] In order to solve the above problem, the related technology often traverses all the contents in the entire web page file. If it is detected that there is any content encoded in an encoding format not supported by the parser in the web page file, the encoding format of the original internal web page file is converted.

[0063] However, in actual applications, the data volume of web page files is large, and some web page files can even reach the MB level. As the times change, the average data volume of web page files will become larger and larger. Traversing general web page files already requires a large computing overhead. If web page files with larger data volumes are traversed, more computing overhead will be consumed, resulting in lower parsing efficiency of web page files.

[0064] In order to solve the above technical problems, this embodiment proposes a web page file parsing method, which can be applied to a security proxy device. Figure 2 As shown, the method comprises the following steps:

[0065] Step 201, receiving a web page file, wherein the web page file includes network resources and address information corresponding to the network resources.

[0066] Step 202, performing initial parsing processing on the web page file.

[0067] Step 203: if the parsing fails, the web page file is converted from the original encoding format to the target encoding format, and the converted web page file is parsed.

[0068] Step 204, rewrite the address information in the parsed web page file so that the rewritten address information points to the secure access web page corresponding to the network resource.

[0069] First, the security proxy device can receive a web page file sent by an internal server of an enterprise, which is returned by the internal server of the enterprise in response to a request from a client. The web page file contains the network resources that the client requests to access and the address information corresponding to the network resources, wherein the address information can be, for example, a URL link. Specifically, the types of web page files can include, but are not limited to, js, html, etc. If the address information corresponding to the network resource is directly exposed to the client, it may pose a threat to the security of the network resource. Therefore, the security proxy device is required to rewrite the address information corresponding to the network resource and then return it to the client, so that the client can access the secure access web page corresponding to the network resource. In this way, the client can still indirectly access the network resource, but a barrier can be formed to protect the network resource.

[0070] Before rewriting, the original internal web page file needs to be parsed for the first time. It should be noted that in the embodiment of the present invention, the compliance check of the encoding format of the web page file is not performed first, but the initial parsing process is directly performed first regardless of the type of encoding format used to encode the web page file. If the parsing fails, the web page file is converted from the original encoding format to the target encoding format, wherein the target encoding format is the encoding format supported by the parser.

[0071] Among them, optionally, the target encoding format may include but is not limited to a wide-byte encoding format and / or a specific character encoding format, and the specific character encoding format may include but is not limited to a utf-8 character encoding format and a GBK (Chinese Internal Code Specification) character encoding format.

[0072] The applicant's research found that in practice, only a few web page files need to be converted to encoding formats. In fact, the original encoding formats of most web page files are already encoding formats supported by the parser. Therefore, the additional computational overhead caused by the initial parsing process resulting in parsing failure is much smaller than the overall computational overhead generated by traversing a large number of web page files one by one. For example, there may be only 5 out of 100 web page files that are not encoded in the encoding format supported by the parser. The additional computational overhead generated by the initial parsing of these 5 web page files is 5a. If all the contents of the 100 web page files are traversed one by one for detection, the computational overhead required is 100b, and 5a is much smaller than 100b. It can be seen from the above examples that the method provided by the embodiments of the present invention can achieve parsing of web page files with an overall higher parsing efficiency of web page files.

[0073] If the parsing fails, the web page file can be converted from the original encoding format to the target encoding format, and then the converted web page file is parsed again. The initial parsing process and the subsequent parsing process can be the same or different.

[0074] If the parsing is successful, there is no need to perform the parsing process again, and the address information in the parsed web page file can be directly rewritten so that the rewritten address information points to the secure access web page corresponding to the network resource.

[0075] In some optional embodiments, since the reasons for parsing failure may include multiple reasons, not just encoding format errors due to unsupported encoding formats, when parsing failure is found, the type of parsing failure can also be determined optionally; if the type of parsing failure is an encoding format error, the web page file is converted from the original encoding format to the target encoding format.

[0076] If the type of parsing failure is a non-coding format error, an error log can be generated and output, in which the specific type of parsing failure can be recorded, and the cause of the parsing failure can be analyzed to a certain extent. After outputting the error log, the technician can view the error log, and can locate the content that caused the error based on the description of the parsing failure in the error log, and modify the erroneous content. After modifying the erroneous content, a new version of the web page file can be released or a patch can be issued based on the modified content, so that the new version of the web page file or the web page file with the patch installed will no longer have the above error, and then the subsequent normal process processing can continue, such as parsing the above web page file.

[0077] Optionally, the process of performing the initial parsing process on the web page file can be implemented as follows: determining at least one parsing unit included in the web page file; and performing the initial parsing process on each parsing unit in sequence according to the order of each parsing unit in the web page file. Accordingly, if the parsing fails, the web page file is converted from the original encoding format to the target encoding format, and the process of parsing the converted web page file can be implemented as follows: if any parsing unit fails to parse, the parsing unit that failed to parse is converted from the original encoding format to the target encoding format, and the parsing process is performed on the converted parsing unit.

[0078] In actual applications, the entire web page file can be parsed as a parsing unit, so that the entire web page file can be parsed for the first time at one time. If the web page file does not contain any content that the parser does not support parsing, the initial parsing of the web page file will be successful, otherwise the parsing will fail.

[0079] Alternatively, a single character may be used as a parsing unit, so that all characters contained in the web page file can be determined, and each character can be subjected to a primary parsing process in turn according to the order in which each character is arranged in the web page file. It is understandable that a web page file may be composed of characters in a variety of encoding formats, some of which are supported for parsing by the parser, while others are not supported for parsing by the parser, so each character in the web page file may be subjected to a primary parsing process one by one, and characters encoded in the encoding formats supported by the parser may be successfully parsed, while characters encoded in the encoding formats not supported by the parser may fail to be parsed. If any character fails to be parsed, the character that failed to be parsed may be converted from the original encoding format to the target encoding format, and then the converted character may be parsed again until all characters in the web page file are parsed.

[0080] Alternatively, a single file block can be used as a parsing unit, and each time a file block is obtained, the current file block can be parsed for the first time. It is understandable that different file blocks in a web page file can be composed of characters in a variety of encoding formats, some of which are supported by the parser, while others are not. If all the characters in a file block are composed of characters encoded in an encoding format supported by the parser, the file block can be parsed successfully, otherwise the parsing fails. Therefore, each file block in the web page file can be parsed for the first time one by one. If any file block fails to parse, the file block that failed to parse can be converted from the original encoding format to the target encoding format, and then the converted file block can be parsed again until the parsing of all file blocks in the web page file is completed.

[0081] In some optional embodiments, the initial parsing process and the subsequent parsing processes can be completed by the parser, the encoding format conversion can be completed by the operating logic outside the parser, or the encoding format conversion process can be directly integrated into the parser, and the parser as a whole implements the solution provided by the embodiment of the present invention, which is not limited to this embodiment of the present invention.

[0082] The previous article introduced that the target encoding format can be a wide-byte encoding format and / or a specific character encoding format. Some parsers support the wide-byte encoding format, some parsers support the specific character encoding format, and some parsers support both encoding formats.

[0083] Based on this, optionally, when the parser only supports one encoding format, the process of converting the web page file from the original encoding format to the target encoding format can be implemented as: determining the encoding format supported by the parser among the wide byte encoding format and the specific character encoding format as the target encoding format; through the parser, converting the web page file from the original encoding format to the target encoding format.

[0084] Optionally, when the parser supports at least two encoding formats, since different encoding formats perform differently in applications, for example, some encoding formats have simple and easy-to-implement encoding algorithms, some encoding formats have fast encoding speeds and low error rates, and some encoding formats occupy less memory space, etc., the technician can pre-configure the performance that is prioritized, and determine the corresponding target encoding format based on the configuration results of the technician. For example, if the technician needs a solution that has a simple and easy-to-implement encoding algorithm but does not pay attention to encoding speed, the wide-byte encoding format can be determined as the target encoding format. When encountering a parsing unit that fails to parse, the parsing unit that fails to parse can be converted from the original encoding format to the wide-byte encoding format.

[0085] By adopting the present invention, no matter what type of encoding format is used to encode the web page file, the initial parsing process is directly performed first. If the parsing fails, the web page file is converted from the original encoding format to the target encoding format. The additional computing overhead caused by the initial parsing process leading to the parsing failure is much smaller than the overall computing overhead caused by traversing all the characters in a large number of web page files one by one. By adopting the present invention, the parsing of web page files can be achieved with an overall higher parsing efficiency of web page files.

[0086] The web page file parsing device of one or more embodiments of the present invention will be described in detail below. Those skilled in the art will appreciate that these web page file parsing devices can be configured using commercially available hardware components through the steps taught in this solution.

[0087] Figure 3 The schematic diagram of the structure of a web page file parsing device provided by an embodiment of the present invention is provided in a security proxy device. Figure 3 As shown, the device comprises:

[0088] A receiving module 31, configured to receive a web page file, wherein the web page file includes a network resource and address information corresponding to the network resource;

[0089] The parsing module 32 is used to perform a primary parsing process on the web page file;

[0090] The conversion module 33 is used to convert the web page file from the original encoding format to the target encoding format if the parsing fails, and perform parsing processing on the converted web page file;

[0091] The rewriting module 34 is used to rewrite the address information in the parsed web page file so that the rewritten address information points to the secure access web page corresponding to the network resource.

[0092] Optionally, the rewriting module 34 is further configured to:

[0093] If the parsing is successful, the address information in the parsed web page file is rewritten so that the rewritten address information points to the secure access web page corresponding to the network resource.

[0094] Optionally, the parsing module 32 is used to determine at least one parsing unit included in the web page file; and perform a primary parsing process on each parsing unit in sequence according to the order of each parsing unit in the web page file;

[0095] The conversion module 33 is used for converting the failed parsing unit from the original encoding format to the target encoding format if any parsing unit fails to be parsed, and performing parsing processing on the converted parsing unit.

[0096] Optionally, the parsing unit includes the entire web page file, a single character or a single file block.

[0097] Optionally, the conversion module 33 is used to:

[0098] Determine the type of parsing failure;

[0099] If the parsing failure type is an encoding format error, the web page file is converted from the original encoding format to the target encoding format.

[0100] Optionally, the target encoding format includes a wide-byte encoding format and / or a specific character encoding format, and the specific character encoding format includes a utf-8 character encoding format and / or a GBK character encoding format.

[0101] Optionally, the parsing process is performed by a parser, and the conversion module 33 is used to:

[0102] Determine an encoding format supported by the parser among the wide byte encoding format and the specific character encoding format as a target encoding format;

[0103] The web page file is converted from the original encoding format to the target encoding format through the parser.

[0104] Figure 3 The device shown can perform the aforementioned Figure 1 to Figure 2 The web page file parsing method provided in the illustrated embodiment, the detailed execution process and technical effects are described in the aforementioned embodiment and will not be repeated here.

[0105] In one possible design, the above Figure 3 The structure of the web page file parsing device shown can be implemented as a security proxy device, such as Figure 4As shown, the security proxy device may include: a processor 91 and a memory 92. The memory 92 stores executable code, and when the executable code is executed by the processor 91, the processor 91 can at least implement the above-mentioned Figure 1 to Figure 2 The web page file parsing method provided in the illustrated embodiment.

[0106] Optionally, the security proxy device may further include a communication interface 93 for communicating with other devices.

[0107] In addition, an embodiment of the present invention provides a non-transitory machine-readable storage medium, on which executable code is stored. When the executable code is executed by a processor of a security proxy device, the processor can at least implement the above-mentioned Figure 1 to Figure 2 The web page file parsing method provided in the illustrated embodiment.

[0108] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. Those of ordinary skill in the art may understand and implement the present invention without creative effort.

[0109] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course can also be implemented by combining hardware and software. Based on such an understanding, the above technical solution can essentially or in other words be embodied in the form of a computer product, and the present invention can be implemented in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0110] The web page file parsing method provided in the embodiment of the present invention can be executed by a certain program / software, and the program / software can be provided by the network side. The security proxy device mentioned in the above embodiment can download the program / software to a local non-volatile storage medium, and when it needs to execute the above web page file parsing method, the program / software is read into the memory by the CPU, and then the program / software is executed by the CPU to implement the web page file parsing method provided in the above embodiment. The execution process can refer to the above Figure 1 to Figure 2 Instructions in .

[0111] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A web page file parsing method, characterized in that: Applied to a security proxy device, the method comprises: Receiving a web page file sent by a server when a client requests a network resource, wherein the web page file includes the network resource requested by the client and address information corresponding to the network resource; Determine at least one parsing unit included in the web page file, wherein the parsing unit includes the entire web page file, a single character, or a single file block; and perform a primary parsing process on each parsing unit in sequence according to the order of each parsing unit in the web page file; If any parsing unit fails to parse, the parsing failure type is determined; if the parsing failure type is a coding format error, the coding format supported by the parser in the wide byte coding format and the specific character coding format is determined as the target coding format, and the parsing unit that failed to parse is converted from the original coding format to the target coding format by the parser, and the converted parsing unit is parsed; wherein the target coding format includes a wide byte coding format and / or a specific character coding format, and the specific character coding format includes a utf-8 character coding format and / or a GBK character coding format; the address information in the parsed web page file is rewritten so that the rewritten address information points to a secure access web page corresponding to the network resource; If the parsing is successful, the address information in the parsed web page file is rewritten so that the rewritten address information points to the secure access web page corresponding to the network resource.

2. A web page file parsing device, characterized in that: Set up in a security proxy device, the device includes: A receiving module, used to receive a web page file sent by the server when the client requests a network resource, wherein the web page file includes the network resource requested by the client and address information corresponding to the network resource; A parsing module, configured to determine at least one parsing unit contained in the web page file, wherein the parsing unit includes the entire web page file, a single character, or a single file block; and perform a primary parsing process on each parsing unit in sequence according to the order of each parsing unit in the web page file; A conversion module, used for determining the type of parsing failure if any parsing unit fails to parse; in the case where the parsing failure type is a coding format error, determining the coding format supported by the parser in the wide byte coding format and the specific character coding format as the target coding format, converting the parsing unit that failed to parse from the original coding format to the target coding format through the parser, and performing parsing processing on the converted parsing unit; wherein the target coding format includes the wide byte coding format and / or the specific character coding format, and the specific character coding format includes the utf-8 character coding format and / or the GBK character coding format; A rewriting module is used to rewrite the address information in the parsed web page file so that the rewritten address information points to the secure access web page corresponding to the network resource; if the parsing is successful, the address information in the parsed web page file is rewritten so that the rewritten address information points to the secure access web page corresponding to the network resource.

3. A security proxy device, characterized in that: include: A memory and a processor; wherein the memory stores executable code, and when the executable code is executed by the processor, the processor executes the web page file parsing method as claimed in claim 1.

4. A non-transitory machine-readable storage medium, characterized in that: The non-transitory machine-readable storage medium stores executable code, and when the executable code is executed by a processor of a security proxy device, the processor executes the web page file parsing method as claimed in claim 1.

Citation Information

Patent Citations

  • Messy code recovery system and method

    CN101551792A

  • Method and device for cross-domain acquisition of network picture resources

    CN110516171A