CN116684397A - Data item delimiting method, device, equipment and storage medium of data transmission protocol - Google Patents
Data item delimiting method, device, equipment and storage medium of data transmission protocol Download PDFInfo
- Publication number
- CN116684397A CN116684397A CN202310781168.XA CN202310781168A CN116684397A CN 116684397 A CN116684397 A CN 116684397A CN 202310781168 A CN202310781168 A CN 202310781168A CN 116684397 A CN116684397 A CN 116684397A
- Authority
- CN
- China
- Prior art keywords
- data
- byte
- buffer
- character string
- cursor
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/568—Storing data temporarily at an intermediate stage, e.g. caching
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/22—Parsing or analysis of headers
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D30/00—Reducing energy consumption in communication networks
- Y02D30/50—Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Computer And Data Communications (AREA)
Abstract
本说明书提供一种针对数据传输协议的数据项定界方法、装置、设备及存储介质,应用于数据接收端;接收所述数据发送端发送的数据,将接收到的数据缓存至所述第一缓冲区,将缓存至所述第一缓冲区的数据的首字节确定为目标字节,并迭代执行,直至对缓存至第一缓冲区的数据完成检测:从目标字节开始检测划分不同数据项的分隔字符串;若检测到分隔字符串,确定目标字节之后且位于检测到首个分隔字符串之前的数据为数据项,将检测出的数据项复制至第二缓冲区;将位于检测到的首个分隔字符串之后的数据首字节确定为目标字节。本说明书提供的方案可以实现在数据传输协议混合传输数据时,正确定界数据项,提高数据解析准确度。
This specification provides a data item delimitation method, device, device and storage medium for data transmission protocols, which are applied to the data receiving end; receive the data sent by the data sending end, and cache the received data in the first Buffering, determining the first byte of the data cached in the first buffer as the target byte, and performing iteratively until the detection of the data cached in the first buffer is completed: starting from the target byte to detect and divide different data The delimited string of the item; if the delimited string is detected, determine the data after the target byte and before the first delimited string is detected as the data item, and copy the detected data item to the second buffer; The first byte of data after the first delimited string received is determined as the target byte. The solution provided in this manual can realize the correct delimitation of data items and improve the accuracy of data analysis when data transmission protocols are mixed to transmit data.
Description
技术领域technical field
本说明书一个或多个实施例涉及网络通信技术领域,尤其涉及一种数据传输协议的数据项定界方法、装置、设备及存储介质。One or more embodiments of this specification relate to the field of network communication technologies, and in particular, to a data item demarcation method, device, device, and storage medium of a data transmission protocol.
背景技术Background technique
在数据传输协议下,数据接收端(如主机)每次接收到的数据包含一个或多个数据项,对应一种或多种数据类型。当多个不同数据类型的数据项混合传输时,传输内容均是字节流,由数据接收端从接收到的数据流中解析出各个数据项。在一些可能的实施例中,由于各个数据项的数据长度是不可预知的,因此需要将分隔字符串作为不同数据项之间的边界。Under the data transmission protocol, the data received by the data receiving end (such as the host) each time includes one or more data items, corresponding to one or more data types. When multiple data items of different data types are mixed and transmitted, the transmission content is a byte stream, and the data receiving end parses each data item from the received data stream. In some possible embodiments, since the data length of each data item is unpredictable, it is necessary to use the delimited character string as a boundary between different data items.
例如,基于http协议同时传输表单数据和文件数据的情况下,由于表单类型的数据项的数据长度较短,因此可以全部缓存在内存缓冲区中。而文件类型的数据项的数据长度可能较长,分隔字符串需要多次才能接收完整,而内存空间有限,所以在文件数据的数据长度不可预知的情况下,不便于将正在接收的文件数据一直缓存在内存缓冲区里直到接收完成。因此,在相关技术中,如果同时传输表单数据和文件数据,通常默认表单数据在前,文件数据在后;相应地,数据接收端也会默认先从接收到的数据中解析表单数据,再解析文件数据。也即,如果数据接收端解析出文件数据,则默认表单数据已经解析完毕,剩余的都是文件数据。For example, in the case of simultaneously transmitting form data and file data based on the http protocol, since the data length of the form-type data items is relatively short, all of them can be cached in the memory buffer. However, the data length of the data item of the file type may be long, and the delimited character string needs to be received several times before it can be completely received, and the memory space is limited, so when the data length of the file data is unpredictable, it is not convenient to keep the file data being received. Buffered in the memory buffer until the reception is complete. Therefore, in related technologies, if form data and file data are transmitted at the same time, usually the default form data is first and the file data is last; correspondingly, the data receiver will first parse the form data from the received data by default, and then file data. That is, if the data receiving end parses the file data, the default form data has been parsed, and the rest is file data.
在这种情况下,如果需要先传输文件数据,后传输表单数据,数据接收端会误认为本次传输的全部是文件数据,导致针对表单数据的数据项解析错误。In this case, if the file data needs to be transmitted first, and then the form data, the data receiving end will mistakenly believe that all the transmission is file data, resulting in an error in parsing the data items of the form data.
发明内容Contents of the invention
本申请提供一种数据传输协议的数据项定界方法,所述数据传输协议用于在数据发送端与数据接收端之间传输数据;所述方法应用于所述数据接收端;所述数据接收端接收到的数据包含一个或多个数据项;所述多个数据项对应于一种或多种数据类型;所述多个数据项中的各个数据项的数据长度是不固定的且不可预知的;所述数据接收端配置有用于为接收到的数据所包含的各个数据项定界的第一缓冲区,以及用于从接收到的数据中解析出各个数据项的第二缓冲区;所述方法包括:The present application provides a method for delimiting data items of a data transmission protocol, the data transmission protocol is used to transmit data between a data sending end and a data receiving end; the method is applied to the data receiving end; the data receiving end The data received by the terminal includes one or more data items; the multiple data items correspond to one or more data types; the data length of each data item in the multiple data items is not fixed and unpredictable The data receiving end is configured with a first buffer for delimiting each data item included in the received data, and a second buffer for parsing out each data item from the received data; The methods described include:
接收所述数据发送端发送的数据,将接收到的数据缓存至所述第一缓冲区,将缓存至所述第一缓冲区的数据的首字节确定为目标字节,并迭代执行以下步骤,直至对缓存至所述第一缓冲区的数据完成检测:receiving the data sent by the data sending end, buffering the received data into the first buffer, determining the first byte of the data buffered into the first buffer as the target byte, and performing the following steps iteratively , until the detection of the data buffered into the first buffer is completed:
从所述目标字节开始,检测用于划分不同数据项的分隔字符串;starting from said target byte, detecting a delimited string for delimiting different data items;
若检测到所述分隔字符串,则确定包含所述目标字节在内的位于所述目标字节之后且位于检测到的首个分隔字符串之前的数据为数据项,并将检测出的数据项复制至所述第二缓冲区;If the delimited character string is detected, it is determined that the data including the target byte after the target byte and before the first detected delimited character string is a data item, and the detected data Items are copied to said second buffer;
将位于首个检测到的所述分隔字符串之后的数据的首字节确定为所述目标字节。determining the first byte of data after the first detected delimited character string as the target byte.
可选的,所述方法还包括:Optionally, the method also includes:
所述接收所述数据发送端发送的数据并缓存至所述第一缓冲区,包括:The receiving the data sent by the data sending end and buffering the data in the first buffer includes:
将接收到的数据缓存至所述第一缓冲区,将第一游标指向缓存至所述第一缓冲区的数据的末字节对应的内存地址,并将第二游标指向缓存至所述第一缓冲区的数据的末字节的下一字节对应的内存地址;Cache the received data to the first buffer, point the first cursor to the memory address corresponding to the last byte of the data cached in the first buffer, and point the second cursor to the memory address cached in the first The memory address corresponding to the next byte of the last byte of the data in the buffer;
其中,所述第一游标用于指示缓存在所述第一缓冲区中的已完成检测的数据的末字节对应的内存地址;所述第二游标用于指示缓存在所述第一缓冲区中的未完成检测的数据的首字节对应的内存地址。Wherein, the first cursor is used to indicate the memory address corresponding to the last byte of the detected data cached in the first buffer; the second cursor is used to indicate the memory address cached in the first buffer The memory address corresponding to the first byte of the unfinished detection data in .
可选的,所述接收到的数据,包括请求报文或响应报文;Optionally, the received data includes a request message or a response message;
在将缓存至所述第一缓冲区的数据的首字节确定为目标字节之前,所述方法还包括:Before determining the first byte of the data buffered into the first buffer as the target byte, the method further includes:
获取所述请求报文的请求头中包含的所述分隔字符串;或者,获取所述响应报文的响应头中包含的所述分隔字符串。Acquiring the delimited character string contained in the request header of the request message; or acquiring the delimited character string contained in the response header of the response message.
可选的,所述从所述目标字节开始,检测用于划分不同数据项的分隔字符串,包括:Optionally, starting from the target byte, detecting a delimited character string for dividing different data items includes:
检测所述第一缓冲区中,所述第二游标指向字节对应的内存地址之前的数据是否包含所述分隔字符串;若包含所述分隔字符串,将所述第一游标指向检测到的所述首个分隔字符串首字节对应的内存地址,并将所述第一游标指向的内存地址之前的数据划分为数据项。Detect in the first buffer, whether the data before the memory address corresponding to the byte pointed to by the second cursor contains the delimited character string; if the delimited character string is included, point the first cursor to the detected The memory address corresponding to the first byte of the first delimited character string, and the data before the memory address pointed to by the first cursor are divided into data items.
可选的,在将检测出的数据项复制至所述第二缓冲区之后,所述方法还包括:Optionally, after copying the detected data item to the second buffer, the method further includes:
将所述第一缓冲区所在内存空间中未完成检测的数据覆盖式写入至所述第一缓冲区所在内存空间首字节对应的内存地址处。Overwrite the unfinished detection data in the memory space where the first buffer is located to the memory address corresponding to the first byte of the memory space where the first buffer is located.
可选的,从所述目标字节开始,检测用于划分不同数据项的分隔字符串之后,所述方法还包括:Optionally, starting from the target byte, after detecting the delimited character string used to divide different data items, the method further includes:
若检测不到所述分隔字符串,将所述第一游标指向所述分隔字符串末字节对应的内存地址,检测所述第一游标指向的字节与所述第二游标指向的字节之间的字节数是否不小于所述分隔字符串所占字节数;If the delimited character string cannot be detected, point the first cursor to the memory address corresponding to the end byte of the delimited character string, and detect the byte pointed to by the first cursor and the byte pointed to by the second cursor Whether the number of bytes between is not less than the number of bytes occupied by the delimited string;
若不小于所述分隔字符串所占字节数,将所述第一游标指向的字节的内存地址,与所述第二游标向前偏移一共所述分隔字符串所占字节数减一字节的字节数指向的内存地址这两者之间的数据复制至所述第二缓冲区;再将所述第一缓冲区中未复制至所述第二缓冲区的剩余数据覆盖式写入至所述第一缓冲区对应内存空间首字节对应的内存地址处。If it is not less than the number of bytes occupied by the delimited character string, the memory address of the byte pointed to by the first cursor and the forward offset of the second cursor are subtracted from the number of bytes occupied by the delimited character string The data between the memory address pointed to by the number of bytes of a byte is copied to the second buffer; then the remaining data not copied to the second buffer in the first buffer is overwritten Write to the memory address corresponding to the first byte of the memory space corresponding to the first buffer.
可选的,所述检测所述第一游标指向的字节与所述第二游标指向的字节之间的字节数是否不小于所述分隔字符串所占字节数,包括:Optionally, the detecting whether the number of bytes between the byte pointed to by the first cursor and the byte pointed to by the second cursor is not less than the number of bytes occupied by the delimited string includes:
若小于所述分隔字符串所占字节数,直接将所述第一游标指向的字节对应的内存地址,到所述第二游标指向的字节对应的内存地址这二者之间的数据覆盖式写入至所述第一缓冲区所在内存空间首字节对应的内存地址处。If it is less than the number of bytes occupied by the delimited character string, directly transfer the data between the memory address corresponding to the byte pointed to by the first cursor and the memory address corresponding to the byte pointed to by the second cursor Write overwriting to the memory address corresponding to the first byte of the memory space where the first buffer is located.
可选的,所述数据传输协议包括:Optionally, the data transmission protocol includes:
HTTP协议、HTTPS协议、POP3协议和SMTP协议等。HTTP protocol, HTTPS protocol, POP3 protocol and SMTP protocol, etc.
本申请还提供一种针对数据传输协议的数据项定界装置,所述数据传输协议用于在数据发送端与数据接收端之间传输数据;所述装置应用于所述数据接收端;所述数据接收端接收到的数据包含一个或多个数据项;所述多个数据项对应于一种或多种数据类型;所述多个数据项中的各个数据项的数据长度是不固定的且不可预知的;所述数据接收端配置有用于为接收到的数据所包含的各个数据项定界的第一缓冲单元,以及用于从接收到的数据中解析出各个数据项的第二缓冲单元;所述装置包括:The present application also provides a data item delimitation device for a data transmission protocol, the data transmission protocol is used to transmit data between a data sending end and a data receiving end; the device is applied to the data receiving end; The data received by the data receiving end includes one or more data items; the multiple data items correspond to one or more data types; the data length of each data item in the multiple data items is not fixed and Unpredictable; the data receiving end is configured with a first buffer unit for delimiting each data item included in the received data, and a second buffer unit for parsing each data item from the received data ; the device comprises:
第一缓冲单元,用于接收并缓存所述数据发送端发送的数据,将所述数据的首字节确定为目标字节,迭代执行以下步骤,直至对缓存的数据均完成检测:从所述目标字节开始,检测用于划分不同数据项的分隔字符串;若检测到所述分隔字符串,则确定包含所述目标字节在内的位于所述目标字节之后且位于检测到的首个分隔字符串之前的数据为数据项,并将检测出的数据项复制至所述第二缓冲单元;将位于所述检测到的首个分隔字符串之后的数据的首字节确定为所述目标字节;The first buffer unit is used to receive and buffer the data sent by the data sending end, determine the first byte of the data as the target byte, and perform the following steps iteratively until all the buffered data are detected: from the Starting from the target byte, detect the delimited character string used to divide different data items; The data before the first delimited character string is a data item, and the detected data item is copied to the second buffer unit; the first byte of the data after the detected first delimited character string is determined as the described target byte;
第二缓冲单元,用于接收所述第一缓冲单元发送的待解析数据项,对所述数据项进行解析,并提供业务流程使用。The second buffer unit is configured to receive the data item to be parsed sent by the first buffer unit, parse the data item, and provide it for use in a business process.
本申请还提供一种电子设备,包括通信接口、处理器、存储器和总线,所述通信接口、所述处理器和所述存储器之间通过总线相互连接;The present application also provides an electronic device, including a communication interface, a processor, a memory, and a bus, and the communication interface, the processor, and the memory are connected to each other through the bus;
所述存储器中存储机器可读指令,所述处理器通过调用所述机器可读指令,执行上述方法。The memory stores machine-readable instructions, and the processor executes the above method by invoking the machine-readable instructions.
本申请还提供一种机器可读存储介质,所述机器可读存储介质存储有机器可读指令,所述机器可读指令在被处理器调用和执行时,实现上述方法。The present application also provides a machine-readable storage medium, where the machine-readable storage medium stores machine-readable instructions, and when the machine-readable instructions are called and executed by a processor, the above method is implemented.
通过以上方式,一方面,通过为数据接收端配置第一缓冲区,可以在对接收到的数据进行数据分界的预解析处理后,将完成分界的数据项复制到数据解析的第二缓冲区,使得同时传输多种数据类型的数据时,对于长度可能较长,不便于在第二缓冲区中完全接收并做数据定界和解析的数据(如文件数据)也可以和长度较短,便于在内存中完全接收并做数据定界和解析的数据(如表单数据)一同在第一缓冲区所在内存空间中做数据定界和在第二缓冲区所在内存空间中做数据解析。在同时传输多种数据类型的数据项时,无论各个数据项按照何种先后顺序传输,接收端均能准确地进行数据项定界与解析,提高了数据传输的灵活性和可靠性。其中第一缓冲区所占内存的长度只要大于分隔字符串的长度即能实现本申请的技术方案,而无须关心单个数据项的可能长度,因此本申请的技术方案额外使用的内存量可以很小,程序运行时内存占用变化微乎其微。Through the above method, on the one hand, by configuring the first buffer for the data receiving end, it is possible to copy the demarcated data items to the second buffer for data parsing after performing pre-parsing processing on the received data. When transmitting data of multiple data types at the same time, the data (such as file data) that may be longer in length and inconvenient to be completely received in the second buffer and demarcated and parsed (such as file data) may also be shorter in length, which is convenient in the second buffer. The data (such as form data) that is completely received and delimited and parsed in the memory is delimited in the memory space where the first buffer is located and analyzed in the memory space where the second buffer is located. When data items of multiple data types are transmitted at the same time, no matter in which order each data item is transmitted, the receiving end can accurately demarcate and analyze the data items, which improves the flexibility and reliability of data transmission. Wherein, the length of the memory occupied by the first buffer zone can realize the technical solution of the present application as long as it is greater than the length of the delimited character string, without caring about the possible length of a single data item, so the additional memory used by the technical solution of the present application can be very small , the memory usage changes very little when the program is running.
另一方面,由于在第一缓冲区中将分隔字符串之前的数据复制到第二缓冲区,相当于在第一缓冲区中对包含一种或多种数据类型的数据做了数据项定界(即预解析),再把预解析出的数据项复制到第二缓冲区,第二缓冲区用于业务流程对预解析出的数据项做解析。这样的方案可以在数据接收端接收到的数据流中,各个数据项的长度不可预知的情况下,准确地进行针对各个数据项的定界与解析,提高了数据传输的可靠性。On the other hand, since the data before the delimited string is copied to the second buffer in the first buffer, it is equivalent to delimiting data items containing one or more data types in the first buffer (that is, pre-parsing), and then copy the pre-parsed data items to the second buffer, and the second buffer is used for the business process to analyze the pre-parsed data items. Such a solution can accurately demarcate and analyze each data item when the length of each data item in the data stream received by the data receiving end is unpredictable, thereby improving the reliability of data transmission.
附图说明Description of drawings
为了更清楚地说明本说明书实施例的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本说明书中记载的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions of the embodiments of this specification, the following will briefly introduce the drawings that need to be used in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments recorded in this specification. , for those skilled in the art, other drawings can also be obtained according to these drawings without paying creative labor.
图1是一示例性的实施例示出的一种数据接收端接收到HTTP协议传输数据的内容示意图;Fig. 1 is a schematic diagram of the contents of data received by a data receiver receiving HTTP protocol transmission data shown in an exemplary embodiment;
图2是一示例性的实施例示出的一种HTTP数据传输系统的架构示意图;Fig. 2 is a schematic structural diagram of an HTTP data transmission system shown in an exemplary embodiment;
图3是一示例性的实施例示出的一种针对数据传输协议的数据项定界方法流程图;Fig. 3 is a flow chart of a data item delimitation method for a data transmission protocol shown in an exemplary embodiment;
图4是一示例性的实施例示出的一种第一缓冲区指示目标字节位置的示意图;Fig. 4 is a schematic diagram of a first buffer indicating a target byte position shown in an exemplary embodiment;
图5是一示例性的实施例示出的一种数据接收端的第一缓冲区还未接收到数据时,游标指示位置示意图;Fig. 5 is a schematic diagram of the position indicated by the cursor when the first buffer of the data receiving end has not received data, shown in an exemplary embodiment;
图6是一示例性的实施例示出的一种数据接收端的第一缓冲区接收到数据时,游标指示位置示意图;Fig. 6 is a schematic diagram of the position indicated by the cursor when the first buffer of the data receiving end receives data according to an exemplary embodiment;
图7是一示例性的实施例示出的一种将第一缓冲区中分界出的数据项复制至第二缓冲区的示意图;Fig. 7 is a schematic diagram of copying the demarcated data items in the first buffer to the second buffer according to an exemplary embodiment;
图8是一示例性的实施例示出的一种在第一缓冲区中目标字节后检测不到分隔字符串的示意图;Fig. 8 is a schematic diagram showing that a delimited character string cannot be detected after the target byte in the first buffer according to an exemplary embodiment;
图9是一示例性的实施例示出的另一种在第一缓冲区中目标字节后检测不到分隔字符串的示意图;Fig. 9 is another schematic diagram showing that a delimited character string cannot be detected after the target byte in the first buffer according to an exemplary embodiment;
图10是一示例性的实施例示出的一种针对数据传输协议的数据项定界装置所在电子设备的硬件结构图;Fig. 10 is a hardware structural diagram of an electronic device where a data item demarcation device for a data transmission protocol is shown in an exemplary embodiment;
图11是一示例性的实施例示出的一种针对数据传输协议的数据项定界装置的框图。Fig. 11 is a block diagram of a device for delimiting data items for a data transmission protocol according to an exemplary embodiment.
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本说明书中的技术方案,下面将结合本说明书实施例中的附图,对本说明书实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本说明书一部分实施例,而不是全部的实施例。基于本说明书中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本说明书保护的范围。In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described The embodiments are only some of the embodiments in this specification, not all of them. Based on the embodiments in this specification, all other embodiments obtained by persons of ordinary skill in the art without creative efforts shall fall within the protection scope of this specification.
需要说明的是:在其他实施例中并不一定按照本说明书示出和描述的顺序来执行相应方法的步骤。在一些其他实施例中,其方法所包括的步骤可以比本说明书所描述的更多或更少。此外,本说明书中所描述的单个步骤,在其他实施例中可能被分解为多个步骤进行描述;而本说明书中所描述的多个步骤,在其他实施例中也可能被合并为单个步骤进行描述。It should be noted that in other embodiments, the steps of the corresponding methods are not necessarily performed in the order shown and described in this specification. In some other embodiments, the method may include more or less steps than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; multiple steps described in this specification may also be combined into a single step in other embodiments describe.
在数据传输协议下,数据接收端(如主机)每次接收到的数据包含一个或多个数据项,对应一种或多种数据类型。当多个不同数据类型的数据项混合传输时,传输内容均是字节流,由数据接收端从接收到的数据流中解析出各个数据项。在一些可能的实施例中,由于各个数据项的数据长度是不可预知的,因此需要将分隔字符串作为不同数据项之间的边界。Under the data transmission protocol, the data received by the data receiving end (such as the host) each time includes one or more data items, corresponding to one or more data types. When multiple data items of different data types are mixed and transmitted, the transmission content is a byte stream, and the data receiving end parses each data item from the received data stream. In some possible embodiments, since the data length of each data item is unpredictable, it is necessary to use the delimited character string as a boundary between different data items.
例如,基于HTTP协议同时传输表单数据和文件数据的情况下,由于表单类型的数据项的数据长度较短,因此可以全部缓存在内存中。而文件类型的数据项的数据长度可能较长,分隔字符串需要多次才能接收完整,而内存空间有限,所以在文件数据的数据长度不可预知的情况下,不便于将正在接收的文件数据一直缓存在内存里直到接收完成。因此,在相关技术中,如果同时传输表单数据和文件数据,通常默认表单数据在前,文件数据在后;相应地,数据接收端也会默认先从接收到的数据中解析表单数据,再解析文件数据。也即,如果数据接收端解析出文件数据,则默认表单数据已经解析完毕,剩余的都是文件数据。For example, in the case of simultaneously transmitting form data and file data based on the HTTP protocol, since the data length of the form-type data items is relatively short, all of them can be cached in the memory. However, the data length of the data item of the file type may be long, and the delimited character string needs to be received several times before it can be completely received, and the memory space is limited, so when the data length of the file data is unpredictable, it is not convenient to keep the file data being received. Buffered in memory until reception is complete. Therefore, in related technologies, if form data and file data are transmitted at the same time, usually the default form data is first and the file data is last; correspondingly, the data receiver will first parse the form data from the received data by default, and then file data. That is, if the data receiving end parses the file data, the default form data has been parsed, and the rest is file data.
请参见图1,图1是一示例性的实施例示出的一种数据接收端接收到HTTP协议传输数据的内容示意图。HTTP是一种基于TCP/IP协议的应用层协议,因为TCP是流式协议,即协议的内容是像流水一样的字节流,数据通过连续的、无间隙的数据流进行传输,而且每次请求接收到的数据长度不定,所以需要给传输的内容划分边界。因此,在相关技术中,一般先把长度较短的数据(如表单参数)放前面传输,把长度不定,可能较长的数据(如文件数据)放后面传输,并在不同数据项之间通过分隔字符串做分界。Please refer to FIG. 1 . FIG. 1 is a schematic diagram of content of HTTP protocol transmission data received by a data receiving end in an exemplary embodiment. HTTP is an application layer protocol based on the TCP/IP protocol, because TCP is a streaming protocol, that is, the content of the protocol is a stream of bytes like water, and data is transmitted through continuous, gapless data streams, and each time The length of the data received by the request is variable, so it is necessary to divide the content of the transmission. Therefore, in related technologies, data with shorter lengths (such as form parameters) are generally transmitted first, and data with variable lengths that may be longer (such as file data) are transmitted later, and between different data items. The delimited string is used as a delimiter.
例如,如图1所示,“-----699156856224027134326940”是用于分隔不同数据项的分隔字符串。如图1所示,HTTP数据传输中,将长度较短的数据(如表单数据)放在前面,将长度不固定的数据(如文件数据)放在后面,不同数据项之间由分隔字符串隔开。For example, as shown in Figure 1, "-----699156856224027134326940" is a delimited character string used to separate different data items. As shown in Figure 1, in HTTP data transmission, data with a shorter length (such as form data) is placed in front, and data with a variable length (such as file data) is placed in the back, and different data items are separated by character strings separated.
其中,在图1所示的HTTP协议消息头中,使用Content-Type来表示媒体类型信息。客户向服务器请求服务时,只需传送请求方法和路径。请求方法常用有GET、HEAD、POST。每种方法规定了客户与服务器联系的类型不同。Authorization请求报头域主要用于证明客户端有权查看某个资源。User-Agent是一种请求报头域,允许客户端将它的操作系统、浏览器和其它属性告诉服务器。需要说明的是,图1仅仅示例性地示出了数据接收端和数据发送端之间通过HTTP协议传输数据的界面示意图,并不代表本说明书对传输界面做出特别限定。Wherein, in the HTTP protocol message header shown in FIG. 1 , Content-Type is used to represent media type information. When a client requests a service from the server, it only needs to transmit the request method and path. Commonly used request methods are GET, HEAD, and POST. Each method specifies a different type of client-server contact. The Authorization request header field is mainly used to prove that the client has the right to view a certain resource. User-Agent is a request header field that allows the client to tell the server its operating system, browser, and other attributes. It should be noted that FIG. 1 only exemplarily shows a schematic diagram of an interface for transmitting data through the HTTP protocol between a data receiving end and a data sending end, and does not mean that this specification makes a special limitation on the transmission interface.
在本说明书中,所述分隔字符串通常被称为boundary,通过使用随机生成的分隔字符串来分隔不同部分的数据。因为随机生成的分隔字符串通常具有足够的随机性,以保证其在数据内容中的唯一性。而如果分隔字符串与数据内容重复,服务器解析请求时可能会出现错误,导致无法正确处理请求。在实际的HTTP请求中,分隔字符串通常是在Content-Type头字段的boundary参数中指定的,客户端和服务器之间约定好boundary字符串后,就可以通过该字符串将不同的部分分隔开,确保每个数据项都能被正确地解析和处理。服务器端会根据分隔字符串将请求体中不同部分的数据进行分割和解析,例如在multipart/form-data格式中使用分隔字符串将表单字段和文件进行分割。In this specification, the delimiter character string is generally referred to as boundary, and different parts of data are separated by using a randomly generated delimiter character string. Because the randomly generated delimited string usually has enough randomness to guarantee its uniqueness in the data content. However, if the delimited string is repeated with the data content, an error may occur when the server parses the request, resulting in the inability to process the request correctly. In an actual HTTP request, the delimiter string is usually specified in the boundary parameter of the Content-Type header field. After the boundary string is agreed between the client and the server, different parts can be separated by this string. to ensure that each data item is parsed and processed correctly. The server will split and parse the data in different parts of the request body according to the delimiter string. For example, in the multipart/form-data format, the delimiter string is used to separate form fields and files.
在这种情况下,如果需要先传输文件数据,后传输表单数据,数据接收端会误认为本次传输的全部是文件数据,导致针对表单数据的数据项解析错误。In this case, if the file data needs to be transmitted first, and then the form data, the data receiving end will mistakenly believe that all the transmission is file data, resulting in an error in parsing the data items of the form data.
有鉴于此,本说明书旨在提出一种数据项定界方法,在数据接收端接收到包含一个或多个数据项的数据之后时,将所述数据缓存至第一缓冲区,在所述第一缓冲区中对数据做分界,并将分界后的数据项复制到第二缓冲区解析的技术方案。In view of this, this description aims to propose a data item delimitation method, after the data receiving end receives data containing one or more data items, cache the data in the first buffer, and in the second A technical solution for demarcating data in the first buffer and copying the demarcated data items to the second buffer for analysis.
在本说明书中,数据传输协议用于在数据发送端与数据接收端之间传输数据。数据接收端接收到的数据包含一个或多个数据项,多个数据项对应于一种或多种数据类型,多个数据项中的各个数据项的数据长度是不固定的且不可预知的。数据接收端配置有用于为接收到的数据所包含的各个数据项定界的第一缓冲区,以及用于从接收到的数据中解析出各个数据项的第二缓冲区。In this specification, the data transmission protocol is used to transmit data between the data sending end and the data receiving end. The data received by the data receiving end includes one or more data items, the multiple data items correspond to one or more data types, and the data length of each data item in the multiple data items is not fixed and unpredictable. The data receiving end is configured with a first buffer for delimiting each data item included in the received data, and a second buffer for parsing out each data item from the received data.
在数据接收端接收数据发送端发送的数据时,将接收到的数据缓存至所述第一缓冲区,将缓存至所述第一缓冲区的数据的首字节确定为目标字节,并迭代执行以下步骤,直至对缓存至所述第一缓冲区的数据完成检测:从所述目标字节开始,检测用于划分不同数据项的分隔字符串;如果检测到所述分隔字符串,则确定包含所述目标字节在内的位于所述目标字节之后且位于所述检测到的首个分隔字符串之前的数据为数据项,并将检测出的数据项复制至所述第二缓冲区;进一步地,将位于所述检测到的首个分隔字符串之后的数据的首字节确定为所述目标字节。When the data receiving end receives the data sent by the data sending end, buffer the received data into the first buffer, determine the first byte of the data buffered into the first buffer as the target byte, and iterate Perform the following steps until the data cached to the first buffer is detected: starting from the target byte, detect a delimited character string used to divide different data items; if the delimited character string is detected, determine The data including the target byte after the target byte and before the detected first delimited character string is a data item, and the detected data item is copied to the second buffer ; Further, determining the first byte of the data after the detected first delimited character string as the target byte.
由此可见,在本说明书中的技术方案中,一方面,通过为数据接收端配置第一缓冲区,可以在对接收到的数据进行数据分界的预解析处理后,将完成分界的数据项复制到数据解析的第二缓冲区,使得同时传输多种数据类型的数据时,对于长度可能较长,不便于在第二缓冲区中完全接收并做数据定界和解析的数据(如文件数据)也可以和长度较短,便于在内存中完全接收并做数据定界和解析的数据(如表单数据)一同在第一缓冲区所在内存空间中做数据定界和在第二缓冲区所在内存空间中做数据解析。在同时传输多种数据类型的数据项时,无论各个数据项按照何种先后顺序传输,接收端均能准确地进行数据项定界与解析,提高了数据传输的灵活性和可靠性。It can be seen that, in the technical solution in this specification, on the one hand, by configuring the first buffer zone for the data receiving end, after the pre-parsing processing of the data boundary is performed on the received data, the data items that have completed the boundary can be copied To the second buffer for data analysis, so that when transmitting data of multiple data types at the same time, the length may be longer, and it is not convenient to completely receive and demarcate and analyze data in the second buffer (such as file data) It can also be combined with the data (such as form data) that is shorter in length and is convenient for complete reception in memory, data delimitation and analysis (such as form data) in the memory space where the first buffer is located and in the memory space where the second buffer is located. Do data analysis in. When data items of multiple data types are transmitted at the same time, no matter in which order each data item is transmitted, the receiving end can accurately demarcate and analyze the data items, which improves the flexibility and reliability of data transmission.
另一方面,由于在第一缓冲区中将分隔字符串之前的数据复制到第二缓冲区,相当于在第一缓冲区中对包含一种或多种数据类型的数据做了数据项定界(即预解析),再把预解析出的数据项复制到第二缓冲区,第二缓冲区用于业务流程对预解析出的数据项做解析。这样的方案可以在数据接收端接收到的数据流中,各个数据项的长度不可预知的情况下,准确地进行针对各个数据项的定界与解析,提高了数据传输的可靠性。On the other hand, since the data before the delimited string is copied to the second buffer in the first buffer, it is equivalent to delimiting data items containing one or more data types in the first buffer (that is, pre-parsing), and then copy the pre-parsed data items to the second buffer, and the second buffer is used for the business process to analyze the pre-parsed data items. Such a solution can accurately demarcate and analyze each data item when the length of each data item in the data stream received by the data receiving end is unpredictable, thereby improving the reliability of data transmission.
下面通过具体实施例,并以数据传输协议采用HTTP协议为例,结合具体的应用场景对本申请进行描述。The present application will be described below in combination with specific application scenarios by using specific embodiments and taking the HTTP protocol as an example for the data transmission protocol.
请参见图2,图2是一示例性的实施例示出的一种HTTP数据传输系统的架构示意图。如图2所示,数据接收端可以是主机20、手机21等具有针对HTTP协议做数据接收与解析能力的终端,又称HTTP客户端。数据发送端可以是服务器22。数据接收端与数据发送端之间通过网络连接,并通过HTTP协议做数据交互。Please refer to FIG. 2 . FIG. 2 is a schematic structural diagram of an HTTP data transmission system shown in an exemplary embodiment. As shown in FIG. 2 , the data receiving end may be a host 20 , a mobile phone 21 and other terminals capable of receiving and analyzing data for the HTTP protocol, also known as an HTTP client. The data sending end may be the server 22 . The data receiving end and the data sending end are connected through the network, and data exchange is performed through the HTTP protocol.
在数据发送端为服务端,数据接收端为终端的情况下,例如图2所示,主机20在打开浏览器网页或者手机21在使用应用程序(APP)时,可以向服务器22发送HTTP请求报文,其中,所述HTTP请求包括请求头、请求体等信息。服务器22收到HTTP请求后,会解析请求消息,并进行相应数据处理,例如从数据库查询数据,生成响应消息等。当服务器完成数据处理后,会将响应消息返回给主机20或手机21,主机20与手机21接收响应消息,解析响应消息体,并对解析得到的数据项进行与应用相关的处理。In the case where the data sending end is a server and the data receiving end is a terminal, for example, as shown in FIG. document, wherein the HTTP request includes information such as a request header and a request body. After receiving the HTTP request, the server 22 will parse the request message and perform corresponding data processing, such as querying data from the database and generating a response message. After the server completes data processing, it will return a response message to the host 20 or mobile phone 21. The host 20 and mobile phone 21 receive the response message, analyze the response message body, and perform application-related processing on the analyzed data items.
其中,所述服务器是提供服务的计算机,具有大量并发处理能力及数据存储和管理能力,在数据传输过程中,主要完成解析HTTP请求消息、处理HTTP请求、生成HTTP响应消息等。所述HTTP请求报文是由客户端向服务器发起的请求消息,包含了请求头和请求体两部分。所述请求头用于描述HTTP请求基本信息,比如请求类型、请求路径、请求头字段、请求参数等就保存在HTTP请求头中。所述请求体用于描述需要提交哪些数据给服务器,例如,在表单提交的时候,表单数据就保存在HTTP请求体中。所述响应消息是由服务器响应客户端的请求消息,包括状态码、响应头、响应体等内容,所述状态码表示服务器对请求的处理结果,所述响应头包含一些附加的HTTP协议头信息,所述响应体包含了服务器返回给客户端的实际数据。Wherein, the server is a computer that provides services and has a large amount of concurrent processing capability and data storage and management capabilities. During the data transmission process, it mainly completes parsing HTTP request messages, processing HTTP requests, and generating HTTP response messages. The HTTP request message is a request message initiated by the client to the server, and includes two parts: a request header and a request body. The request header is used to describe the basic information of the HTTP request, such as request type, request path, request header fields, request parameters, etc. are stored in the HTTP request header. The request body is used to describe what data needs to be submitted to the server. For example, when a form is submitted, the form data is stored in the HTTP request body. The response message is a response message from the server to the client, including status code, response header, response body, etc., the status code represents the processing result of the request by the server, and the response header includes some additional HTTP protocol header information, The response body contains the actual data returned by the server to the client.
在一些可能的实施例中,主机20和手机21除了作为数据接收端外,还可以是数据发送端,将用户的操作信息(比如搜索关键字、下单信息等)发送给服务器22。对于数据接收端和数据发送端具体包含哪些设备类型,本说明书对此并不进行限制。In some possible embodiments, the host computer 20 and the mobile phone 21 can be not only data receiving terminals, but also data transmitting terminals, sending user operation information (such as search keywords, order information, etc.) to the server 22 . This specification does not limit the types of devices specifically included in the data receiving end and the data sending end.
请参见图3,图3是一示例性的实施例示出的一种针对数据传输协议的数据项定界方法流程图。所述方法可以应用于数据接收端。所述方法可以执行以下步骤:Please refer to FIG. 3 . FIG. 3 is a flow chart of a data item delimitation method for a data transmission protocol shown in an exemplary embodiment. The method can be applied to the data receiving end. The method may perform the following steps:
步骤302:接收数据发送端发送的数据,将接收到的数据缓存至第一缓冲区,将缓存至所述第一缓冲区的数据的首字节确定为目标字节。Step 302: Receive the data sent by the data sending end, buffer the received data in the first buffer, and determine the first byte of the data buffered in the first buffer as the target byte.
例如,请参见图4,图4是一示例性的实施例示出的一种第一缓冲区指示目标字节位置的示意图。如图4所示,矩形框表示第一缓冲区400,在第一缓冲区400中接收到数据“abc123-xyz-def456-xyz-ghi789-xy”时,数据首字节为“a”,目标字节402用于指示第一缓冲区400中接收到数据首字节的位置,即目标字节402指示数据“a”的位置。For example, please refer to FIG. 4 , which is a schematic diagram of a first buffer indicating a target byte position according to an exemplary embodiment. As shown in Figure 4, the rectangular frame represents the first buffer 400. When the data "abc123-xyz-def456-xyz-ghi789-xy" is received in the first buffer 400, the first byte of the data is "a", and the target The byte 402 is used to indicate the position of the first byte of the received data in the first buffer 400 , that is, the target byte 402 indicates the position of the data "a".
其中,所述缓存至所述第一缓冲区的数据的首字节是指数据流中已经被接收并存储在所述第一缓冲区的数据的首字节。所述第一缓冲区是指用来接收数据并做数据预解析(即数据分界)的数据存储区域。在本说明书中,设置第一缓冲区将数据项分界后复制到第二缓冲区中做数据处理,实现将长度不可预知且不固定、不便于在内存中全部接收并缓存的数据提前分界。在本说明书中,所述目标字节是用来指示某一字节的位置并用于后续操作。目标字节是用来划分数据区域并在所述数据区域中检测是否有分隔字符串存在。设置目标字节有利于更清晰明确地指示数据分界的过程及步骤。Wherein, the first byte of the data buffered in the first buffer refers to the first byte of the data in the data stream that has been received and stored in the first buffer. The first buffer refers to a data storage area used to receive data and perform data pre-parsing (that is, data demarcation). In this manual, the first buffer is set to divide the data items and copy them to the second buffer for data processing, so as to realize the demarcation in advance of the data whose length is unpredictable and not fixed, and which is not convenient to receive and cache all in the memory. In this specification, the target byte is used to indicate the position of a certain byte and used for subsequent operations. The target byte is used to divide the data area and detect whether there is a delimited character string in the data area. Setting the target byte is beneficial to indicate the process and steps of data demarcation more clearly.
在示出的一种实施方式中,为了更直观地指示检测位置,所述接收所述数据发送端发送的数据并缓存至所述第一缓冲区,包括:In one embodiment shown, in order to indicate the detection position more intuitively, the receiving the data sent by the data sending end and buffering it in the first buffer includes:
将接收到的数据缓存至所述第一缓冲区,将第一游标指向缓存至所述第一缓冲区的数据的首字节对应的内存地址,并将第二游标指向缓存至所述第一缓冲区的数据的末字节的下一字节对应的内存地址;Cache the received data to the first buffer, point the first cursor to the memory address corresponding to the first byte of the data cached in the first buffer, and point the second cursor to the memory address cached in the first The memory address corresponding to the next byte of the last byte of the data in the buffer;
例如,请参见图5,图5是一示例性的实施例示出的一种数据接收端的第一缓冲区还未接收到数据时,游标指示位置示意图。如图5所示,矩形框表示第一缓冲区400,用于缓存需要做数据项分解的数据。在第一缓冲区400还未接收到数据时,第一游标502和第二游标504都用于指示第一缓冲区400中首字节的位置。For example, please refer to FIG. 5 . FIG. 5 is a schematic diagram of a position indicated by a cursor when the first buffer of the data receiving end has not received data in an exemplary embodiment. As shown in FIG. 5 , the rectangular frame represents the first buffer 400 , which is used to cache data that needs to be decomposed into data items. When the first buffer 400 has not received data, both the first cursor 502 and the second cursor 504 are used to indicate the position of the first byte in the first buffer 400 .
其中,所述第一游标用于指示缓存在所述第一缓冲区中的未完成检测的数据的首字节对应的内存地址;所述第二游标用于指示缓存在所述第一缓冲区中的未完成检测的数据的末字节的下一字节对应的内存地址。Wherein, the first cursor is used to indicate the memory address corresponding to the first byte of the unfinished detection data cached in the first buffer; the second cursor is used to indicate the memory address cached in the first buffer The memory address corresponding to the next byte of the last byte of the uncompleted detected data.
当第一缓冲区中存入数据时,请参见图6,图6是一示例性的实施例示出的一种数据接收端的第一缓冲区接收到数据时,游标指示位置示意图。如图6所示,由于还未解析数据,第一游标502用于指示缓存在所述第一缓冲区中的未完成检测的数据的首字节“a”对应的内存地址,第二游标504用于指示缓存在所述第一缓冲区中的未完成检测的数据的末字节“y”的下一字节对应的内存地址。When data is stored in the first buffer, please refer to FIG. 6 . FIG. 6 is a schematic diagram of a position indicated by a cursor when the first buffer of the data receiving end receives data according to an exemplary embodiment. As shown in Figure 6, since the data has not yet been parsed, the first cursor 502 is used to indicate the memory address corresponding to the first byte "a" of the unfinished detection data cached in the first buffer, and the second cursor 504 It is used to indicate the memory address corresponding to the next byte of the last byte "y" of the unfinished detected data cached in the first buffer.
其中,所述未完成检测的数据的首字节对应的内存地址是指在所述第一缓冲区中已接收但未检测的数据的首字节存放在所述第一缓冲区中的内存地址,即所述第一缓冲区的已完成检测数据的末字节的下一字节对应的内存地址。所述游标(Cursor)是一种指示当前位置或操作位置的标记,通常用于对数据进行浏览、访问或修改。游标还可以指示数据流或资源中的当前位置,使得可以精确地访问、读取或修改特定位置的数据。此外,游标可以用于遍历数据集合,逐个处理每个元素或记录。Wherein, the memory address corresponding to the first byte of the undetected data refers to the memory address where the first byte of the data that has been received but not detected in the first buffer is stored in the first buffer , that is, the memory address corresponding to the next byte of the last byte of the detected data in the first buffer. The cursor (Cursor) is a mark indicating a current position or an operating position, and is usually used for browsing, accessing or modifying data. A cursor can also indicate the current position in a data stream or resource, enabling precise access, reading, or modification of data at a specific location. Additionally, cursors can be used to traverse collections of data, processing each element or record individually.
在示出的一种实施方式中,所述接收到的数据,包括请求报文或响应报文;在将缓存至所述第一缓冲区的数据的首字节确定为目标字节之前,所述方法还包括:In one embodiment shown, the received data includes a request message or a response message; before the first byte of the data buffered in the first buffer is determined as the target byte, the The method also includes:
获取所述请求报文的请求头中包含的所述分隔字符串;或者,获取所述响应报文的响应头中包含的所述分隔字符串。Acquiring the delimited character string contained in the request header of the request message; or acquiring the delimited character string contained in the response header of the response message.
其中,在所述数据接收端接收HTTP请求报文的情况下,从请求报文的请求头中获取所述分隔字符串,在所述数据接收端发送HTTP请求报文之后,接收相应报文的情况下,从响应报文的响应头中获取所述分隔字符串。为获取所述分隔字符串,所述数据接收端先解析请求报文,所述解析请求报文是通过使用相应的网络库或框架提供的函数将接收到的请求报文按照规定的格式解析成可处理的数据结构;再从解析后的请求报文中获取请求头部分并查找特定的请求头字段,最后找到包含所需分隔字符串的特定字段;最后根据具体需求,解析该字段的值以获取分隔字符串。Wherein, when the data receiving end receives the HTTP request message, the delimited character string is obtained from the request header of the request message, and after the data receiving end sends the HTTP request message, the corresponding message is received In the case, the delimited character string is obtained from the response header of the response message. In order to obtain the delimited character string, the data receiving end first parses the request message, and the parsing request message uses the function provided by the corresponding network library or framework to parse the received request message into processable data structure; then obtain the request header part from the parsed request message and search for the specific request header field, and finally find the specific field containing the required delimited string; finally, according to the specific needs, parse the value of the field to Get the delimited string.
步骤304:从所述目标字节开始,检测用于划分不同数据项的分隔字符串。Step 304: Starting from the target byte, detect a delimited character string for dividing different data items.
例如,如图4所示,从目标字节402开始,检测第一缓冲区400中存储的数据是否存在用于划分不同数据项的分隔字符串。For example, as shown in FIG. 4 , starting from the target byte 402 , it is detected whether the data stored in the first buffer 400 has a delimited character string for dividing different data items.
其中,所述分隔字符串是用于划分数据项边界的,如果在第一缓冲区400中存储的数据里检测到所述分隔字符串,说明在所述分隔字符串前面的数据和在所述分隔字符串后面的数据为两个不同的数据项,比如不同的表单数据,或者一个表单数据一个文件数据。Wherein, the delimited character string is used to divide the boundary of data items, if the delimited character string is detected in the data stored in the first buffer 400, it means that the data in front of the delimited character string and the The data after the delimited string are two different data items, such as different form data, or one form data and one file data.
步骤306:确定是否检测到分隔字符串;如果是,则继续执行步骤308。Step 306: Determine whether a delimited character string is detected; if yes, proceed to step 308.
步骤308:确定包含所述目标字节在内的位于所述目标字节之后且位于所述检测到的首个分隔字符串之前的数据为数据项,并将检测出的数据项复制至所述第二缓冲区。Step 308: Determine that the data including the target byte after the target byte and before the detected first delimited character string is a data item, and copy the detected data item to the Second buffer.
例如,请参见图7,图7是一示例性的实施例示出的一种将第一缓冲区中分界出的数据项复制至第二缓冲区的示意图。如图7所示,所述分隔字符串为字符串“-xyz-”,从目标字节402开始,检测第一缓冲区400中存储的数据是否存在用于划分不同数据项的分隔字符串,当检测到首个分隔字符串“-xyz-”的存在,将检测到的首个分隔字符串“-xyz-”之前的数据项“abc123”复制至所述第二缓冲区700。For example, please refer to FIG. 7 . FIG. 7 is a schematic diagram of copying demarcated data items in the first buffer to the second buffer in an exemplary embodiment. As shown in FIG. 7, the delimited character string is a character string "-xyz-", starting from the target byte 402, detecting whether the data stored in the first buffer 400 has a delimited character string for dividing different data items, When the existence of the first delimited character string “-xyz-” is detected, the data item “abc123” before the detected first delimited character string “-xyz-” is copied to the second buffer 700 .
其中,所述第二缓冲区是第一缓冲区经过分隔字符串检测,解析出来的文件数据项或参数数据项最终存放的地方,所述第二缓冲区中存储的数据用于后续应用层业务流程使用。Wherein, the second buffer is the place where the file data items or parameter data items parsed from the first buffer are finally stored after the delimited string detection, and the data stored in the second buffer is used for subsequent application layer services Process usage.
步骤310:将位于检测到的首个分隔字符串之后的数据的首字节确定为所述目标字节。Step 310: Determine the first byte of the data after the detected first delimited character string as the target byte.
例如,如图7所示,将位于所述检测到的首个分隔字符串“-xyz-”之后的数据的首字节“d”确定为所述目标字节402。For example, as shown in FIG. 7 , the first byte “d” of the data after the detected first delimited character string “-xyz-” is determined as the target byte 402 .
其中,所述目标字节用于表示下一次检测所述第一缓冲区400中是否有所述分隔字符串存在的起始位置。在本说明书中,设置所述目标字节在复制完数据项之后移动至所述分隔字符串之后的数据的首字节,是为了避免对同一数据项的重复检测和重复复制操作。执行完步骤310之后,返回步骤304继续循环执行步骤流程。Wherein, the target byte is used to indicate a starting position for next detection of whether the delimited character string exists in the first buffer 400 . In this specification, the purpose of setting the target byte to move to the first byte of the data after the delimited character string after copying the data item is to avoid repeated detection and repeated copying operations on the same data item. After step 310 is executed, return to step 304 to continue to execute the flow of steps in a loop.
步骤312:确定是否对缓存至所述第一缓冲区的数据完成检测;如果否,则继续执行步骤304;如果是,则结束迭代。Step 312: Determine whether the detection is completed on the data buffered in the first buffer; if no, proceed to step 304; if yes, end the iteration.
在示出的一种实施方式中,为了更直观地指示检测位置,所述从所述目标字节开始,检测用于划分不同数据项的分隔字符串,包括:In one embodiment shown, in order to indicate the detection position more intuitively, starting from the target byte, detecting the delimited character string used to divide different data items includes:
检测所述第一缓冲区中,所述第二游标指向字节对应的内存地址之前的数据是否包含所述分隔字符串;若包含所述分隔字符串,将所述第一游标指向检测到的首个分隔字符串首字节对应的内存地址,并将所述第一游标指向的内存地址之前的数据划分为数据项。Detect in the first buffer, whether the data before the memory address corresponding to the byte pointed to by the second cursor contains the delimited character string; if the delimited character string is included, point the first cursor to the detected The first delimits the memory address corresponding to the first byte of the character string, and divides the data before the memory address pointed to by the first cursor into data items.
例如,如图7所示,检测第一缓冲区400中,第二游标504指向字节对应的内存地址之前的数据是否包含所述分隔字符串“-xyz-”;因为第一缓冲区400中缓存的数据包含所述分隔字符串“-xyz-”,将所述第一游标502指向检测到的首个分隔字符串(即字符串“abc123”后的分隔字符串“-xyz-”)的首字节“-”对应的内存地址,并将所述第一游标502指向的内存地址之前的数据“abc123”划分为数据项。For example, as shown in FIG. 7 , detect whether the data before the memory address corresponding to the byte that the second cursor 504 points to in the first buffer 400 contains the delimited character string "-xyz-"; because in the first buffer 400 The cached data contains the delimited character string "-xyz-", and the first cursor 502 is pointed to the detected first delimited character string (ie the delimited character string "-xyz-" after the character string "abc123") The memory address corresponding to the first byte "-", and the data "abc123" before the memory address pointed to by the first cursor 502 is divided into data items.
其中,所述第二缓冲区相当于背景技术中的内存缓冲区,本申请的技术方案新增的所述第一缓冲区对接收到的数据做数据定界的预解析,将定界后的数据项复制到所述第二缓冲区做数据解析。Wherein, the second buffer is equivalent to the memory buffer in the background technology, and the first buffer newly added by the technical solution of the present application performs data delimitation pre-analysis on the received data, and demarcates the delimited The data items are copied to the second buffer for data parsing.
在示出的一种实施方式中,为了在分隔字符串只在第一缓冲区中出现了一部分的情况下,正确识别完整分隔字符串,提高参数分界准确性,从所述目标字节开始,检测用于划分不同数据项的分隔字符串之后,所述方法还包括:In one embodiment shown, in order to correctly identify the complete delimited character string and improve the accuracy of parameter demarcation when the delimited character string only appears in a part of the first buffer, starting from the target byte, After detecting a delimited string for delimiting different data items, the method further includes:
若检测不到所述分隔字符串,将所述第一游标指向所述分隔字符串末字节对应的内存地址,检测所述第一游标指向的字节与所述第二游标指向的字节之间的字节数是否不小于所述分隔字符串所占字节数;If the delimited character string cannot be detected, point the first cursor to the memory address corresponding to the end byte of the delimited character string, and detect the byte pointed to by the first cursor and the byte pointed to by the second cursor Whether the number of bytes between is not less than the number of bytes occupied by the delimited string;
若不小于所述分隔字符串所占字节数,将所述第一游标指向的字节的内存地址,与所述第二游标向前偏移一共所述分隔字符串所占字节数减一字节的字节数指向的内存地址这两者之间的数据复制至所述第二缓冲区;再将所述第一缓冲区中未复制至所述第二缓冲区的剩余数据覆盖式写入至所述第一缓冲区对应内存空间首字节对应的内存地址处。If it is not less than the number of bytes occupied by the delimited character string, the memory address of the byte pointed to by the first cursor and the forward offset of the second cursor are subtracted from the number of bytes occupied by the delimited character string The data between the memory address pointed to by the number of bytes of a byte is copied to the second buffer; then the remaining data not copied to the second buffer in the first buffer is overwritten Write to the memory address corresponding to the first byte of the memory space corresponding to the first buffer.
例如,请参见图8,图8是一示例性的实施例示出的一种在第一缓冲区中目标字节后检测不到分隔字符串的示意图。如图8所示,在目标字节402后,仅有分隔字符串的一部分“-xy”出现在所述第一缓冲区400。此时第一游标502指向所述第一缓冲区400中最后一个分隔字符串“-xyz-”的下一字节“g”,第二游标504指向所述第一缓冲区400中已接收到数据的末尾字节“y”的下一字节。检测所述第一游标502指向的字节“g”与所述第二游标504指向的字节“y”的下一字节之间的字节数(即从“g”到“y”的字节数,不包含“y”的下一字节)是否不小于所述分隔字符串“-xyz-”所占字节数(5字节)。For example, please refer to FIG. 8 , which is a schematic diagram of an exemplary embodiment showing that a delimited character string cannot be detected after the target byte in the first buffer. As shown in FIG. 8 , after the target byte 402 , only a part of “-xy” of the delimited character string appears in the first buffer 400 . Now the first cursor 502 points to the next byte "g" of the last delimited character string "-xyz-" in the first buffer 400, and the second cursor 504 points to the received The byte next to the end byte "y" of the data. Detect the number of bytes between the byte "g" pointed to by the first cursor 502 and the next byte of the byte "y" pointed to by the second cursor 504 (that is, the number of bytes from "g" to "y") Whether the number of bytes, excluding the next byte of "y" is not less than the number of bytes occupied by the delimited character string "-xyz-" (5 bytes).
其中,所述分隔字符串“-xyz-”所占字节数为5字节,所述分隔字符串所占字节数减一字节数为4字节。从字节“g”到字节“y”的下一字节之间的字节数为9字节,小于5字节。则将所述第一游标502指向的字节“g”的内存地址,与所述第二游标504向前偏移分隔字符串“-xyz-”所占字节数(5字节)减一字节数(即4字节)指向的字节“9”的内存地址这两者之间的数据“ghi78”复制至所述第二缓冲区700,并同步更新第一游标指向字节“9”所在的内存地址。Wherein, the number of bytes occupied by the delimited string "-xyz-" is 5 bytes, and the number of bytes occupied by the delimited string minus one byte is 4 bytes. The number of bytes between byte "g" and the next byte of byte "y" is 9 bytes, which is less than 5 bytes. Then the memory address of the byte "g" pointed to by the first cursor 502 and the forward offset of the second cursor 504 delimit the number of bytes (5 bytes) occupied by the character string "-xyz-" by one The data "ghi78" between the memory address of the byte "9" pointed to by the number of bytes (that is, 4 bytes) is copied to the second buffer 700, and the first cursor is updated synchronously to point to the byte "9 "The memory address where it is located.
在示出的一种实施方式中,所述检测所述第一游标指向的字节与所述第二游标指向的字节之间的字节数是否不小于所述分隔字符串所占字节数,包括:In one embodiment shown, the detection whether the number of bytes between the byte pointed by the first cursor and the byte pointed by the second cursor is not less than the bytes occupied by the delimited string number, including:
若小于所述分隔字符串所占字节数,直接将所述第一游标指向的字节对应的内存地址,到所述第二游标指向的字节对应的内存地址这二者之间的数据覆盖式写入至所述第一缓冲区所在内存空间首字节对应的内存地址处,并同步更新第一游标和第二游标分别为目标位置的首字节所在地址和末字节的下一字节所在地址。If it is less than the number of bytes occupied by the delimited character string, directly transfer the data between the memory address corresponding to the byte pointed to by the first cursor and the memory address corresponding to the byte pointed to by the second cursor Overwriting writes to the memory address corresponding to the first byte of the memory space where the first buffer is located, and synchronously updates the first cursor and the second cursor to the address of the first byte of the target position and the next byte of the last byte respectively. The address where the byte is located.
例如,请参见图9,图9是一示例性的实施例示出的另一种在第一缓冲区中目标字节后检测不到分隔字符串的示意图。如图9所示,在目标字节402后,仅有分隔字符串的一部分“-xy”出现在所述第一缓冲区400。从字节“g”到字节“y”的下一字节之间的字节数为4字节,小于所述分隔字符串“-xyz-”所占字节数(5字节)。此时,直接将所述第一游标502指向的字节“g”的内存地址,到所述第二游标504指向的字节“y”的下一字节对应的内存地址这二者之间的数据“g-xy”(不包含“y”的下一字节)覆盖式写入至所述第一缓冲区400所在内存空间首字节对应的内存地址处,第一游标更新为指向数据“g-xy”中字节“g”所在的内存地址,第二游标更新为指向数据“g-xy”中字节“y”的下一字节对应的内存地址。For example, please refer to FIG. 9 . FIG. 9 is another schematic diagram showing that no delimited character string is detected after the target byte in the first buffer according to an exemplary embodiment. As shown in FIG. 9 , after the target byte 402 , only a part of “-xy” of the delimited character string appears in the first buffer 400 . The number of bytes between the byte "g" and the next byte of the byte "y" is 4 bytes, which is smaller than the number of bytes occupied by the delimited character string "-xyz-" (5 bytes). At this time, directly between the memory address of the byte "g" pointed to by the first cursor 502 and the memory address corresponding to the next byte of the byte "y" pointed to by the second cursor 504 The data "g-xy" (the next byte not including "y") is overwritten to the memory address corresponding to the first byte of the memory space where the first buffer 400 is located, and the first cursor is updated to point to the data The memory address where the byte "g" in "g-xy" is located, and the second cursor is updated to point to the memory address corresponding to the next byte of the byte "y" in the data "g-xy".
需要说明的是,在以上示出的实施例中,相当于把可能存在“分隔字符串一部分”的数据仍然保留在所述第一缓冲区400中,当所述第一缓冲区400后续接收到新缓存的数据时,可以检测完整的分隔字符串是否存在。其中,所述完整的分隔字符串包含了连接分隔字符串的连字符。It should be noted that, in the embodiment shown above, it is equivalent to retaining the data that may have "a part of the delimited character string" in the first buffer 400, when the first buffer 400 subsequently receives When newly cached data, the presence of the complete delimited string can be detected. Wherein, the complete delimited string includes a hyphen connecting the delimited strings.
在示出的一种实施方式中,所述数据传输协议包括:In an illustrated embodiment, the data transmission protocol includes:
HTTP协议、HTTPS协议、POP3协议和SMTP协议等。HTTP protocol, HTTPS protocol, POP3 protocol and SMTP protocol, etc.
其中,HTTP(Hypertext Transfer Protocol,超文本传输协议)协议、HTTPS(HyperText Transfer Protocol Secure,安全超文本传输协议)协议、POP3(Post OfficeProtocol version 3,第三版邮局协议)协议和SMTP(Simple Mail Transfer Protocol,简单邮件传输协议)协议等都需要通过分隔字符串来定界数据项,确保数据按照正确的格式传输和解析。Among them, HTTP (Hypertext Transfer Protocol, Hypertext Transfer Protocol) protocol, HTTPS (HyperText Transfer Protocol Secure, secure Hypertext Transfer Protocol) protocol, POP3 (Post Office Protocol version 3, third edition Post Office Protocol) protocol and SMTP (Simple Mail Transfer Protocol, Simple Mail Transfer Protocol, etc., all need to delimit data items by delimiting strings to ensure that data is transmitted and parsed in the correct format.
与上述针对数据传输协议的数据项定界方法的实施例对应的,本说明书还提供了一种针对数据传输协议的数据项定界装置的实施例。Corresponding to the above embodiments of the data item delimitation method for the data transmission protocol, this specification also provides an embodiment of a data item delimitation device for the data transmission protocol.
请参见图10,图10是一示例性的实施例示出的一种针对数据传输协议的数据项定界装置所在电子设备的硬件结构图。在硬件层面,该设备包括处理器1002、内部总线1004、网络接口1006、内存1008以及非易失性存储器1010,当然还可能包括其他所需要的硬件。本说明书一个或多个实施例可以基于软件方式来实现,比如由处理器1002从非易失性存储器1010中读取对应的计算机程序到内存1008中然后运行。当然,除了软件实现方式之外,本说明书一个或多个实施例并不排除其他实现方式,比如逻辑器件抑或软硬件结合的方式等等,也就是说以下处理流程的执行主体并不限定于各个逻辑单元,也可以是硬件或逻辑器件。Please refer to FIG. 10 . FIG. 10 is a hardware structural diagram of an electronic device in which a data item demarcation device for a data transmission protocol is located according to an exemplary embodiment. In terms of hardware, the device includes a processor 1002, an internal bus 1004, a network interface 1006, a memory 1008, and a non-volatile memory 1010, and may also include other required hardware. One or more embodiments of this specification may be implemented based on software, for example, the processor 1002 reads a corresponding computer program from the non-volatile memory 1010 into the memory 1008 and executes it. Of course, in addition to software implementations, one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each A logic unit, which can also be a hardware or logic device.
请参见图11,图11是一示例性的实施例示出的一种针对数据传输协议的数据项定界装置的框图。该针对数据传输协议的数据项定界装置可以应用于如图10所示的电子设备中,以实现本说明书的技术方案。所述针对数据传输协议的数据项定界装置应用于数据接收端;所述数据接收端接收到的数据包含一个或多个数据项;所述多个数据项对应于一种或多种数据类型;所述多个数据项中的各个数据项的数据长度是不固定的且不可预知的;所述数据接收端配置有用于为接收到的数据所包含的各个数据项定界的第一缓冲区,以及用于从接收到的数据中解析出各个数据项的第二缓冲区;所述装置可以包括:Please refer to FIG. 11 . FIG. 11 is a block diagram of an apparatus for delimiting data items for a data transmission protocol according to an exemplary embodiment. The device for delimiting data items for a data transmission protocol can be applied to an electronic device as shown in FIG. 10 , so as to realize the technical solution of this specification. The data item demarcation device for the data transmission protocol is applied to the data receiving end; the data received by the data receiving end includes one or more data items; the multiple data items correspond to one or more data types ; The data length of each data item in the plurality of data items is not fixed and unpredictable; the data receiving end is configured with a first buffer for delimiting each data item included in the received data , and a second buffer for parsing out each data item from the received data; the means may include:
第一缓冲单元1102,用于接收并缓存所述数据发送端发送的数据,将所述数据的首字节确定为目标字节,迭代执行以下步骤,直至对缓存的数据均完成检测:从所述目标字节开始,检测用于划分不同数据项的分隔字符串;若检测到所述分隔字符串,则确定包含所述目标字节在内的位于所述目标字节之后且位于检测到的首个分隔字符串之前的数据为数据项,并将检测出的数据项复制至所述第二缓冲单元;将位于所述检测到的首个分隔字符串之后的数据的首字节确定为所述目标字节;The first buffer unit 1102 is configured to receive and buffer the data sent by the data sending end, determine the first byte of the data as the target byte, and perform the following steps iteratively until all the buffered data are detected: from all Starting from the target byte, detect the delimited character string used to divide different data items; if the delimited character string is detected, then determine that the target byte, including the target byte, is located after the target byte and is located at the detected The data before the first delimited character string is a data item, and the detected data item is copied to the second buffer unit; the first byte of the data after the detected first delimited character string is determined as the the target byte;
第二缓冲单元1104,用于接收所述第一缓冲单元发送的待解析数据项,对所述数据项进行解析,并提供业务流程使用;The second buffering unit 1104 is configured to receive the data item to be parsed sent by the first buffering unit, parse the data item, and provide it for use in a business process;
上述装置中各个单元的功能和作用的实现过程具体详见上述方法中对应步骤的实现过程,在此不再赘述。For the implementation process of the functions and effects of each unit in the above device, please refer to the implementation process of the corresponding steps in the above method for details, and will not be repeated here.
对于装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例只是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本说明书方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。As for the device embodiment, since it basically corresponds to the method embodiment, for related parts, please refer to the part description of the method embodiment. The device embodiments described above are only illustrative, and the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in a place, or can also be distributed to multiple network elements. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution in this specification. It can be understood and implemented by those skilled in the art without creative effort.
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机,计算机的具体形式可以是个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合。The systems, devices, modules, or units described in the above embodiments can be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementing device is a computer, which may take the form of a personal computer, laptop computer, cellular phone, camera phone, smart phone, personal digital assistant, media player, navigation device, e-mail device, game control device, etc. desktops, tablets, wearables, or any combination of these.
在一个典型的配置中,计算机包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。In a typical configuration, a computer includes one or more processors (CPUs), input/output interfaces, network interfaces and memory.
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。Memory may include non-permanent storage in computer readable media, in the form of random access memory (RAM) and/or nonvolatile memory such as read only memory (ROM) or flash RAM. Memory is an example of computer readable media.
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带、磁盘存储、量子存储器、基于石墨烯的存储介质或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology for storage of information. Information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Flash memory or other memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by computing devices. As defined herein, computer-readable media excludes transitory computer-readable media, such as modulated data signals and carrier waves.
本申请所涉及的用户信息(包括但不限于用户设备信息、用户个人信息等)和数据(包括但不限于用于分析的数据、存储的数据、展示的数据等),均为经用户授权或者经过各方充分授权的信息和数据,并且相关数据的收集、使用和处理需要遵守相关国家和地区的相关法律法规和标准,并提供有相应的操作入口,供用户选择授权或者拒绝。The user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are authorized by the user or Information and data that have been fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation portals for users to choose to authorize or refuse.
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。It should also be noted that the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes Other elements not expressly listed, or elements inherent in the process, method, commodity, or apparatus are also included. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。The foregoing describes specific embodiments of this specification. Other implementations are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. Multitasking and parallel processing are also possible or may be advantageous in certain embodiments.
在本说明书一个或多个实施例中使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本说明书一个或多个实施例。在本说明书一个或多个实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。Terms used in one or more embodiments of this specification are for the purpose of describing specific embodiments only, and are not intended to limit one or more embodiments of this specification. As used in one or more embodiments of this specification and the appended claims, the singular forms "a", "the", and "the" are also intended to include the plural forms unless the context clearly dictates otherwise. It should also be understood that the term "and/or" as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
应当理解,尽管在本说明书一个或多个实施例可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本说明书一个或多个实施例范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。It should be understood that although the terms first, second, third, etc. may be used in one or more embodiments of the present specification to describe various information, the information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of one or more embodiments of the present specification, first information may also be called second information, and similarly, second information may also be called first information. Depending on the context, the word "if" as used herein may be interpreted as "at" or "when" or "in response to a determination."
以上所述仅为本说明书一个或多个实施例的较佳实施例而已,并不用以限制本说明书一个或多个实施例,凡在本说明书一个或多个实施例的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本说明书一个或多个实施例保护的范围之内。The above descriptions are only preferred embodiments of one or more embodiments of this specification, and are not intended to limit one or more embodiments of this specification. Within the spirit and principles of one or more embodiments of this specification, Any modification, equivalent replacement, improvement, etc. should be included in the scope of protection of one or more embodiments of this specification.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310781168.XA CN116684397A (en) | 2023-06-28 | 2023-06-28 | Data item delimiting method, device, equipment and storage medium of data transmission protocol |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310781168.XA CN116684397A (en) | 2023-06-28 | 2023-06-28 | Data item delimiting method, device, equipment and storage medium of data transmission protocol |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN116684397A true CN116684397A (en) | 2023-09-01 |
Family
ID=87782090
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202310781168.XA Pending CN116684397A (en) | 2023-06-28 | 2023-06-28 | Data item delimiting method, device, equipment and storage medium of data transmission protocol |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN116684397A (en) |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20020161801A1 (en) * | 2001-04-26 | 2002-10-31 | Hind John R. | Efficient processing of extensible markup language documents in content based routing networks |
| CN102783101A (en) * | 2010-03-25 | 2012-11-14 | 日本电气株式会社 | Load balance control unit, load balance control method, and storage medium |
| CN103269339A (en) * | 2013-05-03 | 2013-08-28 | 武汉噢易科技有限公司 | File transmission method and system based on hypertext transfer protocol |
| US10664508B1 (en) * | 2018-04-13 | 2020-05-26 | Amazon Technologies, Inc. | Server-side filtering of unstructured data items at object storage services |
-
2023
- 2023-06-28 CN CN202310781168.XA patent/CN116684397A/en active Pending
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20020161801A1 (en) * | 2001-04-26 | 2002-10-31 | Hind John R. | Efficient processing of extensible markup language documents in content based routing networks |
| CN102783101A (en) * | 2010-03-25 | 2012-11-14 | 日本电气株式会社 | Load balance control unit, load balance control method, and storage medium |
| CN103269339A (en) * | 2013-05-03 | 2013-08-28 | 武汉噢易科技有限公司 | File transmission method and system based on hypertext transfer protocol |
| US10664508B1 (en) * | 2018-04-13 | 2020-05-26 | Amazon Technologies, Inc. | Server-side filtering of unstructured data items at object storage services |
Non-Patent Citations (1)
| Title |
|---|
| 孙国忠;袁清波;陈明宇;樊建平;: "用于二级缓存的一种改进的自适应缓存管理算法", 计算机研究与发展, no. 08, 15 August 2007 (2007-08-15) * |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US10043220B2 (en) | Method, device and storage medium for data processing | |
| CN109885577B (en) | Data processing method, device, terminal and storage medium | |
| KR101719500B1 (en) | Acceleration based on cached flows | |
| CN112433920A (en) | Buried point data reporting method, device, equipment and medium | |
| CN107689976A (en) | A kind of document transmission method and device | |
| CN114895852A (en) | Data processing method, system, device, storage medium and electronic device | |
| WO2018156979A1 (en) | Selective distribution of messages in a publish-subscribe system | |
| CN113808711B (en) | DICOM file processing method, device, computer equipment and storage medium | |
| CN109450689B (en) | Log printing method and device, storage medium and computer equipment | |
| CN116684397A (en) | Data item delimiting method, device, equipment and storage medium of data transmission protocol | |
| CN111459819B (en) | Software testing method and device, electronic equipment, computer readable medium | |
| CN114168607A (en) | Global serial number generation method, device, equipment, medium and product | |
| WO2021233042A1 (en) | Page data loading method, apparatus, and system | |
| WO2025157255A1 (en) | Log persistence method and apparatus for cdn, medium, and electronic device | |
| CN109068170B (en) | Storage method, device, terminal and storage medium for barrage message | |
| JP2001159998A (en) | Web contents cache system, its method and recording medium | |
| CN115495026B (en) | An optimized memory processing method, device, equipment and storage medium | |
| CN114895851A (en) | Data processing method, device, storage medium and electronic device | |
| CN115374074A (en) | Log processing method and device, storage medium and electronic equipment | |
| CN113704176A (en) | File scanning method, file scanning device, electronic equipment, program product and storage medium | |
| CN119276790B (en) | Message processing method, device, equipment, network card and computer program product | |
| CN114610678A (en) | File access method, storage node and network card | |
| CN112487218A (en) | Content processing method, system, device, computing equipment and storage medium | |
| CN110753136A (en) | Domain name resolution method, device, equipment and storage medium | |
| CN116700940B (en) | Request handling method, system and device based on encapsulation class and medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |