Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the implementation principle of header compression in http2?

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article is to share with you about the implementation principle of the first compression in http2, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

HPACK protocol, in which the principle is Huffman coding and index table (it seems that the commonly used data structures and algorithms should be understood)

Each HTTP transport carries a set of headers that describe the resources and their properties of the transfer. In HTTP/1.x, this metadata is always in plain text, typically adding 500-800 bytes of overhead to each transfer. If you use HTTP Cookie, the additional overhead can sometimes reach thousands of bytes. (see measuring and controlling protocol overhead. To reduce this overhead and improve performance, HTTP/2 uses the HPACK compression format to compress request and response header metadata, which uses two simple but powerful techniques:

This format enables the header field of the transmission to be encoded by static Huffman code, thus reducing the size of each transmission. This format requires both the client and the server to maintain and update an index list containing previously seen header fields (in other words, it can establish a shared compression context), which is then used as a reference to effectively encode previously transmitted values.

Practice shows that analyzing http2 messages through wireshark grab packets will benefit a lot from understanding http2.

If you want to have knowledge, you have to take part in the practice of changing reality. If you want to know the taste of a pear, you have to change the pear and eat it yourself. If you want to know the organizational properties of atoms, you have to carry out experiments in physics and chemistry to change the situation of atoms. If you want to know the theories and methods of revolution, you must take part in the revolution.

The following is a screenshot of the package capture information

"http2 sets header table size through Settings frames for header compression"

"after http2 is compressed by the header, the Index of the: method pseudo header in the index table is 2"

Commonly used headers are stored in fixed locations in static index tables

These are the principles of the first compression in http2. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report