1 // Copyright (c) 2023 Huawei Device Co., Ltd. 2 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // you may not use this file except in compliance with the License. 4 // You may obtain a copy of the License at 5 // 6 // http://www.apache.org/licenses/LICENSE-2.0 7 // 8 // Unless required by applicable law or agreed to in writing, software 9 // distributed under the License is distributed on an "AS IS" BASIS, 10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // See the License for the specific language governing permissions and 12 // limitations under the License. 13 14 //! [HPACK] implementation of the [HTTP/2 protocol]. 15 //! 16 //! [HPACK]: https://httpwg.org/specs/rfc7541.html 17 //! [HTTP/2 protocol]: https://httpwg.org/specs/rfc9113.html 18 //! 19 //! # Introduction 20 //! In [HTTP/1.1], header fields are not compressed. As web pages have grown 21 //! to require dozens to hundreds of requests, the redundant header fields in 22 //! these requests unnecessarily consume bandwidth, measurably increasing 23 //! latency. 24 //! 25 //! [SPDY] initially addressed this redundancy by compressing header fields 26 //! using the [DEFLATE] format, which proved very effective at efficiently 27 //! representing the redundant header fields. However, that approach exposed a 28 //! security risk as demonstrated by the 29 //! [CRIME (Compression Ratio Info-leak Made Easy)] attack. 30 //! 31 //! This specification defines HPACK, a new compressor that eliminates redundant 32 //! header fields, limits vulnerability to known security attacks, and has a 33 //! bounded memory requirement for use in constrained environments. Potential 34 //! security concerns for HPACK are described in Section 7. 35 //! 36 //! The HPACK format is intentionally simple and inflexible. Both 37 //! characteristics reduce the risk of interoperability or security issues due 38 //! to implementation error. No extensibility mechanisms are defined; changes 39 //! to the format are only possible by defining a complete replacement. 40 //! 41 //! [HTTP/1.1]: https://www.rfc-editor.org/rfc/rfc9112.html 42 //! [SPDY]: https://datatracker.ietf.org/doc/html/draft-mbelshe-httpbis-spdy-00 43 //! [DEFLATE]: https://www.rfc-editor.org/rfc/rfc1951.html 44 //! [CRIME (Compression Ratio Info-leak Made Easy)]: https://en.wikipedia.org/w/index.php?title=CRIME&oldid=660948120 45 46 mod decoder; 47 mod encoder; 48 mod integer; 49 mod representation; 50 pub(crate) mod table; 51 52 pub(crate) use decoder::HpackDecoder; 53 pub(crate) use encoder::HpackEncoder; 54