Message splitting method and device based on HTTP protocol

By including splitting parameters in the HTTP request header and using interceptors to split large messages, the complexity of processing large volumes of HTTP messages is solved, a simplified processing flow without code intrusion is achieved, and network transmission efficiency and system stability are improved.

CN119520646BActive Publication Date: 2025-12-09CHINA CONSTRUCTION BANK +1
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In existing technologies, splitting large amounts of HTTP messages increases complexity, consumes bandwidth and network resources, leads to network congestion and transmission delays, and requires modification of server business logic code.

Method used

By including splitting parameters in the HTTP request header and using an interceptor, large messages can be split without modifying the server's business logic code. The frontend sets the splitting parameters and uses the interceptor to split the message into multiple smaller messages.

Benefits of technology

It simplifies the message splitting process, avoids code intrusion, reduces network congestion and latency, and improves transmission efficiency and system stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119520646B_ABST
    Figure CN119520646B_ABST
Patent Text Reader

Abstract

The application provides a message splitting method and device based on an HTTP protocol, and relates to the technical field of computers.When a large message whose data volume to be acquired at a front end is greater than a preset threshold value, splitting parameters are added to a request header of a corresponding HTTP request of the large message;before an HTTP request reaches a service logic of a server, the HTTP request is intercepted by an interceptor, and whether message splitting is performed is determined according to the splitting parameters in the request header;after the HTTP request is processed and an HTTP response is generated, and in the case that 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 message quantity in the splitting parameters to generate multiple small messages.Thus, by carrying the 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 large message splitting is realized by using the interceptor, without the need to modify the service logic code of the server, so that 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 application relates to the technical field of computer, and in particular, to a message splitting method and device based on HTTP protocol. BACKGROUND

[0002] With the popularization of the Internet and the development of technology, network communication plays 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 involving large data volume transmission, is a problem worth attention.

[0003] In related technologies, for the splitting of large data volume messages (such as article content, a large number of page data returned at a time) in network transmission, the client needs to implement specific splitting logic, and the server needs specific processing logic, which increases complexity, and the occupation of bandwidth and network resources by large data volume messages also puts forward higher requirements, which is easy to cause network congestion and transmission delay, and the large data volume also brings pressure on storage and management. SUMMARY

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

[0005] To this end, the first object of the present application is to propose a message splitting method based on HTTP protocol, which carries splitting parameters in the HTTP request header, realizes that the front end does not need to perform splitting logic, only needs to set the splitting parameters, and utilizes an interceptor to realize large message splitting, without modifying the business logic code of the server, thereby avoiding code intrusion when splitting messages.

[0006] The second object of the present application is to propose a message splitting device based on HTTP protocol.

[0007] The third object of the present application is to propose an electronic device.

[0008] The fourth object of the present application is to propose a non-transitory computer readable storage medium storing computer instructions.

[0009] The fifth object of the present application is to propose a computer program product.

[0010] To achieve the above objects, the first aspect of the present application proposes a message splitting method based on HTTP protocol, which comprises:

[0011] When the data amount of the transmitted large message required to be acquired by the front end is greater than a preset threshold, a splitting parameter is added to the request header of the HTTP request corresponding to the large message, wherein the splitting 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 an interceptor, and whether to split the message is determined according to the splitting parameter in the request header;

[0013] In the case that 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 number of messages to generate multiple small messages.

[0014] To achieve the above purpose, the second aspect of the present application provides a message splitting device based on HTTP protocol, the device comprises:

[0015] The adding module is configured to add a splitting parameter to the request header of the HTTP request corresponding to the large message when the data amount of the transmitted large message required to be acquired by the front end is greater than a preset threshold, wherein the splitting parameter is determined by the number of split messages;

[0016] The intercepting module is configured to intercept the HTTP request by an interceptor before the HTTP request reaches the business logic of the server, and determine whether to split the message according to the splitting parameter in the request header;

[0017] The splitting module is configured to intercept the HTTP response by an interceptor in the case that the HTTP request is processed according to the business logic of the server and an HTTP response is generated, and the message is split, 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 purpose, the third aspect of the present application provides an electronic device, comprising: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores instructions executable 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 execute the method of the first aspect.

[0019] To achieve the above purpose, the fourth aspect of the present application provides a non-transitory computer readable storage medium storing computer instructions, the computer instructions are used to make the computer execute the method of the first aspect.

[0020] To achieve the above object, the fifth aspect of the present application provides a computer program product, the computer program realizes the method of the first aspect when executed by a processor.

[0021] The HTTP protocol-based message splitting method and device provided by the embodiments of the present application, the electronic device, the storage medium and the computer program product add the 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 data amount greater than a preset threshold; intercept the HTTP request through the interceptor before the HTTP request reaches the business logic of the server, and determine whether to perform message splitting according to the splitting parameter in the request header; in the case that the HTTP request is processed and the HTTP response is generated, and the message splitting is performed, the HTTP response is intercepted through the interceptor, and the response content of the HTTP response is split according to the value of the message quantity 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 splitting logic, only needs to set the splitting parameter, and the interceptor is used to implement large message splitting, without the need to modify the business logic code of the server, so that the message splitting processing flow is simplified, and code intrusion during message splitting is avoided.

[0022] Additional aspects and advantages of the application will be set forth in part in the description which follows, and in part will become apparent to those skilled in the art upon examination of the following and / or can be learned by practice of the application. BRIEF DESCRIPTION OF DRAWINGS

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

[0024] Figure 1 A flowchart of a HTTP protocol-based message splitting method provided by an embodiment of the present application;

[0025] Figure 2 A recording schematic diagram of a log recording system provided by an embodiment of the present application;

[0026] Figure 3 A flowchart of a HTTP request log printing and large message to small message splitting process provided by an embodiment of the present application;

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

[0028] Embodiments of the present application are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar notations represent the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by reference to the drawings are exemplary and are intended to explain the present application, and cannot be understood as a limitation of the present application.

[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 for analysis, stored data, displayed data, etc.) and signals involved in the present application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0030] The acquisition, transmission, storage, use, processing, etc. of data in the technical solutions of the present application all comply with the relevant provisions of relevant laws and regulations.

[0031] It should be noted that in the embodiments of the present application, some existing industry solutions such as software, components, models, etc. may be mentioned, which should be considered as exemplary, and the purpose is only to illustrate the feasibility of the implementation of the technical solutions of the present application, but it does not mean that the inventors have or necessarily used the solution.

[0032] The HTTP protocol-based message splitting method and device of the embodiments of the present application are described below with reference to the accompanying drawings.

[0033] Figure 1 A flowchart of an HTTP protocol-based message splitting method provided by the embodiments of the present application.

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

[0035] Step 101: When a large message whose data amount to be transmitted at the front end is greater than a preset threshold, add a splitting parameter 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 contains a custom field, such as X-Split-Count, to indicate how many small messages the server will split the large message into. This design allows the front end to dynamically control the granularity of data splitting according to actual needs, without making any changes to the backend (server) logic. It has high flexibility: the front end can decide whether and how to split large messages according to 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 the resource of all HTTP requests is a large message (such as a file, video, etc.). If so, it sets the value of X-Split-Count (message number) according to the preset strategy, and the front end sends the HTTP request containing the request header to the server of the backend.

[0037] Step 102, before the HTTP request reaches the business logic of the server, the HTTP request is intercepted by the interceptor, and whether to perform message splitting is determined according to the splitting parameter in the request header.

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

[0039] Further, the interceptor is a design pattern used to intercept and process HTTP requests before they reach the target processor (or before the business logic of the server). In the present application, the interceptor is used to read the splitting parameter in the request header and determine whether and how to perform message splitting according to the splitting parameter.

[0040] Specifically, the request interception: before the HTTP request reaches the business logic of the server, the interceptor checks the field of the message quantity (req_part_size) 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, in the case of message splitting after the HTTP request is processed according to the business logic of the server and an HTTP response is generated, the HTTP response is intercepted by the 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, further comprising: attaching metadata of the response to each small message to reassemble the large message based on the metadata at the client side; wherein the metadata is the sequence number of the small message, the current block number of the small message after splitting.

[0043] Further, response processing: when the HTTP request is processed according to the business logic of the server and an 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 to generate multiple small messages, and attaches the corresponding sequence number req_part_uuid and the current block number req_part_index to ensure correct reassembly at the client side. Thus, there is no need to modify the existing front-end and back-end core code, avoiding potential compatibility and stability problems, and ensuring non-intrusiveness.

[0044] In addition, the interceptor can be easily extended to support other functions such as data compression, encryption, etc. Developing components based on the interceptor pattern ensures seamless integration with existing web frameworks, improving scalability. The interceptor uniformly manages the splitting and merging logic of large messages when processing HTTP requests and responses.

[0045] In still other embodiments, when the client reassembles the message abnormally, the abnormal small message of the client reassembling the message is retransmitted through the metadata to reassemble the large message. Thus, by splitting the large message into multiple small messages, the amount of data transmitted at a 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, and even if a certain small message fails to transmit, only that part needs to be retransmitted without retransmitting the entire large message, improving the reliability and efficiency of overall transmission.

[0046] In addition, in a high concurrency environment, small message transmission reduces the occupation of network resources by a single HTTP request, improving the concurrent processing capacity of the system. Through segmented transmission and parallel processing, the waiting time of the user is reduced, the response time is reduced, and the user experience is improved.

[0047] The message splitting method based on the HTTP protocol in the embodiment of the application adds the 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 data amount greater than a preset threshold; intercepts the HTTP request through an interceptor before the HTTP request reaches the business logic of the server, and determines whether to split the message according to the splitting parameter in the request header; in the case that the HTTP request is processed and an HTTP response is generated and the message is split, the HTTP response is intercepted through 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. In this way, by carrying the splitting parameter in the HTTP request header, the front end does not need to perform splitting logic, only needs to set the splitting parameter, and the interceptor is used to split the large message, without the need to modify the business logic code of the server, so that the message splitting processing flow is simplified and code intrusion during message splitting is avoided.

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

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

[0050] In step 201, the life cycle data of each HTTP request is obtained through a pre-configured centralized interface, and the life cycle data of each HTTP request is recorded through a preset log recording system, wherein the life cycle data includes request logs, splitting logs and response logs at each HTTP request.

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

[0052] Optionally, a centralized log management tool or platform (such as ELK Stack) group can be used as a log recording system for log collection and analysis. The format and structure of the logs (request logs, split logs, and response logs) are defined to ensure seamless integration of log data between different modules and services.

[0053] 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; the HTTP request and response include the request body, and the 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 response status of the server to the HTTP request, helping to judge the processing result of the HTTP request; the response time is used to calculate the time difference between the HTTP request and response, and analyze the network performance.

[0054] Optionally, the preset log recording system filters and classifies 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, thereby improving the efficiency and accuracy of log recording.

[0055] In step 202, the log recording system is also used to record the life cycle data of each HTTP request of the packet with a transmission data amount less than or equal to a preset threshold.

[0056] In some embodiments, when the transmission data amount of the packet is less than or equal to the preset threshold, there is no req_part_size field or the value of req_part_size is valid, the HTTP request does not need to be split, and direct network transmission is performed to obtain the target HTTP response. At the same time, the log recording system records the life cycle data of the HTTP request and response process corresponding to the above packet, which is convenient for subsequent management.

[0057] The log recording system of the embodiment of the application obtains the life cycle data of each HTTP request through the pre-configured centralized interface, records the life cycle data of each HTTP request through the preset log recording system, wherein the life cycle data includes the request log, the split log, and the response log of each HTTP request at the time; and the log recording system is also used to record the life cycle data of each HTTP request of the packet with a transmission data amount less than or equal to a preset threshold. Therefore, the life cycle data of each HTTP request recorded is of great significance for system monitoring, performance analysis, and fault troubleshooting, and a unified log recording format and structure are used to ensure data consistency and facilitate subsequent analysis and processing.

[0058] In summary, the application also proposes a printing and large message splitting flowchart based on HTTP request logs, as shown in Figure 3 The front end can implement the Fetch API or other HTTP client libraries using the script JavaScript to send HTTP requests, and set the splitting parameter (req_part_size) in the request header of the HTTP request. The server completely relies on the interceptor processing, and the implementation code is non-intrusive. The returned multiple small messages are processed and recombined into the original large message for display or storage. The backend integrates the interceptor in the server framework (such as Express, Django, Spring, etc.) to process the splitting logic. Through the log recording system, the request logs, splitting logs and response logs of HTTP requests are uniformly recorded, which is convenient for analysis and monitoring, thereby simplifying the HTTP request processing flow.

[0059] For the HTTP request processing flow, the design of the application ensures that the original HTTP request processing flow of the front and back ends remains unchanged, and only the splitting parameter needs to be added. For front-end developers, only the req_part_size custom request header needs to be added in the request. The backend completely relies on the interceptor processing and does not need to modify the existing business logic code. Developers only need to focus on business logic and do not need to worry about large message splitting and transmission problems, simplifying development and maintenance; reducing the scope and impact of server corresponding system changes, reducing the possibility of errors, and improving system stability.

[0060] Further, in the front end, the custom request header is set through the HTTP client library (such as Axios, Fetch, etc.). The backend processes the splitting logic through the interceptor middleware without modifying the core processing code. Efficient data transmission can be achieved: through the splitting of large messages, the data volume of single transmission is effectively reduced, the bandwidth occupation and transmission time are reduced, and the utilization of network resources is optimized. Detailed and consistent log records are provided to help system administrators monitor and analyze system performance, and enhanced log management. By using the interceptor and HTTP HEADER, the function is extended without affecting the existing system, which is convenient for system integration and maintenance to realize non-intrusive extension. The front end can dynamically adjust the splitting parameter according to actual needs, and the backend automatically processes according to the parameter, which is suitable for different network environments and application scenarios to realize flexible system configuration.

[0061] In order to realize the above-mentioned embodiments, the application also proposes a message splitting device based on the HTTP protocol.

[0062] Figure 4 A structural schematic diagram of a message splitting device based on the HTTP protocol provided for the embodiments of the application.

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

[0064] The adding module 41 is configured to add a splitting parameter to a request header of a large message corresponding to an HTTP request when the front end needs to acquire a large amount of data transmitted greater than a preset threshold, wherein the splitting parameter is determined by the number of split messages.

[0065] The intercepting module 42 is configured to intercept the HTTP request through an interceptor before the HTTP request reaches the business logic of the server, and determine whether to split the message according to the splitting parameter in the request header.

[0066] The splitting module 43 is configured to intercept the HTTP response through the interceptor after the HTTP request is processed according to the business logic of the server and an HTTP response is generated, and split the response content of the HTTP response according to the value of the number of messages to generate a plurality of small messages.

[0067] Further, in a possible implementation of the embodiment of the present application, the intercepting module 42 is specifically configured to:

[0068] intercept the HTTP request through the interceptor before the HTTP request reaches the business logic of the server;

[0069] when the field of the number of messages of the splitting parameter exists in the request header of the HTTP request and the value is not empty, mark the HTTP request as split and determine to split the message.

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

[0071] attach the metadata of the response to each small message to recombine the large message based on the metadata at the client side.

[0072] The metadata is the sequence number of the small message and the current block number of the small message after splitting.

[0073] Further, in a possible implementation of the embodiment of the present application, when the client side recombines the message abnormally, the abnormal small message of the client side recombination of the message is retransmitted through the metadata to recombine the large message.

[0074] Further, in a possible implementation of the embodiment of the present application, the device further comprises:

[0075] The first recording module is configured to acquire life cycle data of each HTTP request through a preconfigured centralized interface, and record the life cycle data of each HTTP request through a preset log recording system, wherein the life cycle data comprises request logs, split logs and response logs at each HTTP request time.

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

[0077] Further, in a possible implementation manner of the embodiment, the request logs comprise a timestamp, a request URL, a request device and a split parameter carried in a request header of each HTTP request; the split logs comprise a data size corresponding to the HTTP request before splitting, a small message quantity after splitting and a data size corresponding to the small message; and the response logs comprise a response status code and a response time of the HTTP response.

[0078] Further, in a possible implementation manner of the embodiment, the device further comprises:

[0079] The filtering module is configured to filter and classify the life cycle data according to a preset rule through the preset log recording system, wherein the preset rule is set through a request type or a response status of the HTTP request.

[0080] The message splitting device based on the HTTP protocol in the embodiment adds a split parameter into a request header of a large message corresponding to an HTTP request when the device needs to acquire the large message whose transmitted data amount is greater than a preset threshold in a front end; intercepts the HTTP request through an interceptor before the HTTP request reaches a service logic of a server, and determines whether to split the message according to the split parameter in the request header; intercepts the HTTP response through the interceptor after the HTTP request is processed and the HTTP response is generated, and splits the response content of the HTTP response according to a value of a message quantity in the split parameter to generate a plurality of small messages in the case of message splitting. Therefore, the split parameter is carried in the request header of the HTTP request, the front end does not need to perform splitting logic, only needs to set the split parameter, and the interceptor is used to split the large message, without the need to modify the service logic code of the server, so that the message splitting processing flow is simplified, and code invasion during message splitting is avoided.

[0081] In order to implement the above-mentioned embodiments, the present application further provides an electronic device, comprising:

[0082] at least one processor; and

[0083] a memory connected with the at least one processor in communication; wherein

[0084] The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the aforementioned method.

[0085] To achieve the above-mentioned embodiments, the present application further provides a non-transitory computer-readable storage medium storing computer instructions, the computer instructions being used to make the computer perform the aforementioned method.

[0086] To achieve the above-mentioned embodiments, the present application further provides a computer program product comprising a computer program, the computer program being implemented to perform the aforementioned method when executed by a processor.

[0087] In the description of the present specification, the description of the terms "one embodiment", "some embodiments", "an example", "a specific example", or "some examples" and the like means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present application. In the present specification, the illustrative description of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any appropriate manner in any one or more embodiments or examples. In addition, the person skilled in the art can combine and combine the different embodiments or examples described in the present specification and the features of the different embodiments or examples, without contradiction.

[0088] In addition, the terms "first", "second" are only for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined with "first", "second" can explicitly or implicitly include at least one of the features. In the description of the present application, the meaning of "a plurality of" is at least two, for example, two, three, etc., unless otherwise specifically limited.

[0089] Any process or method descriptions in flow charts or described elsewhere herein can be understood as representing code modules, segments, or portions of code which include one or more executable instructions for implementing the specified logical functions or steps, and the various embodiments of the present application contemplate that the modules, segments, or portions of code may be implemented in hardware, software, or a combination of both. In some embodiments, the various processes and methods described can be alternatively implemented in multi-threaded environments, distributed computing environments, or any other computing mechanism suitable for achieving the purposes of the embodiments.

[0090] The logic and / or steps represented in flow diagrams or otherwise described herein, for example, can be considered as a sequence of instructions to implement logic functions, and can be embodied in any computer-readable medium for use by an instruction execution system, apparatus, or device, such as a computer-based system, processor- containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. In the context of this specification, a "computer-readable medium" can be any means that can contain, store, communicate, propagate or transport the program for use by or in connection with the instruction execution system, apparatus, or device. The computer-readable medium can be a machine-readable storage device (e.g., magnetic, optical or other) a machine-readable storage diskette (e.g., floppy, flexible or other), a machine-readable storage card (e.g., RAM, ROM or other), a machine-readable storage tape (e.g., magnetic, optical or other), a machine-readable storage medium (e.g., a portable memory chip), a machine-readable signal, a machine-readable propagated signal, a machine-readable compressed signal, and the like. More specific examples (a non-exhaustive list) of the computer-readable medium include the following: an electrical connection having one or more wires (e.g., a bus that has thin film resistors for

[0091] It should be understood that aspects of the application can be implemented in hardware, software, firmware or combinations thereof. In the embodiments described above, various steps or methods can be implemented, in part, or in whole, in software / firmware that is stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any of the following techniques, or combinations thereof, can be used to implement the functions of the application: a discrete logic circuit(s) having logic gates for implementing logic functions upon data signals, an application specific integrated circuit having appropriate combinational logic gates, a programmable gate array(s) (PGA), a field programmable gate array (FPGA), and / or the like.

[0092] Those of skill in the art would understand that information and signals can be represented using any of a variety of technologies and techniques. For example, data, instructions, commands, information, signals, bits, symbols, and chips that can be referenced throughout the above description can be represented by voltages, currents, electromagnetic waves, magnetic fields or particles, optical fields or particles, or any combination thereof.

[0093] In addition, each function unit in each embodiment of the present application can be integrated in one processing module, or each unit can be physically present separately, or two or more units can be integrated in one module. The integrated module can be realized in the form of hardware or in the form of a software function module. When the integrated module is realized in the form of a software function module and sold or used as an independent product, it can also be stored in a computer readable storage medium.

[0094] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it should be understood that the above embodiments are exemplary and should not be construed as limiting the present application, and those skilled in the art can make changes, modifications, replacements and variations to the above embodiments within the scope of the present application.

Claims

1. A message segmentation method based on the HTTP protocol, characterized in that, The method includes: 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 corresponding HTTP request for the large message. The splitting parameter is determined by the number of messages to be split. Before the HTTP request reaches the server's business logic, the HTTP request is intercepted by an interceptor, and the message splitting is determined based on the splitting parameters in the request header. After processing the HTTP request and generating the HTTP response according to the server's business logic, and performing message splitting, the HTTP response is intercepted by an interceptor, and the response content is split into multiple smaller messages according to the number of messages.

2. The method according to claim 1, characterized in that, The process of intercepting HTTP requests before they reach the server's business logic, and determining whether to perform message splitting based on the splitting parameters in the request header, includes: Intercept the HTTP request using an interceptor before it reaches the server's business logic; If the field for the number of packets in the split parameter of the HTTP request header exists and its value is not empty, it is marked as an HTTP request to be split, and packet splitting is determined.

3. The method according to claim 1, characterized in that, After generating multiple small messages, the process also includes: Attach response metadata to each small message 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 number of blocks in the split small message.

4. The method according to claim 3, characterized in that, When a client encounters an error reassembling a message, the abnormal small message is retransmitted using metadata to reassemble the large message.

5. The method according to claim 1, characterized in that, The method further includes: The lifecycle data of each HTTP request is obtained through a pre-configured centralized interface, and the lifecycle data of each HTTP request is recorded through a preset logging system. The lifecycle data includes the request log, split log and response log for each HTTP request. The logging system is also used to record the lifecycle data of each HTTP request for messages 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 for each HTTP request; the splitting log includes the data size of the HTTP request before splitting, the number of small packets after splitting, and the data size of the small packets; 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 includes: The preset logging system filters and classifies lifecycle data according to preset rules; these preset rules are set based on the request type or response status of HTTP requests.

8. A message splitting device based on the HTTP protocol, characterized in that, The device includes: Add a module to add a splitting parameter to the request header of the corresponding HTTP request when the front end needs to obtain a large message with a data volume greater than a preset threshold. The splitting parameter is determined by the number of messages to be split. The interception module is used to intercept HTTP requests before they reach the server's business logic, and to determine whether to perform message splitting based on the splitting parameters in the request header. The splitting module is used to intercept HTTP responses after processing HTTP requests and generating HTTP responses according to the server's business logic and splitting the HTTP response content into multiple smaller messages based on the number of messages.

9. The apparatus according to claim 8, characterized in that, The interception module is specifically used for: Intercept the HTTP request using an interceptor before it reaches the server's business logic; If the field for the number of packets in the split parameter of the HTTP request header exists and its value is not empty, it is marked as an HTTP request to be split, and packet splitting is determined.

10. The apparatus according to claim 8, characterized in that, Splitting modules is also specifically used for: Attach response metadata to each small message 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 number of blocks in the split small message.

11. The apparatus according to claim 10, characterized in that, When a client encounters an error reassembling a message, the abnormal small message is retransmitted using metadata to reassemble the large message.

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

13. The apparatus 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 for each HTTP request; the splitting log includes the data size of the HTTP request before splitting, the number of small packets after splitting, and the data size of the small packets; the response log includes the response status code and response time of the HTTP response.

14. The apparatus according to claim 12, characterized in that, The device further includes: The filtering module is used by the preset log recording system to filter and classify lifecycle data according to 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 to enable the at least one processor to perform the method of any one of claims 1-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 perform the method according to any one of claims 1-7.

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

Citation Information

Patent Citations

  • 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