WO2015000361A1 - 报文压缩的方法和装置 - Google Patents

报文压缩的方法和装置 Download PDF

Info

Publication number
WO2015000361A1
WO2015000361A1 PCT/CN2014/080097 CN2014080097W WO2015000361A1 WO 2015000361 A1 WO2015000361 A1 WO 2015000361A1 CN 2014080097 W CN2014080097 W CN 2014080097W WO 2015000361 A1 WO2015000361 A1 WO 2015000361A1
Authority
WO
WIPO (PCT)
Prior art keywords
compressed
content
message
original content
original
Prior art date
Application number
PCT/CN2014/080097
Other languages
English (en)
French (fr)
Inventor
张亮
郭凯
高伟
吴俊�
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP14819791.6A priority Critical patent/EP3013015B1/en
Publication of WO2015000361A1 publication Critical patent/WO2015000361A1/zh
Priority to US14/985,576 priority patent/US20160119449A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/04Protocols for data compression, e.g. ROHC
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/60Network streaming of media packets
    • H04L65/65Network streaming protocols, e.g. real-time transport protocol [RTP] or real-time control protocol [RTCP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers

Definitions

  • the present invention relates to the field of communications technologies, and in particular, to a packet compression method and apparatus.
  • HTTP Hyper text t rans fer pro toco l
  • HTTP Hyper text t rans fer pro toco l
  • the basic process of the HTTP request and the HTTP response may include: when the user requests the web page by clicking a hyperlink in a web page or directly inputting the web address in the browser, the browser takes each object in the web page
  • the HTTP request message is sent to the web server. After the web server receives the web request, it includes these objects in the HTTP response message as a response.
  • HTTP compression is a method of transferring compressed data between a web server and a browser.
  • HTTP compression usually compresses HTML, JavaScr i pt, CSS, etc. files with gz i p (the name of the compression method) compression algorithm.
  • the biggest benefit of compression is to reduce the amount of data transmitted over the network, thereby increasing the speed of client browser access. Of course, it also increases the burden on the server.
  • the text can include: header ( ⁇ ) and body ⁇ entity).
  • header ( ⁇ ) and body ⁇ entity.
  • body ⁇ entity the complete content in the text is dynamically compressed by the unit. Therefore, when only two parts of the two texts are different, the compression algorithm is still needed to compress the complete processing of the two messages. Lower.
  • An embodiment of the present invention provides a method and an apparatus for compressing a message. After the foregoing solution, only the variable part of the compressed message needs to be compressed, and the compressed content of the invariable part can be directly obtained, thereby avoiding completeness. The message is compressed, which increases the compression efficiency.
  • the first aspect provides a method for compressing a message, including:
  • the compressing the first original content by the static dictionary actually refers to querying the correspondence between the first original content and the first compressed content saved in the static dictionary according to the first original content, thereby obtaining the first compressed content, and It is not necessary to use a compression algorithm to compress the first original content, so the speed of acquiring the first compressed content is fast.
  • the static dictionary includes a correspondence between the first original content and the first compressed content
  • the static dictionary includes a correspondence between the first original content and a corresponding compression method.
  • the compressing the second original content by using a dynamic dictionary to obtain the second compressed content includes:
  • the to-be-encrypted file includes a header header, where the header includes a name field and a value va lue field corresponding to the name field, the first original content includes content in the name field, and the second original content includes content in a va lue field corresponding to the name field.
  • the to-be-compressed message further includes a message body
  • the second original content further includes the body
  • the to-be-compressed packet is hypertext transmission Protocol HTTP packet, real-time transport protocol RTP packet, or real-time streaming protocol RTSP packet.
  • the second aspect provides a device for compressing a message, including:
  • a receiving unit configured to receive a to-be-compressed message sent by the sending end
  • An acquiring unit configured to acquire a first original content in the unchangeable portion of the to-be-compressed packet, and obtain a second original content in the changeable portion of the to-be-compressed packet;
  • a compression unit configured to compress the first original content by using a static dictionary to obtain a first compressed content, and compress the second original content by using a dynamic dictionary to obtain a second compressed content;
  • the receiving end sends the compressed message, where the compressed message includes the first compressed content and the second compressed content.
  • the static dictionary includes a correspondence between the first original content and the first compressed content
  • the static dictionary includes a correspondence between the first original content and a corresponding compression method.
  • the compression unit includes:
  • a determining module configured to determine whether a correspondence between the second original content and the second compressed content is included in the dynamic dictionary
  • a compression module configured to compress the second original content to obtain the second compressed content, and obtain a correspondence between the second original content and the second compressed content, if the correspondence is not included Stored in the dynamic dictionary.
  • the packet to be compressed received by the receiving unit includes: a packet header,
  • the header includes a name field and a value va lue field corresponding to the name field
  • the first original content includes content in the name field
  • the second original content includes a va lue field corresponding to the name field In the content.
  • the packet to be compressed received by the receiving unit further includes a body of the message, and the second original content further includes the body .
  • the receiving unit receives the to-be-compressed packet It is a Hypertext Transfer Protocol HTTP packet, a real-time transport protocol RTP packet, or a real-time streaming protocol RTSP packet.
  • the method and device for compressing a message provided by the embodiment of the present invention, after receiving the foregoing solution, receiving a to-be-compressed packet sent by the sending end; and determining the to-be-compressed packet according to the variability of the content included in the to-be-compressed packet Performing compression to obtain a compressed message; sending the compressed message to the receiving end, so that the receiving end performs a corresponding operation according to the to-be-compressed message.
  • the different compression methods are used to compress the changeable part and the unchangeable part of the compressed message. When only two parts of the two messages have different contents, only a small part of the content needs to be compressed by the dynamic dictionary, and the content is the same. This part can directly obtain the compressed content through the static dictionary, which avoids the need to use the compression algorithm to compress the complete compressed message to improve the compression efficiency.
  • Figure 1 is a schematic diagram of the mechanism of the H t tp message
  • FIG. 2 is a flowchart of a method for packet compression according to an embodiment of the present invention
  • FIG. 3 is a flowchart of another method for packet compression according to the embodiment.
  • FIG. 4 is a flowchart of still another method for packet compression according to the embodiment.
  • FIG. 5 is a schematic structural diagram of a scenario applied by the method shown in FIG. 3;
  • FIG. 6 is a schematic structural diagram of an encoder provided in the method shown in FIG. 3;
  • FIG. 7 is a schematic structural diagram of a decoder provided in the method shown in FIG. 3;
  • FIG. 8 is a schematic structural diagram of an apparatus for compressing a message according to an embodiment of the present invention.
  • FIG. 9 is a schematic structural diagram of another apparatus for packet compression according to the embodiment.
  • the to-be-compressed packet and the compressed packet provided in this embodiment may be a hypertext transmission protocol HTTP packet, a real-time transmission protocol RTP packet, or a real-time streaming protocol RTSP packet.
  • Figure 1 shows a typical HTTP packet format.
  • the packet can include both the header and the body. Header describes the HTTP message, and Body is the object of the HTTP request, for example, a web page.
  • Each line in the header is divided into two fields with a colon: the name field and the va lue field.
  • Exp i res is the name field
  • Fr i , 31 Aug 2012 03: 09: 47 GMT is Va lue.
  • the Header and the Body are compressed.
  • the Header content often changes, if the Header and the Body are compressed, the entire message is recompressed after each Header change, and the complexity is high.
  • the apparatus for performing packet compression in the embodiment may be:
  • the compressed message is first received before the compressed message is compressed.
  • the compressing the first original content by using the static dictionary actually refers to querying the correspondence between the first original content and the first compressed content saved in the static dictionary according to the first original content, thereby obtaining the first compressed content. It is not necessary to use a compression algorithm to compress the first original content, so the speed of acquiring the first compressed content is fast.
  • the compressed message may be compressed according to the variability of the content in the packet to be compressed, that is, the first original content and the second original content are compressed by using different compression methods, so that Compressed messages can get a better compression ratio.
  • the compressed text may include: a first compressed content and a second compressed content.
  • This embodiment provides another method for packet compression, which is a further extension of the method shown in FIG. 2.
  • the method may include:
  • the sending end sends the compressed message to the receiving end.
  • the message compressing device first receives the to-be-compressed message sent by the sending end.
  • the packet to be compressed may be a hypertext transfer protocol HTTP packet, a real-time transport protocol RTP packet, or a real-time streaming protocol RTSP packet.
  • the message to be compressed may include, but is not limited to, a header, and the header may include, but is not limited to, a name field and a value va lue field corresponding to the name field.
  • the first original content may include, but is not limited to, a name field.
  • the content of the second original content may include, but is not limited to, content in the va lue field corresponding to the name field, and the like.
  • This example does not limit the name field and the va lue field. It is a technique well known to those skilled in the art. For example, the content before the ":" in a certain segment of the message is the name field, and the content before the ":” is va. The lue field is not described here.
  • the embodiment includes the first original content and the second original content.
  • the content is not limited, and can be set according to actual needs, and will not be described here.
  • the to-be-compressed text may further include a stylistic body
  • the second original content may further include a body
  • the static dictionary may include, but is not limited to, a correspondence between the first original content and the first compressed content.
  • the message compression device may store a static dictionary. After receiving the to-be-compressed message sent by the sending end, the first original content is obtained from the to-be-compressed message, and then may be static according to the identifier of the first original content. The first compressed content corresponding to the first original content is obtained in the dictionary.
  • the compression of the name field "User-Agent” may include: obtaining the compressed content corresponding to the User-Agent from the static dictionary, and obtaining 2F, in other words, by using the static dictionary for the name field "User- The Agent” compresses to get the codeword 2F.
  • the static dictionary may include a correspondence between the first original content and a corresponding compression method.
  • the compression method corresponding to the first original content is obtained from the static dictionary according to the acquired identifier of the first original content, and then the first original content is compressed according to the obtained compression method to obtain the first compressed content.
  • the content stored in the static dictionary and the method for compressing the first original content according to the static dictionary are not limited, and may be set according to actual needs, and details are not described herein again.
  • 304. Determine whether a correspondence between the second original content and the second compressed content is included in the dynamic dictionary. If the correspondence is included, step 306 is performed; if the correspondence is not included, step 305 is performed.
  • the content stored in the dynamic dictionary may not be the content corresponding to the changed second original content.
  • the dynamic dictionary may store a compression relationship table, where the correspondence relationship between the second original content and the second compressed content is stored, so that the dynamic information may be dynamically updated according to the identifier of the second original content.
  • the second compressed content is obtained in the dictionary.
  • the method for storing the correspondence between the second original content and the second compressed content in the dynamic dictionary is not limited, and may be set according to actual needs, and details are not described herein again.
  • the method for compressing the second original content to obtain the second compressed content is not limited, and is a technology well known to those skilled in the art, and may be set according to actual needs, for example, but not limited to, gz ip, etc. I will not repeat them here.
  • the dynamic dictionary may include, but is not limited to, a correspondence between the second original content and the second compressed content.
  • compressing the second original content by using the dynamic dictionary may include, but is not limited to, including: by using a dynamic dictionary to the va lue field "Moz il la/5. 0 (XI I; U; Linux i 686 ; en-US; rv: 1. 9. 2. 8) Gecko/20100723 Ubuntu/ 10. 04 (luc id) Fi refox/ 3. 6. 8" After compression, get the code word A45D. Since in Dynamic Dict iffy, a shorter codeword is used instead of a longer content, a better compression ratio can be obtained.
  • steps 303 to 306 are respectively performed to compress the first original content and the second original content, and the execution sequence is not limited to the embodiment. Compressing, compressing the first original content; or compressing the first original content and the second original content at the same time.
  • the packet decompressing device decompresses the compressed packet, and then sends the decompressed corresponding packet to the receiving end, so that the packet received by the receiving end is The message to be compressed, in this way, the transmission resource can be saved by transmitting the compressed message.
  • the message compression device can not only compress the compressed message but also decompress the compressed message. Another embodiment is provided below, which is mainly used to describe that the message compression device performs the compressed message.
  • the decompression method as shown in FIG. 4, may specifically include:
  • the method for decompressing a message is not limited in this embodiment, and is a technique well known to those skilled in the art. And can be set according to actual needs, for example, can be decompressed by a static dictionary and a dynamic dictionary. Specifically, the first original content or the second original content corresponding to the compressed message can be obtained from a dynamic dictionary or a static dictionary. , and then get the corresponding content to be compressed.
  • Figure 5 is a schematic structural diagram of the present scenario.
  • the message compression device may include two encoder compression devices, and the message compression device may include an encoder and a decoder, as shown in FIG. 6 and FIG. 7, respectively, which are structural diagrams of the encoder and the decoder.
  • the encoder can be used to compress the compressed file
  • the decoder can be used to decompress the compressed file.
  • the workflow for compressing the packet by the encoder may include, but is not limited to: receiving and parsing the compressed file by using Ht tp Parser, identifying and acquiring the first original content in the file to be compressed according to the HTTP protocol.
  • the second original content for example, identifies and obtains the name field and the va lue field in the header, and then obtains the first compressed content corresponding to the name field from the static dictionary; determines whether the dynamic dictionary includes the va lue field and the first Corresponding relationship between the two compressed contents, if included, obtaining the second compressed content corresponding to the va lue field from the dynamic dictionary, if not, the gz ip may be used to compress the va lue field and obtain the second compressed content, and The correspondence between the second compressed content and the va lue field is stored in the dynamic dictionary for subsequent query and use.
  • the workflow of decompressing the packet by the decoder may include, but is not limited to: receiving the compressed message, identifying and acquiring the first compressed content and the second compressed content in the compressed message, and then acquiring and recovering from the static dictionary
  • the first original content corresponding to the first compressed content; the second original content corresponding to the second compressed content is obtained from the dynamic dictionary, and the message to be compressed is obtained.
  • the user has used the terminal to perform registration as an example, and the data transmission between the terminal and the server is briefly described.
  • the user uses the terminal to input information such as the user name and the password; the terminal sends a request for the compressed message to the left message compression device, where the request for the compressed message includes information such as a user name and a password; and the coder according to the variability of the message request
  • the compressed message request is compressed to obtain a compressed message request; the compressed message request is sent to the right side of the compressed device through the WAN (Wide Area Network), and the decoder compresses the message.
  • the packet is to be compressed, and the packet to be compressed is sent to the server.
  • the packet to be compressed sent by the sending end is received; the compressed message is compressed according to the variability of the content of the packet to be compressed, and the compressed packet is obtained; and the compressed packet is sent to the receiving end, so that The receiving end performs a corresponding operation according to the packet to be compressed, and in addition, the compressed message can be decompressed.
  • the changeable and unchangeable parts in the compressed message are compressed or decompressed in different ways, so that both the changeable part and the unchangeable part are better compressed or decompressed, thereby increasing the compression ratio. Further, when the content to be compressed is changed, the The changed content is recompressed or decompressed, and the entire compressed message is not compressed or decompressed.
  • the compressed content can be directly obtained through the static dictionary, which simplifies the compression or decompression process.
  • the compression ratio of the >3 ⁇ 4 text to be compressed is also increased, that is, the size of the compressed text is reduced.
  • the compression ratio of the header of the ⁇ is as high as 90%.
  • This embodiment provides a device for compressing a message, as shown in FIG. 8, which may include:
  • the receiving unit 81 is configured to receive a to-be-compressed packet sent by the sending end.
  • the obtaining unit 82 is configured to obtain the first original content in the unchangeable part of the to-be-compressed message, and obtain the second original content in the changeable part of the to-be-compressed message;
  • the compressing unit 83 is configured to compress the first original content by using a static dictionary to obtain the first compressed content, and compress the second original content through the dynamic dictionary to obtain the second compressed content.
  • the sending unit 84 is configured to send the compressed message to the receiving end, where the compressed message includes the first compressed content and the second compressed content.
  • the static dictionary includes a correspondence between the first original content and the first compressed content
  • the static dictionary includes a correspondence between the first original content and a corresponding compression method.
  • the compression unit 83 includes:
  • the determining module 831 is configured to determine whether the correspondence between the second original content and the second compressed content is included in the dynamic dictionary
  • the compression module 832 is configured to compress the second original content if the correspondence is not included, obtain the second compressed content, and store the correspondence between the second original content and the second compressed content in the dynamic dictionary.
  • the packet to be compressed received by the receiving unit 81 includes: a header header, the header includes a name field and a value va lue field corresponding to the name field, where the first original content includes the name The content in the field, the second original content includes the content in the va lue field corresponding to the name field.
  • the to-be-compressed message received by the receiving unit 81 further includes a body of the message, and the second original content further includes a body.
  • the packet to be compressed received by the receiving unit 81 is a Hypertext Transfer Protocol HTTP packet, a Real-Time Transport Protocol RTP packet, or a Real-Time Streaming Protocol (RTSP) packet.
  • HTTP Hypertext Transfer Protocol
  • RTP Real-Time Transport Protocol
  • RTSP Real-Time Streaming Protocol
  • the device for compressing the message may further include a unit for decompressing the compressed message.
  • the changeable part and the unchangeable part in the compressed message are compressed in different ways, so that both the changeable part and the unchangeable part are better compressed, thereby increasing the compression ratio.
  • the content to be compressed is changed, only the changed content may be recompressed or decompressed, and the entire compressed message is not compressed or decompressed, and the immutable content may directly pass static.
  • the dictionary is obtained, which simplifies the compression or decompression process. At the same time, it also increases the compression ratio of the message to be compressed, that is, reduces the size of the compressed message.
  • FIG. 1 Another apparatus embodiment is provided below, which is an apparatus embodiment corresponding to the embodiment shown in Figs. 1-4.
  • the embodiment of the present invention provides another apparatus 1 for compressing a message.
  • the apparatus 1 for compressing the message comprises: at least one processor 15, such as a CPU, at least one output interface 16 or other user interface 17,
  • the memory 18 is at least one communication bus 19. Communication bus 19 is used to implement connection communication between these components.
  • the message compression device 1 optionally includes other user interfaces 17, including a display, a keyboard or a pointing device (e.g., a mouse, a trackball (t rackba l l), a touchpad or a tactile display).
  • the memory 18 may include a high speed RAM (Random Acces s Memory), and may also include a non-volatile memory, such as at least one disk memory.
  • the memory 18 can optionally include at least one storage device located remotely from the aforementioned processor 15.
  • memory 18 stores the following elements, executable modules or data structures, or a subset thereof, or their extension set:
  • Operating system 180 which contains various system programs for implementing various basic services and handling hardware-based tasks.
  • the application 181 contains various applications for implementing various application services.
  • Application 181 may, but is not limited to, include:
  • a receiving unit configured to receive a to-be-compressed message sent by the sending end
  • An acquiring unit configured to acquire first original content in an unchangeable portion of the to-be-compressed packet, and obtain a second original content in the changeable portion of the to-be-compressed packet;
  • a compression unit configured to compress the first original content by using a static dictionary to obtain a first compressed content, and compress the second original content by using a dynamic dictionary to obtain a second compressed content;
  • a sending unit configured to send the compressed message to the receiving end, where the compressed message includes the first compressed content and the second compressed content.
  • the static dictionary includes a correspondence between the first original content and the first compressed content.
  • the static dictionary includes a correspondence between the first original content and a corresponding compression method.
  • the compression unit includes:
  • a determining module configured to determine whether a correspondence between the second original content and the second compressed content is included in the dynamic dictionary
  • a compression module configured to compress the second original content if the correspondence is not included, to obtain the second compressed content, and store the correspondence between the second original content and the second compressed content in the dynamic dictionary.
  • the "to be compressed" received by the receiving unit includes: a header header, the header includes a name field and a value va lue field corresponding to the name field, the first original content includes content in the name field, and the second The original content includes the content in the va lue field corresponding to the name field.
  • the to-be-compressed message received by the receiving unit further includes a body of the message
  • the second original content further includes a body 0.
  • the to-be-compressed packet received by the receiving unit is a hypertext transfer protocol HTTP packet, a real-time transport protocol RTP packet, or a real-time streaming protocol RTSP packet.
  • each module in the application 181 refers to the corresponding modules in the embodiment shown in FIG. 8, and details are not described herein again.
  • the processor 15 by calling a program or instruction stored in the memory 18, the processor 15 is configured to:
  • the first original content is compressed by the static dictionary to obtain the first compressed content
  • the second original content is compressed by the dynamic dictionary to obtain the second compressed content
  • the compressed message is sent to the receiving end, and the compressed message includes the first compressed content and the second compressed content.
  • the processor 15 is specifically configured to: the static dictionary includes a correspondence between the first original content and the first compressed content;
  • the static dictionary includes a correspondence between the first original content and a corresponding compression method.
  • the processor 15 is specifically configured to compress the second original content by using a dynamic dictionary, where the obtained second compressed content includes:
  • the file to be compressed obtained by the processor 15 includes a header header, and the header includes a name field and a value va lue field corresponding to the name field, where the first original content includes content in the name field, and the second original content includes The content in the va lue field corresponding to the name field.
  • the packet to be compressed acquired by the processor 15 further includes a body of the message, and the second original content. Also includes body 0
  • the packet to be compressed obtained by the processor 15 is a Hypertext Transfer Protocol HTTP packet, a Real Time Transport Protocol RTP packet, or a Real Time Streaming Protocol (RTSP) packet.
  • HTTP Hypertext Transfer Protocol
  • RTP Real Time Transport Protocol
  • RTSP Real Time Streaming Protocol
  • the device for compressing the message can separately compress the changeable part and the unchangeable part of the compressed message in different manners, so that the changeable part and the unchangeable part are better compressed, and further Increased compression ratio.
  • the content of the packet to be compressed changes, only the changed content may be recompressed or decompressed, and the entire compressed message is not compressed or decompressed, and the immutable content may directly pass through the static dictionary. Obtained, simplifies the compression or decompression process, and at the same time increases the compression ratio of the file to be compressed, that is, reduces the size of the compressed file.
  • the present invention can be implemented by means of software plus necessary general hardware, and of course, by hardware, but in many cases, the former is a better implementation. .
  • the technical solution of the present invention which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a readable storage medium, such as a floppy disk of a computer.
  • a hard disk or optical disk or the like includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform the methods described in various embodiments of the present invention.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Multimedia (AREA)
  • Information Transfer Between Computers (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Computer And Data Communications (AREA)

Abstract

本发明提供一种报文压缩的方法和装置。涉及通信技术领域。解决了采用将Header和Body一起压缩的方法对报文进行压缩,增加了压缩过程的复杂度的问题。本发明的方法具体可以包括:接收发送端发送的待压缩报文;获取待压缩报文的不可变化部分中的第一原始内容,并获取待压缩报文的可变化部分中的第二原始内容;通过静态字典对第一原始内容进行压缩,得到第一压缩内容,且通过动态字典对第二原始内容进行压缩,得到第二压缩内容;向接收端发送已压缩报文,已压缩报文包括第一压缩内容和第二压缩内容。可应用于报文压缩中。

Description

报文压缩的方法和装置 技术领域
本发明涉及通信技术领域, 尤其涉及报文压缩的方法和装置。
背景技术
HTTP (Hyper text t rans fer pro toco l , 超文本传输协议)用于描述 Web客户 端如何从 Web服务器请求 Web页面,以及 Web服务器如何把 Web页面发送给 Web 客户的过程和相关消息。
具体的, HTTP请求和 HTTP响应的基本过程可以包括: 当用户通过点击某个 Web页面中的超链接或者直接在浏览器中输入网址来请求 Web页面时,浏览器把 该 Web页面中的各个对象的 HTTP请求消息发送给 Web服务器。 Web服务器收到 Web请求后, 将这些对象包含在 HTTP响应消息中作为响应。
为了适应网络流量的不断增长,许多设备通过各种手段来节省带宽。 HTTP压 缩是在 Web服务器和浏览器间传输压缩数据的方法。 HTTP压缩通常釆用 gz i p (— 种压缩方法的名称)压缩算法压缩 HTML、 JavaScr i pt , CSS 等文件。 压缩的最 大好处就是降低了网络传输的数据量, 从而提高客户端浏览器的访问速度。 当 然, 同时也会增加服务器的负担。
具体的, ^艮文中可以包括: header ( ^艮文头)和 body 艮文实体)。 现有技 术对才艮文中的完整内容为单位进行动态压缩, 因此, 当两个才艮文只有少部分内 容不同时, 仍需要使用压缩算法分别对这两个报文的完整进行压缩处理, 效率 较低。
发明内容
本发明的实施例提供一种报文压缩的方法和装置, 釆用上述方案后, 只需 要对待压缩报文中可变部分进行压缩, 不可变部分的压缩内容可直接获取到, 避免了对完整的报文进行压缩, 增加了压缩效率。
为达到上述目的, 本发明的实施例釆用如下技术方案:
第一方面, 提供一种报文压缩的方法, 包括:
接收发送端发送的待压缩报文;
获取所述待压缩报文的不可变化部分中的第一原始内容, 并获取所述待压 缩报文的可变化部分中的第二原始内容;
通过静态字典对所述第一原始内容进行压缩, 得到第一压缩内容, 且通过 动态字典对所述第二原始内容进行压缩, 得到第二压缩内容;
向接收端发送所述已压缩报文, 所述已压缩报文包括所述第一压缩内容和 所述第二压缩内容。 其中, 通过静态字典对所述第一原始内容进行压缩实际上是指根据第一原 始内容查询静态字典中保存的第一原始内容和第一压缩内容的对应关系, 从而 获得第一压缩内容, 并不需要使用压缩算法对第一原始内容做压缩处理, 因此 获取第一压缩内容的速度很快。
在第一种可能的实现方式中, 所述静态字典包括所述第一原始内容与所述 第一压缩内容的对应关系;
或者,
所述静态字典包括所述第一原始内容与相应的压缩方法的对应关系。
结合第一方面或第一方面的第一种可能的实现方式, 在第二种可能的实现 方式中, 所述通过动态字典对所述第二原始内容进行压缩, 得到第二压缩内容 包括:
判断所述动态字典中是否包含有所述第二原始内容和所述第二压缩内容的 对应关系;
若不包含所述对应关系, 则对所述第二原始内容进行压缩, 得到所述第二 压缩内容, 并将所述第二原始内容与所述第二压缩内容的对应关系存储于所述 动态字典中。
结合第一方面的第一种可能的实现方式或第二种可能的实现方式, 在第三 种可能的实现方式中, 所述待压缩 文包括 文头 header , 所述 header包括名 称 name字段和与所述 name字段对应的值 va lue字段, 所述第一原始内容包括 所述 name字段中的内容,所述第二原始内容包括与所述 name字段对应的 va lue 字段中的内容。
结合第一方面的第三种可能的实现方式, 在第四种可能的实现方式中, 所 述待压缩报文还包括报文体 body, 所述第二原始内容还包括所述 body。
结合第一方面或第一方面的第一种可能的实现方式至第四种可能的实现方 式中任意一种方式, 在第五种可能的实现方式中, 所述待压缩报文为超文本传 输协议 HTTP报文、 实时传输协议 RTP报文或者实时流协议 RTSP报文。
第二方面, 提供一种报文压缩的装置, 包括:
接收单元, 用于接收发送端发送的待压缩报文;
获取单元, 用于获取所述待压缩报文的不可变化部分中的第一原始内容, 并获取所述待压缩报文的可变化部分中的第二原始内容;
压缩单元, 用于通过静态字典对所述第一原始内容进行压缩, 得到第一压 缩内容, 且通过动态字典对所述第二原始内容进行压缩, 得到第二压缩内容; 发送单元, 用于向接收端发送所述已压缩报文, 所述已压缩报文包括所述 第一压缩内容和所述第二压缩内容。
在第一种可能的实现方式中, 所述静态字典包括所述第一原始内容与所述 第一压缩内容的对应关系;
或者,
所述静态字典包括所述第一原始内容与相应的压缩方法的对应关系。
结合第二方面或第二方面的第一种可能的实现方式, 在第二种可能的实现 方式中, 所述压缩单元包括:
判断模块, 用于判断所述动态字典中是否包含有所述第二原始内容和所述 第二压缩内容的对应关系;
压缩模块, 用于若不包含所述对应关系, 则对所述第二原始内容进行压缩, 得到所述第二压缩内容, 并将所述第二原始内容与所述第二压缩内容的对应关 系存储于所述动态字典中。
结合第二方面的第一种可能的实现方式或第二种可能的实现方式, 在第三 种可能的实现方式中, 所述接收单元接收的待压缩报文包括: 报文头 header , 所述 header包括名称 name字段和与所述 name字段对应的值 va lue字段, 所述 第一原始内容包括所述 name字段中的内容,所述第二原始内容包括与所述 name 字段对应的 va lue字段中的内容。
结合第二方面的第三种可能的实现方式, 在第四种可能的实现方式中, 所 述接收单元接收的待压缩报文还包括报文体 body, 所述第二原始内容还包括所 述 body。
结合第二方面或第二方面的第一种可能的实现方式至第四种可能的实现方 式中任意一种方式, 在第五种可能的实现方式中, 所述接收单元接收的待压缩 报文为超文本传输协议 HTTP报文、实时传输协议 RTP报文或者实时流协议 RTSP 报文。
本发明实施例提供的报文压缩的方法和装置, 釆用上述方案后, 接收发送 端发送的待压缩报文; 根据所述待压缩报文包括的内容的可变性对所述待压缩 报文进行压缩, 得到已压缩报文; 向接收端发送所述已压缩报文, 以便所述接 收端根据所述待压缩报文执行相应操作。 分别釆取不同压缩方法对待压缩报文 中的可变化部分与不可变化部分进行压缩, 当两个报文只有少部分内容不同时 , 只需要通过动态字典对该少部分内容进行压缩, 内容相同的这部分内容可以通 过静态字典直接得到压缩后的内容, 避免了需要使用压缩算法对完整的待压缩 报文进行压缩处理, 提高了压缩效率。
附图说明
为了更清楚地说明本发明实施例中的技术方案, 下面将对实施例描述中所 需要使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是本发明 的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳动的前提下, 还可以根据这些附图获得其他的附图。
图 1为 H t tp报文的机构示意图;
图 2为本实施例提供的一种报文压缩的方法流程图;
图 3为本实施例提供的另一种报文压缩的方法流程图;
图 4为本实施例提供的再一种报文压缩的方法流程图;
图 5为图 3所示的方法所应用的场景结构示意图;
图 6为图 3所示的方法中提供的编码器的结构示意图;
图 7为图 3所示的方法中提供的解码器的结构示意图; 图 8为本实施例提供的一种报文压缩的装置的结构示意图;
图 9为本实施例提供的另一种报文压缩的装置的结构示意图。
具体实施方式
下面将结合本发明实施例中的附图, 对本发明实施例中的技术方案进行清 楚、 完整地描述, 显然, 所描述的实施例仅仅是本发明一部分实施例, 而不是 全部的实施例。 基于本发明中的实施例, 本领域普通技术人员在没有作出创造 性劳动前提下所获得的所有其他实施例, 都属于本发明保护的范围。
为了可以更清晰的对本实施例进行描述, 下面首先对 HTTP报文进行简单介 绍。
值得说明的是, 本实施例提供的待压缩报文和已压缩报文均可以为超文本 传输协议 HTTP报文、 实时传输协议 RTP报文或者实时流协议 RTSP报文等。
图 1为典型的 HTTP的报文格式, 报文可以包括 Header和 Body两个部分。 Header描述了该 HTTP报文, 而 Body是 HTTP请求的对象, 例如, 网页等。 在 Header中每一行用冒号将内容分为两个域: name字段和 va lue字段。在图 1中, Exp i res是 name字段, 而 Fr i , 31 Aug 2012 03: 09: 47 GMT是 Va lue。
现有技术中, 是将 Header和 Body—起压缩, 但是, 由于 Header内容经常 变动, 因此若将 Header和 Body—起压缩, 则每次 Header变动后要重新压缩整 个报文, 复杂度较高。
为了解决上述问题, 本实施例提供一种报文压缩的方法, 本实施例的执行 主体可以为报文压缩的装置, 如图 2所示, 可以包括:
201、 接收发送端发送的待压缩报文。
为了为后续步骤作铺垫, 在对待压缩报文进行压缩前, 首先接收待压缩报 文。
202、 获取待压缩报文的不可变化部分中的第一原始内容, 并获取待压缩报 文的可变化部分中的第二原始内容。
203、 通过静态字典对第一原始内容进行压缩, 得到第一压缩内容, 且通过 动态字典对第二原始内容进行压缩, 得到第二压缩内容。
其中, 通过静态字典对所述第一原始内容进行压缩, 实际上是指根据第一 原始内容查询静态字典中保存的第一原始内容和第一压缩内容的对应关系, 从 而获得第一压缩内容, 并不需要使用压缩算法对第一原始内容做压缩处理, 因 此获取第一压缩内容的速度很快。
作为本实施例的一种实施方式, 可以根据待压缩报文中的内容的可变性对 待压缩报文进行压缩, 即釆取不同压缩方式对第一原始内容和第二原始内容进 行压缩, 使得已压缩报文可以得到更好的压缩率。
204、 向接收端发送已压缩 ^艮文。
其中, 已压缩 文可以包括: 第一压缩内容和第二压缩内容。
釆用上述方案后, 分别釆取不同压缩方法对待压缩报文中的可变化部分与 不可变化部分进行压缩, 当两个报文只有少部分内容不同时, 只需要通过动态 字典对该少部分内容进行压缩, 内容相同的这部分内容可以通过静态字典直接 得到压缩后的内容, 避免了需要使用压缩算法对完整的待压缩报文进行压缩处 理, 提高了压缩效率。
本实施例提供另一种报文压缩的方法, 该方法是对图 2 所示的方法的进一 步扩展, 如图 3所示, 可以包括:
301、 接收发送端发送的待压缩报文。
为了节省传输资源, 发送端向接收端发送已压缩报文, 为了为后续步骤做 铺垫, 报文压缩装置首先接收发送端发送的待压缩报文。
进一步的,待压缩报文可以为超文本传输协议 HTTP报文、实时传输协议 RTP 报文或者实时流协议 RTSP报文等。
302、 获取待压缩报的不可变化部分中第一原始内容, 并获取待压缩报文包 括的内容的可变化部分中的第二原始内容。
进一步的, 待压缩报文可以但不限于包括: header , header可以但不限于 包括: 名称 name字段和与名称 name字段对应的值 va lue字段, 第一原始内容 可以但不限于包括: name字段中的内容, 第二原始内容可以但不限于包括: 与 name字段对应的 va lue字段中的内容等。
本实施例对 name字段和 va lue字段不作限定, 为本领域技术人员熟知的技 术, 例如, 报文的某一段中 ":" 前的内容即为 name 字段, ":" 前的内容即为 va lue字段, 在此不再赘述。
待压缩报文中还可能包括其他内容, 因此, 第一原始内容与第二原始内容 的总和可能不能构成一个完整的待压缩报文, 本实施例对第一原始内容与第二 原始内容包括的内容不作限定, 可以根据实际需要进行设定, 在此不作赘述。
进一步的, 待压缩 文还可以包括 文体 body, 第二原始内容还可以包括 body。
303、 从静态字典中获取第一压缩内容, 得到第一压缩内容。
进一步的, 静态字典可以但不限于包括: 第一原始内容与第一压缩内容的 对应关系。
具体的, 报文压缩装置中可以存储有静态字典, 当接收到发送端发送的待 压缩报文后, 从待压缩报文中获取第一原始内容, 然后可以根据第一原始内容 的标识从静态字典中获取该第一原始内容对应的第一压缩内容。
例如, 如图 1所示, 对 name字段 "User-Agent" 进行压缩可以包括: 从静 态字典中获取与 User-Agent对应的压缩内容, 可以得到 2F , 换言之, 通过静态 字典对 name字段 "User-Agent" 进行压缩后得到码字 2F。
或者, 静态字典可以包括第一原始内容与相应的压缩方法的对应关系。 具体的, 可以根据获取到的第一原始内容的标识从静态字典中获取第一原 始内容对应的压缩方法, 然后, 根据获取到压缩方法对第一原始内容进行压缩, 得到第一压缩内容。
本实施例对静态字典中存储的内容、 和根据静态字典对第一原始内容进行 压缩的方法不作限定, 可以根据实际需要进行设置, 在此不再赘述。 304、 判断动态字典中是否包含有第二原始内容和第二压缩内容的对应关 系。 若包括对应关系, 则执行步骤 306; 若不包括对应关系, 则执行步骤 305。
由于第二原始内容是可变的, 因此动态字典中存储的可能不是与变化后的 第二原始内容对应的内容。 在通过动态字典获取第二压缩内容前, 首先需要判 断动态字典中是否包含有第二原始内容和第二压缩内容的对应关系。
作为本实施例的一种实施方式, 动态字典可以存储有压缩关系表, 该压缩 关系表中存储有第二原始内容和第二压缩内容的对应关系, 使得可以根据第二 原始内容的标识从动态字典中获取第二压缩内容。
本实施例对动态字典存储第二原始内容和第二压缩内容的对应关系的方法 不作限定, 可以根据实际需要进行设定, 在此不再赘述。
305、 对第二原始内容进行压缩, 得到第二压缩内容, 并将第二原始内容与 该第二压缩内容的对应关系存储于动态字典中。
本实施例对将第二原始内容进行压缩得到第二压缩内容的方法不作限定, 为本领域技术人员熟知的技术, 且可以根据实际需要进行设定, 例如, 可以但 不限于为 gz i p等, 在此不再赘述。
执行步骤 307。
306、 从动态字典中获取第二压缩内容, 得到第二压缩内容。
进一步的, 动态字典可以但不限于包括: 第二原始内容与第二压缩内容的 对应关系。
作为本实施例的一种实施方式, 通过动态字典对第二原始内容进行压缩可 以但不限于包括:通过动态字典对 va lue字段" Moz i l la/5. 0 (XI I ; U; Linux i 686; en-US; rv: 1. 9. 2. 8) Gecko/20100723 Ubuntu/ 10. 04 (luc id) Fi refox/ 3. 6. 8" 进行压缩后得到码字 A45D。 由于在 Dynamic Dict ionary中, 用较短的码字代替 较长的内容, 可以得到较好的压缩率。
值得说明的是, 步骤 303至步骤 306分别为对第一原始内容和第二原始内 容进行压缩的步骤, 执行顺序不仅限于本实施例所提供的, 即还可以为: 先对 第二原始内容进行压缩, 在对第一原始内容进行压缩; 或者, 同时对第一原始 内容和第二原始内容进行压缩。
307、向接收端发送已压缩报文,以便接收端根据待压缩报文执行相应操作。 在接收端接收到相应报文之前, 可以通过报文解压缩设备对已压缩报文进 行解压缩, 然后再将解压缩后的相应报文发送至接收端, 使得接收端接收到的 报文为待压缩报文, 这样, 通过传输被压缩后的报文可以节省传输资源。
进一步的, 报文压缩装置不仅可以对待压缩报文进行压缩, 而且还可以对 已压缩报文进行解压缩, 下面提供另一种实施例, 主要用于描述报文压缩装置 对已压缩报文进行解压缩的方法, 如图 4所示, 具体可以包括:
401、 接收发送端发送的已压缩报文。
402、 根据已压缩报文包括的内容的可变性对已压缩报文进行解压缩, 得到 解压缩报文。
本实施例对解压缩报文的方法不作限定, 为本领域技术人员说熟知的技术, 且可以根据实际需要进行设定, 例如, 可以通过静态字典和动态字典记性解压 缩, 具体的, 可以从动态字典或静态字典中获取与已压缩报文对应的第一原始 内容或第二原始内容, 进而得到相应的待压缩内容。
403、 向接收端发送解压缩报文, 以便接收端可以根据解压缩报文执行相应 操作。
为了可以更清楚的对上述实施例进行理解, 下面提供一个具体场景: 图 5 为本场景的结构示意图, 其中每当终端向服务器发送报文时, 发送端 为终端, 接收端为服务器; 本场景中可以包括两个报文压缩装置, 报文压缩装 置中可以包括编码器和解码器, 如图 6和图 7所示, 分别为编码器和解码器的 结构示意图。 其中, 编码器可以用于对待压缩文件进行压缩, 解码器可以用于 对已压缩文件进行解压缩。
具体的, 编码器对报文进行压缩的工作流程可以但不限于包括: 接收并通 过 Ht tp Parser对待压缩^艮文进行解析, 按照 HTTP协议识别并获取待压缩 ^艮文 中的第一原始内容和第二原始内容, 例如, 识别并获取 Header 中的 name字段 及 va lue字段等,然后,从静态字典中获取与 name字段相对应的第一压缩内容; 判断动态字典中是否包括 va lue 字段与第二压缩内容的对应关系, 若包含, 则 从动态字典中获取 va lue字段对应的第二压缩内容,若不包含,则可以釆用 gz ip 对 va lue字段进行压缩并得到第二压缩内容, 并将该第二压缩内容与 va lue字 段的对应关系存储至动态字典中, 以便后续查询与使用等。
解码器对报文进行解压缩的工作流程可以但不限于包括: 接收已压缩报文, 识别并获取已压缩报文中的第一压缩内容和第二压缩内容, 然后, 从静态字典 中获取与第一压缩内容相对应的第一原始内容; 从动态字典中获取与第二压缩 内容对应的第二原始内容, 进而可以得到待压缩报文。
值得说明的是, 本实施例不限于应用于上述列举的场景中, 还可以应用于 其他场景中, 在此不作限定和赘述。
作为本实施例的一种实施方式, 已用户使用终端进行注册为例, 对终端与 服务器进行数据传输进行简单说明。
用户使用终端输入用户名与密码等信息; 终端向左侧报文压缩装置发送待 压缩报文请求, 该待压缩报文请求中包括用户名与密码等信息; 编码器根据报 文请求的可变性对待压缩报文请求进行压缩, 得到已压缩报文请求; 将已压缩 才艮文请求通过 WAN ( Wide Area Network, 广域网 )发送至右侧的 ^艮文压缩装置 中, 解码器对已压缩报文进行解压缩, 得到待压缩报文; 将待压缩报文发送至 服务器。
釆用上述方案后, 接收发送端发送的待压缩报文; 根据待压缩报文包括的 内容的可变性对待压缩报文进行压缩, 得到已压缩报文; 向接收端发送已压缩 报文, 以便接收端根据待压缩报文执行相应操作, 另外, 该可以对已压缩报文 进行解压缩。 分别釆取不同方式对待压缩报文中的可变化部分与不可变化部分 进行压缩或解压缩, 使得可变化部分与不可变换部分均得到了更好的压缩或解 压缩, 进而增加了压缩率。 进一步的, 当待压缩才艮文内容变化时, 可以只对该 变化的内容进行重新压缩或解压缩, 而不需要对整个待压缩报文进行压缩或解 压缩, 针对不可变化的内容可直接通过静态字典获取到压缩后的内容, 简化了 压缩或解压缩过程, 同时, 还增加了待压缩>¾文的压缩率, 即减小了已压缩才艮 文的大小。
为了可以更清晰的表示本实施例带来的有益效果, 下面提供一些应用本实 施例提供的方法进行测试的数据结果。
1、 釆用本方法, 对 ^艮文的 Header的压缩率高达 90%。
Figure imgf000010_0001
如直接釆用 gz i p压缩 Header , 其压缩率在 50%以下, 远低于我们方案。 下面提供另一个装置实施例, 该装置实施例是与图 1-4 所示的实施例对应 的装置实施例。
本实施例提供一种报文压缩的装置, 如图 8所示, 可以包括:
接收单元 81 , 用于接收发送端发送的待压缩报文;
获取单元 82 , 用于获取待压缩报文的不可变化部分中的第一原始内容, 并 获取待压缩报文的可变化部分中的第二原始内容;
压缩单元 83 , 用于通过静态字典对第一原始内容进行压缩, 得到第一压缩 内容, 且通过动态字典对第二原始内容进行压缩, 得到第二压缩内容;
发送单元 84 , 用于向接收端发送已压缩报文, 已压缩报文包括第一压缩内 容和第二压缩内容。
进一步的, 静态字典包括第一原始内容与第一压缩内容的对应关系; 或者,
静态字典包括第一原始内容与相应的压缩方法的对应关系。
进一步的, 压缩单元 83包括:
判断模块 831 ,用于判断动态字典中是否包含有第二原始内容和第二压缩内 容的对应关系;
压缩模块 832 , 用于若不包含对应关系, 则对第二原始内容进行压缩, 得到 第二压缩内容, 并将第二原始内容与第二压缩内容的对应关系存储于动态字典 中。
进一步的, 接收单元 81 接收的待压缩报文包括: 报文头 header , header 包括名称 name字段和与 name字段对应的值 va lue字段,第一原始内容包括 name 字段中的内容, 第二原始内容包括与 name字段对应的 va lue字段中的内容。 进一步的,接收单元 81接收的待压缩报文还包括报文体 body, 第二原始内 容还包括 body。
进一步的, 接收单元 81接收的待压缩报文为超文本传输协议 HTTP报文、 实时传输协议 RTP报文或者实时流协议 RTSP报文。
另外, 报文压缩的装置还可以包括用于对已压缩的报文进行解压缩的单元, 具体实施方式在上述方法权利要求中已进行了描述, 在此不再赘述。
釆用上述方案后, 分别釆取不同方式对待压缩报文中的可变化部分与不可 变化部分进行压缩, 使得可变化部分与不可变换部分均得到了更好的压缩, 进 而增加了压缩率。 进一步的, 当待压缩才艮文内容变化时, 可以只对该变化的内 容进行重新压缩或解压缩, 而不需要对整个待压缩报文进行压缩或解压缩, 不 可变的内容可以直接通过静态字典获取到, 简化了压缩或解压缩过程, 同时, 还增加了待压缩报文的压缩率, 即减小了已压缩报文的大小。
下面提供另一个装置实施例, 该装置实施例是与图 1-4 所示的实施例对应 的装置实施例。
如图 9所示, 本发明实施例提供另一种报文压缩的装置 1 , 该报文压缩的装 置 1包括: 至少一个处理器 15 , 例如 CPU, 至少一个输出接口 16或者其他用户 接口 17 , 存储器 18 , 至少一个通信总线 19。 通信总线 19用于实现这些组件之 间的连接通信。 该报文压缩的装置 1可选的包含其他用户接口 17 , 包括显示器, 键盘或者点击设备(例如, 鼠标, 轨迹球( t rackba l l ), 触感板或者触感显示 屏)。 存储器 18可能包含高速 RAM ( Random Acces s Memory, 随机存取存储器 ), 也可能还包括非不稳定的存储器 (non- vola t i le memory ), 例如至少一个磁盘 存储器。 存储器 18可选的可以包含至少一个位于远离前述处理器 15的存储装 置。
在一些实施方式中, 存储器 18存储了如下的元素, 可执行模块或者数据结 构, 或者他们的子集, 或者他们的扩展集:
操作系统 180, 包含各种系统程序, 用于实现各种基础业务以及处理基于硬 件的任务。
应用程序 181 , 包含各种应用程序, 用于实现各种应用业务。
应用程序 181中可以但不限于包括:
接收单元, 用于接收发送端发送的待压缩报文;
获取单元, 用于获取待压缩报文的不可变化部分中的第一原始内容, 并获 取待压缩报文的可变化部分中的第二原始内容;
压缩单元, 用于通过静态字典对第一原始内容进行压缩, 得到第一压缩内 容, 且通过动态字典对第二原始内容进行压缩, 得到第二压缩内容;
发送单元, 用于向接收端发送已压缩报文, 已压缩报文包括第一压缩内容 和第二压缩内容。
进一步的, 静态字典包括第一原始内容与第一压缩内容的对应关系; 或者,
静态字典包括第一原始内容与相应的压缩方法的对应关系。
进一步的, 压缩单元包括:
判断模块, 用于判断动态字典中是否包含有第二原始内容和第二压缩内容 的对应关系;
压缩模块, 用于若不包含对应关系, 则对第二原始内容进行压缩, 得到第 二压缩内容, 并将第二原始内容与第二压缩内容的对应关系存储于动态字典中。
进一步的, 接收单元接收的待压缩" ^艮文包括: 4艮文头 header , header包括 名称 name字段和与 name字段对应的值 va lue字段, 第一原始内容包括 name字 段中的内容, 第二原始内容包括与 name字段对应的 va lue字段中的内容。
进一步的, 接收单元接收的待压缩报文还包括报文体 body, 第二原始内容 还包括 body0
进一步的, 接收单元接收的待压缩报文为超文本传输协议 HTTP报文、 实时 传输协议 RTP报文或者实时流协议 RTSP报文。
应用程序 181 中各模块的具体实现参见图 8所示实施例中的相应模块, 在 此不再赘述。
在本发明实施例中, 通过调用存储器 18 中存储的程序或指令, 处理器 15 用于:
接收发送端发送的待压缩报文;
获取待压缩报文的不可变化部分中的第一原始内容, 并获取待压缩报文的 可变化部分中的第二原始内容;
通过静态字典对第一原始内容进行压缩, 得到第一压缩内容, 且通过动态 字典对第二原始内容进行压缩, 得到第二压缩内容;
向接收端发送已压缩报文, 已压缩报文包括第一压缩内容和第二压缩内容。 进一步的, 处理器 15 , 具体用于静态字典包括第一原始内容与第一压缩内 容的对应关系;
或者,
静态字典包括第一原始内容与相应的压缩方法的对应关系。
进一步的, 处理器 15 , 具体用于通过动态字典对第二原始内容进行压缩, 得到第二压缩内容包括:
判断动态字典中是否包含有笫二原始内容和笫二压缩内容的对应关系; 若不包含对应关系, 则对第二原始内容进行压缩, 得到第二压缩内容, 并 将第二原始内容与第二压缩内容的对应关系存储于动态字典中。
进一步的, 处理器 15获取的待压缩 文包括 ^艮文头 header , header 包括 名称 name字段和与 name字段对应的值 va lue字段, 第一原始内容包括 name字 段中的内容, 第二原始内容包括与 name字段对应的 va lue字段中的内容。
进一步的, 处理器 15获取的待压缩报文还包括报文体 body, 第二原始内容 还包括 body0
进一步的, 处理器 15获取的待压缩报文为超文本传输协议 HTTP报文、 实 时传输协议 RTP报文或者实时流协议 RTSP报文。
釆用上述方案后, 报文压缩的装置可以分别釆取不同方式对待压缩报文中 的可变化部分与不可变化部分进行压缩, 使得可变化部分与不可变换部分均得 到了更好的压缩, 进而增加了压缩率。 进一步的, 当待压缩报文内容变化时, 可以只对该变化的内容进行重新压缩或解压缩, 而不需要对整个待压缩报文进 行压缩或解压缩, 不可变的内容可以直接通过静态字典获取到, 简化了压缩或 解压缩过程, 同时, 还增加了待压缩^艮文的压缩率, 即减小了已压缩^艮文的大 小。
通过以上的实施方式的描述, 所属领域的技术人员可以清楚地了解到本发 明可借助软件加必需的通用硬件的方式来实现, 当然也可以通过硬件, 但很多 情况下前者是更佳的实施方式。 基于这样的理解, 本发明的技术方案本质上或 者说对现有技术做出贡献的部分可以以软件产品的形式体现出来, 该计算机软 件产品存储在可读取的存储介质中, 如计算机的软盘, 硬盘或光盘等, 包括若 干指令用以使得一台计算机设备(可以是个人计算机, 服务器, 或者网络设备 等)执行本发明各个实施例所述的方法。
以上所述, 仅为本发明的具体实施方式, 但本发明的保护范围并不局限于 此, 任何熟悉本技术领域的技术人员在本发明揭露的技术范围内, 可轻易想到 变化或替换, 都应涵盖在本发明的保护范围之内。 因此, 本发明的保护范围应 所述以权利要求的保护范围为准。

Claims

权 利 要 求 书
1、 一种报文压缩的方法, 其特征在于, 包括:
接收发送端发送的待压缩报文;
获取所述待压缩报文的不可变化部分中的第一原始内容, 并获取所述待压 缩报文的可变化部分中的第二原始内容;
通过静态字典对所述第一原始内容进行压缩, 得到第一压缩内容, 且通过 动态字典对所述第二原始内容进行压缩, 得到第二压缩内容;
向接收端发送所述已压缩报文, 所述已压缩报文包括所述第一压缩内容和 所述第二压缩内容。
2、 根据权利要求 1所述的方法, 其特征在于,
所述静态字典包括所述第一原始内容与所述第一压缩内容的对应关系; 或者,
所述静态字典包括所述第一原始内容与相应的压缩方法的对应关系。
3、 根据权利要求 1或 2所述的方法, 其特征在于, 所述通过动态字典对所 述第二原始内容进行压缩, 得到第二压缩内容包括:
判断所述动态字典中是否包含有所述第二原始内容和所述第二压缩内容的 对应关系;
若不包含所述对应关系, 则对所述第二原始内容进行压缩, 得到所述第二 压缩内容, 并将所述第二原始内容与所述第二压缩内容的对应关系存储于所述 动态字典中。
4、 根据权利要求 2或 3所述的方法, 其特征在于, 所述待压缩报文包括报 文头 header ,所述 header包括名称 name字段和与所述 name字段对应的值 va lue 字段, 所述第一原始内容包括所述 name字段中的内容, 所述第二原始内容包括 与所述 name字段对应的 va lue字段中的内容。
5、 根据权利要求 4所述的方法, 其特征在于, 所述待压缩报文还包括报文 体 body, 所述第二原始内容还包括所述 body。
6、 根据权利要求 1至 5中任意一项所述的方法, 其特征在于, 所述待压缩 报文为超文本传输协议 HTTP报文、实时传输协议 RTP报文或者实时流协议 RTSP 报文。
7、 一种报文压缩的装置, 其特征在于, 包括:
接收单元, 用于接收发送端发送的待压缩报文;
获取单元, 用于获取所述待压缩报文的不可变化部分中的第一原始内容, 并获取所述待压缩报文的可变化部分中的第二原始内容;
压缩单元, 用于通过静态字典对所述第一原始内容进行压缩, 得到第一压 缩内容, 且通过动态字典对所述第二原始内容进行压缩, 得到第二压缩内容; 发送单元, 用于向接收端发送所述已压缩报文, 所述已压缩报文包括所述 第一压缩内容和所述第二压缩内容。
8、 根据权利要求 7所述的装置, 其特征在于,
所述静态字典包括所述第一原始内容与所述第一压缩内容的对应关系; 或者,
所述静态字典包括所述第一原始内容与相应的压缩方法的对应关系。
9、 根据权利要求 7或 8所述的装置, 其特征在于, 所述压缩单元包括: 判断模块, 用于判断所述动态字典中是否包含有所述第二原始内容和所述 第二压缩内容的对应关系;
压缩模块, 用于若不包含所述对应关系, 则对所述第二原始内容进行压缩, 得到所述第二压缩内容, 并将所述第二原始内容与所述第二压缩内容的对应关 系存储于所述动态字典中。
10、 根据权利要求 8或 9所述的装置, 其特征在于, 所述接收单元接收的 待压缩报文包括:报文头 header ,所述 header包括名称 name字段和与所述 name 字段对应的值 va lue字段, 所述第一原始内容包括所述 name字段中的内容, 所 述第二原始内容包括与所述 name字段对应的 va lue字段中的内容。
11、 根据权利要求 10所述的装置, 其特征在于, 所述接收单元接收的待压 缩才艮文还包括"¾文体 body, 所述第二原始内容还包括所述 body。
12、 根据权利要求 7至 11中任意一项所述的装置, 其特征在于, 所述接收 单元接收的待压缩报文为超文本传输协议 HTTP报文、 实时传输协议 RTP报文或 者实时流协议 RTSP 文。
PCT/CN2014/080097 2013-07-03 2014-06-17 报文压缩的方法和装置 WO2015000361A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP14819791.6A EP3013015B1 (en) 2013-07-03 2014-06-17 Packet compression method and apparatus
US14/985,576 US20160119449A1 (en) 2013-07-03 2015-12-31 Packet compression method and apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310276319.2A CN104283777B (zh) 2013-07-03 2013-07-03 报文压缩的方法和装置
CN201310276319.2 2013-07-03

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US14/985,576 Continuation US20160119449A1 (en) 2013-07-03 2015-12-31 Packet compression method and apparatus

Publications (1)

Publication Number Publication Date
WO2015000361A1 true WO2015000361A1 (zh) 2015-01-08

Family

ID=52143088

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/080097 WO2015000361A1 (zh) 2013-07-03 2014-06-17 报文压缩的方法和装置

Country Status (4)

Country Link
US (1) US20160119449A1 (zh)
EP (1) EP3013015B1 (zh)
CN (1) CN104283777B (zh)
WO (1) WO2015000361A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017092389A1 (zh) * 2015-11-30 2017-06-08 中兴通讯股份有限公司 报文处理方法及装置
CN113612516A (zh) * 2021-07-13 2021-11-05 深圳震有科技股份有限公司 一种卫星通信数据包的压缩测试方法、系统及设备

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106033448A (zh) * 2015-03-17 2016-10-19 阿里巴巴集团控股有限公司 Html页面压缩方法及装置
US10511695B2 (en) * 2015-06-23 2019-12-17 Georgia Tech Research Corporation Packet-level clustering for memory-assisted compression of network traffic
CN107534650B (zh) * 2015-09-29 2020-01-31 华为技术有限公司 一种帧传输方法、装置和网络系统
CN107643906B (zh) * 2016-07-22 2021-01-05 华为技术有限公司 数据处理方法及装置
CN106572080B (zh) * 2016-10-14 2020-01-17 重庆金美通信有限责任公司 一种基于lzw压缩算法对snmp报文进行压缩和加密的方法
JP2019193129A (ja) * 2018-04-26 2019-10-31 株式会社日立製作所 データ転送装置及びデータ転送方法、並びにデータ転送装置を備えたネットワークシステム
CN109831409B (zh) * 2018-12-19 2021-06-18 东软集团股份有限公司 数据传输方法、装置、计算机可读存储介质及电子设备
CN112671810B (zh) * 2021-03-18 2021-06-01 紫光恒越技术有限公司 一种数据处理方法、装置、电子设备、服务器及存储设备
CN115695563A (zh) * 2021-07-29 2023-02-03 华为技术有限公司 一种通信方法、装置及设备
CN113556404A (zh) * 2021-08-03 2021-10-26 广东九博科技股份有限公司 一种设备内部单盘间的通信方法及系统

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101159667A (zh) * 2007-10-16 2008-04-09 中兴通讯股份有限公司 用于移动多媒体广播系统对分组数据进行报头压缩的方法
CN102420672A (zh) * 2011-01-25 2012-04-18 苏州汉明科技有限公司 无线局域网无线接入点向无线控制器进行数据转发的方法
CN102474753A (zh) * 2009-08-17 2012-05-23 高通股份有限公司 用于中继节点的报头压缩

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7026962B1 (en) * 2000-07-27 2006-04-11 Motorola, Inc Text compression method and apparatus
TW543311B (en) * 2000-11-16 2003-07-21 Ericsson Telefon Ab L M Static information knowledge used with binary compression methods
US6883035B2 (en) * 2000-11-16 2005-04-19 Telefonaktiebolaget Lm Ericsson (Publ) System and method for communicating with temporary compression tables
GB0513432D0 (en) * 2005-06-30 2005-08-10 Nokia Corp Signal message compression
CN200941459Y (zh) * 2006-07-14 2007-08-29 富士康(昆山)电脑接插件有限公司 电连接器组件
US7817630B2 (en) * 2006-12-18 2010-10-19 Telefonaktiebolaget Lm Ericsson (Publ) Method, communications node, and memory for dynamic dictionary updating and optimization for compression and decompression of messages
CN102843345B (zh) * 2011-06-24 2015-07-22 中磊电子(苏州)有限公司 远程沟通方法及其计算机程序产品
GB2496385B (en) * 2011-11-08 2014-03-05 Canon Kk Methods and network devices for communicating data packets

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101159667A (zh) * 2007-10-16 2008-04-09 中兴通讯股份有限公司 用于移动多媒体广播系统对分组数据进行报头压缩的方法
CN102474753A (zh) * 2009-08-17 2012-05-23 高通股份有限公司 用于中继节点的报头压缩
CN102420672A (zh) * 2011-01-25 2012-04-18 苏州汉明科技有限公司 无线局域网无线接入点向无线控制器进行数据转发的方法

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017092389A1 (zh) * 2015-11-30 2017-06-08 中兴通讯股份有限公司 报文处理方法及装置
CN113612516A (zh) * 2021-07-13 2021-11-05 深圳震有科技股份有限公司 一种卫星通信数据包的压缩测试方法、系统及设备

Also Published As

Publication number Publication date
EP3013015A1 (en) 2016-04-27
CN104283777A (zh) 2015-01-14
EP3013015B1 (en) 2019-02-20
CN104283777B (zh) 2018-08-21
EP3013015A4 (en) 2016-12-14
US20160119449A1 (en) 2016-04-28

Similar Documents

Publication Publication Date Title
WO2015000361A1 (zh) 报文压缩的方法和装置
US8681813B2 (en) Bandwidth optimization for remote desktop protocol
CN102184231A (zh) 获取页面资源的方法及装置
JP2014534492A5 (zh)
CN102546612B (zh) 用户态下基于rdma协议的远程过程调用实现方法
CN101794298A (zh) 一种实现页面适配的方法、页面适配系统及通信系统
WO2015158064A1 (zh) 一种通信协议转换方法及装置、存储介质
CN102970287A (zh) 一种http请求数据的处理方法
WO2012100701A1 (zh) 一种获取图文信息的装置、系统及方法
CN102638580A (zh) 一种网页信息处理方法和装置
WO2013078830A1 (zh) 一种处理移动终端的页面访问请求的方法、设备与系统
Lemlouma et al. Adapted content delivery for different contexts
US10534852B2 (en) Display system and virtual web device in the cloud
US20090094263A1 (en) Enhanced utilization of network bandwidth for transmission of structured data
JP4554723B2 (ja) ネットワーク応答バッファリング動作の管理
TWI673983B (zh) 一種資料壓縮傳輸方法和系統、及其終端和伺服器
Phung et al. An experimental study of network coded REST HTTP in dynamic IoT systems
Apte et al. Wireless SOAP: optimizations for mobile wireless web services
WO2014146248A1 (zh) 一种应用于远程桌面的视频传输方法及设备、系统
JP2013073464A (ja) 通信装置および通信方法、ならびに、プログラム
CN117082124B (zh) 数据传送方法、装置、设备、介质及产品
KR100925644B1 (ko) 오브젝트 전송 시스템 및 그 제어방법
WO2017161651A1 (zh) 一种数据传输方法、第一终端、第二终端及系统
CN106790662A (zh) 一种使用关键帧压缩的超文本传输协议数据压缩方法
Pinandito et al. Architectural Design of Representational State Transfer Application Programming Interface with Application-Level Base64-Encoding and Zlib Data Compression

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14819791

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

WWE Wipo information: entry into national phase

Ref document number: 2014819791

Country of ref document: EP