Message splitting method and device based on HTTP protocol

By carrying split parameters in the HTTP request header and using an interceptor to realize large packet splitting, the complexity and resource occupation of large data HTTP request and response processing problems in the existing technology are solved, and the simplified packet splitting is achieved. Processing process and reduced network resource usage.

CN119520646AActive Publication Date: 2025-02-25CHINA CONSTRUCTION BANK +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411572241.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-06
Publication Date
2025-02-25
Estimated Expiration
2044-11-06

AI Technical Summary

Technical Problem

The prior art increases complexity when processing large amounts of HTTP requests and responses, and leads to network congestion, transmission delay, storage and management pressure, and the client and server side need to implement specific splitting logic.

Method used

By carrying split parameters in the HTTP request header, the interceptor is used to realize the splitting of large packets, without modifying the server's business logic code, simplifying the message splitting process.

Benefits of technology

It realizes that the front-end does not need to perform split logic, only needs to set split parameters, simplifies the message split processing process, avoids code intrusion, and reduces network resource occupation and transmission delay.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119520646A_ABST
    Figure CN119520646A_ABST
Patent Text Reader

Abstract

The invention provides a message splitting method and device based on an HTTP (Hyper Text Transport Protocol), and relates to the technical field of computers, when a front end needs to obtain a large message of which the transmitted data volume is greater than a preset threshold value, a splitting parameter is added to a request header of an HTTP request corresponding to the large message; before the HTTP request reaches the service logic of the server, intercepting the HTTP request through an interceptor, and determining whether to split the message or not according to a splitting parameter in a request header; and when the HTTP request is processed, the HTTP response is generated and the message is split, intercepting the HTTP response through an interceptor, and splitting the response content of the HTTP response according to the value of the message number in the splitting parameter to generate a plurality of small messages. Therefore, the splitting parameters are carried in the HTTP request header, the front end does not need to carry out splitting logic, only the splitting parameters need to be set, large message splitting is achieved through the interceptor, service logic codes of a server do not need to be modified, the message splitting processing flow is simplified, and code invasion during message splitting is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a message splitting method and device based on HTTP protocol. Background Art

[0002] With the popularization of the Internet and the development of technology, network communication has played a vital role in modern applications. Hypertext Transfer Protocol (HTTP) is the most commonly used communication protocol in web applications and application programming interface (API) services. With the growth of data volume and the increase of application complexity, how to effectively process and manage HTTP requests and their responses, especially those involving the transmission of large amounts of data, is a problem worthy of attention.

[0003] In the related technology, for the splitting of large data volumes of messages (such as article content, large quantities of paginated data returned at one time) during network transmission, the client needs to implement specific splitting logic, and the server needs specific processing logic, which increases the complexity. In addition, large data volumes of messages also place higher demands on the bandwidth and network resources, which can easily lead to network congestion and transmission delays. The huge amount of data will also bring pressure on storage and management. Summary of the invention

[0004] The present invention aims to solve one of the technical problems in the related art at least to a certain extent.

[0005] To this end, the first purpose of the present invention is to propose a message splitting method based on the HTTP protocol. By carrying splitting parameters in the HTTP request header, the front end does not need to perform splitting logic, only needs to set the splitting parameters, and uses an interceptor to split large messages. There is no need to modify the business logic code of the server, thus avoiding code intrusion during message splitting.

[0006] The second objective of the present invention is to provide a message splitting device based on the HTTP protocol.

[0007] A third objective of the present invention is to provide an electronic device.

[0008] A fourth object of the present invention is to provide a non-transitory computer-readable storage medium storing computer instructions.

[0009] A fifth object of the present invention is to provide a computer program product.

[0010] To achieve the above object, a first embodiment of the present invention proposes a message splitting method based on the HTTP protocol, the method comprising:

[0011] When the front end needs to obtain a large message whose transmission data volume is greater than a preset threshold, a split parameter is added to the request header of the HTTP request corresponding to the large message, wherein the split parameter is determined by the number of split messages;

[0012] Before the HTTP request reaches the business logic of the server, the HTTP request is intercepted by the interceptor, and the message splitting is determined based on the splitting parameters in the request header.

[0013] After the HTTP request is processed according to the business logic of the server and an HTTP response is generated, and the message is split, the HTTP response is intercepted by an interceptor, and the response content of the HTTP response is split according to the value of the message quantity to generate multiple small messages.

[0014] To achieve the above object, a second embodiment of the present invention proposes a message splitting device based on the HTTP protocol, the device comprising:

[0015] Add a module for adding a splitting parameter to the request header of the HTTP request corresponding to the large message when the front end needs to obtain a large message whose transmission data volume is greater than a preset threshold, wherein the splitting parameter is determined by the number of split messages;

[0016] The interception module is used to intercept HTTP requests through an interceptor before the HTTP requests reach the business logic of the server, and determine whether to split the message according to the splitting parameters in the request header;

[0017] The splitting module is used to intercept the HTTP response through an interceptor after processing the HTTP request according to the server's business logic and generating the HTTP response, and split the response content of the HTTP response according to the value of the number of messages to generate multiple small messages.

[0018] To achieve the above-mentioned purpose, the third aspect of the present invention proposes an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in the first aspect.

[0019] In order to achieve the above-mentioned purpose, the fourth aspect of the present invention proposes a non-transitory computer-readable storage medium storing computer instructions, where the computer instructions are used to enable the computer to execute the method described in the first aspect.

[0020] In order to achieve the above-mentioned purpose, a fifth aspect of the present invention provides a computer program product, and when the computer program is executed by a processor, it implements the method described in the first aspect.

[0021] The message splitting method, device, electronic device, storage medium and computer program product based on the HTTP protocol provided by the embodiment of the present invention, when the front end needs to obtain a large message with a data volume greater than a preset threshold, the splitting parameter is added to the request header of the HTTP request corresponding to the large message; before the HTTP request reaches the business logic of the server, the HTTP request is intercepted by an interceptor, and whether to perform message splitting is determined according to the splitting parameter in the request header; after the HTTP request is processed and the HTTP response is generated, and the message splitting is performed, the HTTP response is intercepted by the interceptor, and the response content of the HTTP response is split according to the value of the number of messages in the splitting parameter to generate multiple small messages. Therefore, by carrying the splitting parameter in the HTTP request header, the front end does not need to perform the splitting logic, only needs to set the splitting parameter, and uses the interceptor to realize the splitting of large messages, without modifying the business logic code of the server, simplifying the message splitting process, and avoiding code intrusion during message splitting.

[0022] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0024] Figure 1 A schematic diagram of a flow chart of a message splitting method based on the HTTP protocol provided by an embodiment of the present invention;

[0025] Figure 2 A log recording system according to an embodiment of the present invention is provided;

[0026] Figure 3 A flow chart based on http request log printing and large message to small message splitting provided by an embodiment of the present invention;

[0027] Figure 4 A schematic structural diagram of a message splitting device based on HTTP protocol provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0028] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and should not be construed as limiting the present invention.

[0029] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in the present invention are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of relevant countries and regions.

[0030] The acquisition, transmission, storage, use, and processing of data in the technical solution of the present invention are in compliance with the relevant provisions of relevant laws and regulations.

[0031] It should be noted that in the embodiments of the present invention, certain software, components, models and other existing solutions in the industry may be mentioned, which should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present invention, but it does not mean that the inventor has or will necessarily use the solution.

[0032] The following describes a method and device for splitting HTTP-based messages according to an embodiment of the present invention with reference to the accompanying drawings.

[0033] Figure 1 A flowchart of a message splitting method based on the HTTP protocol provided by an embodiment of the present invention.

[0034] like Figure 1 As shown, the method comprises the following steps:

[0035] Step 101, when the front end needs to obtain a large message whose transmission data volume is greater than a preset threshold, a splitting parameter is added to the request header corresponding to the large message, wherein the splitting parameter is determined by the number of split messages.

[0036] Specifically, the HTTP request header (HTTP HEADER) contains a custom field, such as X-Split-Count, which is used to indicate how many small messages the server splits a large message into. This design allows the front-end to dynamically control the data splitting granularity according to actual needs without making any changes to the back-end (server) logic. It has high flexibility: the front-end can decide whether and how to split large messages based on network conditions or specific needs. Compatibility: This splitting parameter is compatible with the existing Hypertext Transfer Protocol (HTTP) standard and does not affect the normal HTTP request processing flow. When the front-end initiates an HTTP request, it checks whether all HTTP requested resources are large messages (such as files, videos, etc.). If so, the value of X-Split-Count (number of messages) is set according to the preset strategy, and the front-end sends the HTTP request containing the request header to the back-end server.

[0037] Step 102: Before the HTTP request reaches the service logic of the server, the HTTP request is intercepted by an interceptor, and it is determined whether to perform message splitting according to the splitting parameters in the request header.

[0038] In some embodiments, before the HTTP request reaches the business logic of the server, the HTTP request is intercepted by an interceptor, and according to the splitting parameters in the request header, it is determined whether to perform message splitting. One implementation method can be that before the HTTP request reaches the business logic of the server, the HTTP request is intercepted by an interceptor; if the field of the number of messages of the splitting parameter in the request header corresponding to the HTTP request exists and the value is not empty, it is marked as splitting the HTTP request, and it is determined to perform message splitting. Thus, the front end can dynamically adjust the splitting parameters (such as req_part_size) of large messages according to network conditions or user needs. This flexibility allows the server corresponding system to maintain good performance under different network conditions. The splitting parameters can be set separately in each HTTP request, allowing specific optimization for different data types or request scenarios to achieve on-demand optimization.

[0039] Further, an interceptor is a design pattern for intercepting and processing HTTP requests before the HTTP request reaches the target processor (or before the business logic of the server). In the present invention, the interceptor is used to read the splitting parameters in the request header and decide whether and how to split the message according to the splitting parameters.

[0040] Specifically, request interception: Before the HTTP request reaches the server's business logic, the interceptor checks the message size (req_part_size) field in the split parameter. If the field exists and the value of req_part_size is valid, the interceptor marks the original HTTP request as a split HTTP request.

[0041] Step 103, after the HTTP request is processed according to the business logic of the server and an HTTP response is generated, and the message is split, the HTTP response is intercepted by an interceptor, and the response content of the HTTP response is split according to the value of the message quantity to generate multiple small messages.

[0042] In some embodiments, after generating multiple small messages, it also includes: adding responsive metadata to each small message to reassemble the large message on the client based on the metadata; wherein the metadata is the serial number of the small message and the current number of blocks of the split small message.

[0043] Further, response processing: When the HTTP request is processed according to the server's business logic and the HTTP response is generated, the interceptor intervenes again. If the HTTP request is marked as a split HTTP request, the interceptor splits the response content of the HTTP response according to the value of req_part_size, generates multiple small messages, and attaches the corresponding sequence number req_part_uuid and the current block number req_part_index so that the client can reassemble correctly. As a result, there is no need to modify the existing front-end and back-end core codes, avoiding potential compatibility and stability issues and ensuring non-intrusiveness.

[0044] In addition, interceptors can be easily extended to support other functions, such as data compression, encryption, etc. Develop components based on the interceptor pattern to ensure seamless integration with existing network (Web) frameworks and improve scalability. When processing HTTP requests and responses, interceptors manage the splitting and merging logic of large messages in a unified manner.

[0045] In some other embodiments, when the client reassembles the message abnormally, the abnormal small message of the client reassembles the message abnormally through metadata to reassemble the large message. Thus, by splitting the large message into multiple small messages, the amount of data transmitted in a single time is reduced. This method is particularly suitable for network environments with limited bandwidth or high latency, reducing network congestion and delay. The probability of successful transmission of small messages is higher. Even if a small message fails to be transmitted, only the part needs to be retransmitted without retransmitting the entire large message, which improves the reliability and efficiency of the overall transmission.

[0046] In addition, in a high-concurrency environment, small message transmission reduces the network resource usage of a single HTTP request and improves the concurrent processing capability of the system. Through segmented transmission and parallel processing, the user's waiting time is reduced, the response time is reduced, and the user experience is improved.

[0047] The message splitting method based on the HTTP protocol of the embodiment of the present invention adds a splitting parameter to the request header of the HTTP request corresponding to the large message when the front end needs to obtain a large message whose transmission data volume is greater than a preset threshold; before the HTTP request reaches the business logic of the server, the HTTP request is intercepted by an interceptor, and whether to perform message splitting is determined according to the splitting parameter in the request header; after the HTTP request is processed and an HTTP response is generated, and the message splitting is performed, the HTTP response is intercepted by an interceptor, and the response content of the HTTP response is split according to the value of the number of messages in the splitting parameter to generate multiple small messages. Therefore, by carrying the splitting parameter in the HTTP request header, the front end does not need to perform the splitting logic, only needs to set the splitting parameter, and uses the interceptor to realize the splitting of large messages, without modifying the business logic code of the server, simplifying the message splitting process, and avoiding code intrusion during message splitting.

[0048] In order to clearly illustrate the above embodiment, this embodiment also provides a recording schematic diagram of a log recording system, such as Figure 2 shown.

[0049] like Figure 2 As shown, the following steps are included:

[0050] Step 201, obtain the life cycle data of each HTTP request through a pre-configured centralized interface, and record the life cycle data of each HTTP request through a preset logging system, wherein the life cycle data includes a request log, a split log, and a response log for each HTTP request.

[0051] In some embodiments, the request log includes the timestamp, request URL, request method, and splitting parameters carried in the request header of each HTTP request; the splitting log includes the data size corresponding to the HTTP request before splitting, the number of small messages after splitting, and the data size corresponding to the small messages; the response log includes the response status code and response time of the HTTP response. In this way, full process coverage can be achieved: covering the entire life cycle of the HTTP request, which is helpful for monitoring, performance analysis, and troubleshooting. At the same time, a unified method is used to record logs to ensure the consistency of data format and structure, which is convenient for subsequent analysis and processing.

[0052] Optionally, you can use a centralized log management tool or platform (such as ELK Stack) group as a logging system to collect and analyze logs. Define the format and structure of logs (request logs, split logs, and response logs) to ensure that log data between different modules and services can be seamlessly connected.

[0053] Among them, the timestamp of each HTTP request is used to calculate the request time for timing analysis; the request Uniform Resource Locator (URL) and method are used to record the target URL and the method used (such as GET, POST, etc.) of each HTTP request; HTTP requests and responses include the request body, and key information in the request header and response header, such as User-Agent, Content-Type, etc.; the response status code is used to record the server's response status to the HTTP request, helping to determine the processing result of the HTTP request; the response time is used to calculate the time difference between the HTTP request and the response, and analyze network performance.

[0054] Optionally, the preset log recording system filters and classifies the life cycle data according to preset rules, wherein the preset rules are set by the request type or response status of the HTTP request, thereby improving the efficiency and accuracy of the log recording.

[0055] Step 202: The logging system is further configured to record life cycle data of each HTTP request of a message whose amount of transmitted data is less than or equal to a preset threshold.

[0056] In some embodiments, when the amount of data transmitted is less than or equal to a preset threshold, there is no req_part_size field or the value of req_part_size is valid, there is no need to split the HTTP request, and network transmission is performed directly to obtain the target HTTP response. At the same time, the logging system records the life cycle data of the above message corresponding to the HTTP request and response process to facilitate subsequent management.

[0057] The logging system of the embodiment of the present invention obtains the life cycle data of each HTTP request through a pre-configured centralized interface, and records the life cycle data of each HTTP request through a preset logging system, wherein the life cycle data includes the request log, split log and response log of each HTTP request; the logging system is also used to record the life cycle data of each HTTP request of the message whose data volume is less than or equal to the preset threshold. Therefore, the life cycle data of each HTTP request recorded is of great significance to these system monitoring, performance analysis and troubleshooting, and a unified logging format and structure are used to ensure data consistency, which is convenient for subsequent analysis and processing.

[0058] In summary, the present invention also proposes a flow chart based on http request log printing and large message to small message splitting, such as Figure 3 As shown, the front end can implement the Fetch API or other HTTP client libraries using the JavaScript script to send HTTP requests, and set the split parameter (req_part_size) in the request header of the HTTP request. The server completely relies on the interceptor to process the code without intrusion, process the returned multiple small messages, and reassemble them into the original large message for display or storage. The back end integrates the interceptor in the server framework (such as Express, Django, Spring, etc.) to process the split logic; then the request log, split log and response log of the HTTP request are uniformly recorded through the logging system for easy analysis and monitoring; thereby simplifying the HTTP request processing process.

[0059] With respect to the HTTP request processing flow, the design of the present invention ensures that the original HTTP request processing flow of the front-end and back-end remains unchanged, and only the splitting parameters need to be added. For the front-end developer, it is only necessary to add custom request headers such as req_part_size in the request. The back-end completely relies on the interceptor processing, and there is no need to modify the existing business logic code. Developers only need to focus on the business logic, without worrying about the splitting and transmission of large messages, simplifying development and maintenance; reducing the scope and impact of changes to the server corresponding system, reducing the possibility of errors, and improving system stability.

[0060] Furthermore, on the front end, a custom request header is set through the HTTP client library (such as Axios, Fetch, etc.). The back end handles the splitting logic through the interceptor middleware without modifying the core processing code. Efficient data transmission can be achieved: by splitting large messages, the amount of data transmitted in a single time is effectively reduced, bandwidth occupancy and transmission time are reduced, and the utilization of network resources is optimized. Detailed and consistent logging is provided to help system administrators monitor and analyze system performance and enhance log management. By using interceptors and HTTP HEADER, functional expansion can be achieved without affecting the existing system, facilitating system integration and maintenance to achieve non-invasive expansion. The front end can dynamically adjust the splitting parameters according to actual needs, and the back end automatically processes according to the parameters to adapt to different network environments and application scenarios to achieve flexible system configuration.

[0061] In order to implement the above embodiment, the present invention also proposes a message splitting device based on the HTTP protocol.

[0062] Figure 4 A schematic structural diagram of a message splitting device based on HTTP protocol provided by an embodiment of the present invention.

[0063] like Figure 4 As shown, the HTTP protocol-based message splitting device 40 includes: an adding module 41, an intercepting module 42, and a splitting module 43.

[0064] An adding module 41 is used to add a splitting parameter to a request header of an HTTP request corresponding to a large message when the front end needs to obtain a large message whose transmission data volume is greater than a preset threshold, wherein the splitting parameter is determined by the number of split messages;

[0065] The interception module 42 is used to intercept the HTTP request through an interceptor before the HTTP request reaches the business logic of the server, and determine whether to perform message splitting according to the splitting parameters in the request header;

[0066] The splitting module 43 is used to intercept the HTTP response through an interceptor after processing the HTTP request according to the server's business logic and generating an HTTP response, and split the response content of the HTTP response according to the value of the number of messages to generate multiple small messages.

[0067] Furthermore, in a possible implementation of the embodiment of the present invention, the interception module 42 is specifically configured to:

[0068] Before the HTTP request reaches the business logic of the server, the HTTP request is intercepted by the interceptor;

[0069] If the field of the number of messages of the split parameter in the request header corresponding to the HTTP request exists and the value is not empty, it is marked as a split HTTP request, and it is determined to split the message.

[0070] Furthermore, in a possible implementation of the embodiment of the present invention, the splitting module 43 is further specifically configured to:

[0071] Adding corresponding metadata to each small message, so as to reassemble the large message on the client side based on the metadata;

[0072] The metadata includes the sequence number of the small message and the current block number of the small message after being split.

[0073] Furthermore, in a possible implementation of the embodiment of the present invention, when the client reassembles the message abnormally, the abnormal small message of the client reassembles the message abnormally is retransmitted through metadata to reassemble the large message.

[0074] Furthermore, in a possible implementation of the embodiment of the present invention, the device further includes:

[0075] A first recording module, used to obtain the life cycle data of each HTTP request through a pre-configured centralized interface, and record the life cycle data of each HTTP request through a preset logging system, wherein the life cycle data includes a request log, a split log, and a response log for each HTTP request;

[0076] The second recording module is used for the log recording system to record the life cycle data of each HTTP request of the message whose transmitted data volume is less than or equal to a preset threshold.

[0077] Furthermore, in a possible implementation method of an embodiment of the present invention, the request log includes the timestamp, request URL, request device, and splitting parameters carried in the request header of each HTTP request; the splitting log includes the data size corresponding to the HTTP request before splitting, the number of small messages after splitting, and the data size corresponding to the small messages; the response log includes the response status code and response time of the HTTP response.

[0078] Furthermore, in a possible implementation of the embodiment of the present invention, the device further includes:

[0079] The filtering module is used for the preset log recording system to filter and classify the life cycle data according to the preset rules. The preset rules are set by the request type or response status of the HTTP request.

[0080] The message splitting device based on the HTTP protocol of the embodiment of the present invention adds a splitting parameter to the request header of the HTTP request corresponding to the large message when the front end needs to obtain a large message with a transmission data volume greater than a preset threshold value; before the HTTP request reaches the business logic of the server, the HTTP request is intercepted by an interceptor, and whether to perform message splitting is determined according to the splitting parameter in the request header; after the HTTP request is processed and an HTTP response is generated, and the message splitting is performed, the HTTP response is intercepted by an interceptor, and the response content of the HTTP response is split according to the value of the number of messages in the splitting parameter to generate multiple small messages. Therefore, by carrying the splitting parameter in the HTTP request header, the front end does not need to perform the splitting logic, only needs to set the splitting parameter, and uses the interceptor to realize the splitting of large messages, without modifying the business logic code of the server, simplifying the message splitting process, and avoiding code intrusion during message splitting.

[0081] In order to implement the above embodiment, the present invention further provides an electronic device, including:

[0082] at least one processor; and

[0083] a memory communicatively connected to the at least one processor; wherein,

[0084] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the aforementioned method.

[0085] In order to implement the above embodiment, the present invention further proposes a non-transitory computer-readable storage medium storing computer instructions, where the computer instructions are used to enable the computer to execute the above method.

[0086] In order to implement the above embodiments, the present invention further provides a computer program product, including a computer program, wherein the computer program implements the above method when executed by a processor.

[0087] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0088] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0089] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present invention belong.

[0090] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute the instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.

[0091] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0092] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0093] In addition, each functional unit in each embodiment of the present invention may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0094] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present invention have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present invention. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present invention.

Claims

1. A message splitting method based on HTTP protocol, characterized in that: The method comprises: When the front end needs to obtain a large message whose transmission data volume is greater than a preset threshold, a split parameter is added to the request header of the HTTP request corresponding to the large message, wherein the split parameter is determined by the number of split messages; Before the HTTP request reaches the business logic of the server, the HTTP request is intercepted by the interceptor, and the message splitting is determined based on the splitting parameters in the request header. After the HTTP request is processed according to the business logic of the server and an HTTP response is generated, and the message is split, the HTTP response is intercepted by an interceptor, and the response content of the HTTP response is split according to the value of the message quantity to generate multiple small messages.

2. The method according to claim 1, characterized in that Before the HTTP request reaches the business logic of the server, the HTTP request is intercepted by an interceptor, and according to the splitting parameters in the request header, whether to perform message splitting includes: Before the HTTP request reaches the business logic of the server, the HTTP request is intercepted by the interceptor; If the field of the number of messages of the split parameter in the request header corresponding to the HTTP request exists and the value is not empty, it is marked as a split HTTP request, and it is determined to split the message.

3. The method according to claim 1, characterized in that After generating multiple small messages, it also includes: Adding corresponding metadata to each small message, so as to reassemble the large message on the client side based on the metadata; The metadata includes the sequence number of the small message and the current block number of the small message after being split.

4. The method according to claim 3, characterized in that When the client reassembles the message abnormally, the abnormal small message of the client reassembles the message abnormally through metadata to reassemble the large message.

5. The method according to claim 1, characterized in that: The method further comprises: Obtain life cycle data of each HTTP request through a pre-configured centralized interface, and record the life cycle data of each HTTP request through a preset logging system, wherein the life cycle data includes a request log, a split log, and a response log for each HTTP request; The logging system is also used to record the life cycle data of each HTTP request of a message whose transmitted data volume is less than or equal to a preset threshold.

6. The method according to claim 5, characterized in that The request log includes the timestamp, request URL, request method, and splitting parameters carried in the request header of each HTTP request; the splitting log includes the data size corresponding to the HTTP request before splitting, the number of small messages after splitting, and the data size corresponding to the small messages; the response log includes the response status code and response time of the HTTP response.

7. The method according to claim 5, characterized in that The method further comprises: The preset logging system filters and classifies the lifecycle data according to preset rules, wherein the preset rules are set by the request type or response status of the HTTP request.

8. A message splitting device based on HTTP protocol, characterized in that: The device comprises: Add a module for adding a splitting parameter to the request header of the HTTP request corresponding to the large message when the front end needs to obtain a large message whose transmission data volume is greater than a preset threshold, wherein the splitting parameter is determined by the number of split messages; The interception module is used to intercept HTTP requests through an interceptor before the HTTP requests reach the business logic of the server, and determine whether to split the message according to the splitting parameters in the request header; The splitting module is used to intercept the HTTP response through an interceptor after processing the HTTP request according to the server's business logic and generating the HTTP response, and split the response content of the HTTP response according to the value of the number of messages to generate multiple small messages.

9. The device according to claim 8, characterized in that The interception module is specifically used for: Before the HTTP request reaches the business logic of the server, the HTTP request is intercepted by the interceptor; If the field of the number of messages of the split parameter in the request header corresponding to the HTTP request exists and the value is not empty, it is marked as a split HTTP request, and it is determined to split the message.

10. The device according to claim 8, characterized in that The split module is also specifically used for: Adding corresponding metadata to each small message, so as to reassemble the large message on the client side based on the metadata; The metadata includes the sequence number of the small message and the current block number of the small message after being split.

11. The device according to claim 10, characterized in that When the client reassembles the message abnormally, the abnormal small message of the client reassembles the message abnormally through metadata to reassemble the large message.

12. The device according to claim 8, characterized in that The device also includes: A first recording module, used to obtain the life cycle data of each HTTP request through a pre-configured centralized interface, and record the life cycle data of each HTTP request through a preset logging system, wherein the life cycle data includes a request log, a split log, and a response log for each HTTP request; The second recording module is used for the log recording system to record the life cycle data of each HTTP request of the message whose transmitted data volume is less than or equal to a preset threshold.

13. The device according to claim 12, characterized in that The request log includes the timestamp, request URL, request device, and splitting parameters carried in the request header of each HTTP request; the splitting log includes the data size corresponding to the HTTP request before splitting, the number of small messages after splitting, and the data size corresponding to the small messages; the response log includes the response status code and response time of the HTTP response.

14. The device according to claim 12, characterized in that The device also includes: The filtering module is used for the preset log recording system to filter and classify the life cycle data according to the preset rules. The preset rules are set by the request type or response status of the HTTP request.

15. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.

16. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-7.

17. A computer program product, characterized in that The invention comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Client HTTP retrieval full-index container format media resource time slice method

    CN103747065A

  • Fragmented data caching and accessing method and device, terminal and storage medium

    CN113590915A

  • Practical implementation aspects of unicast fetch for HTTP streaming over embms

    US20150172066A1