DESCRIPTION.rst 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. ========================================
  2. hpack: HTTP/2 Header Encoding for Python
  3. ========================================
  4. .. image:: https://raw.github.com/Lukasa/hyper/development/docs/source/images/hyper.png
  5. .. image:: https://travis-ci.org/python-hyper/hpack.png?branch=master
  6. :target: https://travis-ci.org/python-hyper/hpack
  7. This module contains a pure-Python HTTP/2 header encoding (HPACK) logic for use
  8. in Python programs that implement HTTP/2. It also contains a compatibility
  9. layer that automatically enables the use of ``nghttp2`` if it's available.
  10. Documentation
  11. =============
  12. Documentation is available at http://python-hyper.org/hpack/.
  13. Contributing
  14. ============
  15. ``hpack`` welcomes contributions from anyone! Unlike many other projects we are
  16. happy to accept cosmetic contributions and small contributions, in addition to
  17. large feature requests and changes.
  18. Before you contribute (either by opening an issue or filing a pull request),
  19. please `read the contribution guidelines`_.
  20. .. _read the contribution guidelines: http://hyper.readthedocs.org/en/development/contributing.html
  21. License
  22. =======
  23. ``hpack`` is made available under the MIT License. For more details, see the
  24. ``LICENSE`` file in the repository.
  25. Authors
  26. =======
  27. ``hpack`` is maintained by Cory Benfield, with contributions from others. For
  28. more details about the contributors, please see ``CONTRIBUTORS.rst``.
  29. Release History
  30. ===============
  31. 3.0.0 (2017-03-29)
  32. ------------------
  33. **API Changes (Backward Incompatible)**
  34. - Removed nghttp2 support. This support had rotted and was essentially
  35. non-functional, so it has now been removed until someone has time to re-add
  36. the support in a functional form.
  37. - Attempts by the encoder to exceed the maximum allowed header table size via
  38. dynamic table size updates (or the absence thereof) are now forbidden.
  39. **API Changes (Backward Compatible)**
  40. - Added a new ``InvalidTableSizeError`` thrown when the encoder does not
  41. respect the maximum table size set by the user.
  42. - Added a ``Decoder.max_allowed_table_size`` field that sets the maximum
  43. allowed size of the decoder header table. See the documentation for an
  44. indication of how this should be used.
  45. **Bugfixes**
  46. - Up to 25% performance improvement decoding HPACK-packed integers, depending
  47. on the platform.
  48. - HPACK now tolerates receiving multiple header table size changes in sequence,
  49. rather than only one.
  50. - HPACK now forbids header table size changes anywhere but first in a header
  51. block, as required by RFC 7541 § 4.2.
  52. - Other miscellaneous performance improvements.
  53. 2.3.0 (2016-08-04)
  54. ------------------
  55. **Security Fixes**
  56. - CVE-2016-6581: HPACK Bomb. This release now enforces a maximum value of the
  57. decompressed size of the header list. This is to avoid the so-called "HPACK
  58. Bomb" vulnerability, which is caused when a malicious peer sends a compressed
  59. HPACK body that decompresses to a gigantic header list size.
  60. This also adds a ``OversizedHeaderListError``, which is thrown by the
  61. ``decode`` method if the maximum header list size is being violated. This
  62. places the HPACK decoder into a broken state: it must not be used after this
  63. exception is thrown.
  64. This also adds a ``max_header_list_size`` to the ``Decoder`` object. This
  65. controls the maximum allowable decompressed size of the header list. By
  66. default this is set to 64kB.
  67. 2.2.0 (2016-04-20)
  68. ------------------
  69. **API Changes (Backward Compatible)**
  70. - Added ``HeaderTuple`` and ``NeverIndexedHeaderTuple`` classes that signal
  71. whether a given header field may ever be indexed in HTTP/2 header
  72. compression.
  73. - Changed ``Decoder.decode()`` to return the newly added ``HeaderTuple`` class
  74. and subclass. These objects behave like two-tuples, so this change does not
  75. break working code.
  76. **Bugfixes**
  77. - Improve Huffman decoding speed by 4x using an approach borrowed from nghttp2.
  78. - Improve HPACK decoding speed by 10% by caching header table sizes.
  79. 2.1.1 (2016-03-16)
  80. ------------------
  81. **Bugfixes**
  82. - When passing a dictionary or dictionary subclass to ``Encoder.encode``, HPACK
  83. now ensures that HTTP/2 special headers (headers whose names begin with
  84. ``:`` characters) appear first in the header block.
  85. 2.1.0 (2016-02-02)
  86. ------------------
  87. **API Changes (Backward Compatible)**
  88. - Added new ``InvalidTableIndex`` exception, a subclass of
  89. ``HPACKDecodingError``.
  90. - Instead of throwing ``IndexError`` when encountering invalid encoded integers
  91. HPACK now throws ``HPACKDecodingError``.
  92. - Instead of throwing ``UnicodeDecodeError`` when encountering headers that are
  93. not UTF-8 encoded, HPACK now throws ``HPACKDecodingError``.
  94. - Instead of throwing ``IndexError`` when encountering invalid table offsets,
  95. HPACK now throws ``InvalidTableIndex``.
  96. - Added ``raw`` flag to ``decode``, allowing ``decode`` to return bytes instead
  97. of attempting to decode the headers as UTF-8.
  98. **Bugfixes**
  99. - ``memoryview`` objects are now used when decoding HPACK, improving the
  100. performance by avoiding unnecessary data copies.
  101. 2.0.1 (2015-11-09)
  102. ------------------
  103. - Fixed a bug where the Python HPACK implementation would only emit header
  104. table size changes for the total change between one header block and another,
  105. rather than for the entire sequence of changes.
  106. 2.0.0 (2015-10-12)
  107. ------------------
  108. - Remove unused ``HPACKEncodingError``.
  109. - Add the shortcut ability to import the public API (``Encoder``, ``Decoder``,
  110. ``HPACKError``, ``HPACKDecodingError``) directly, rather than from
  111. ``hpack.hpack``.
  112. 1.1.0 (2015-07-07)
  113. ------------------
  114. - Add support for emitting 'never indexed' header fields, by using an optional
  115. third element in the header tuple. With thanks to @jimcarreer!
  116. 1.0.1 (2015-04-19)
  117. ------------------
  118. - Header fields that have names matching header table entries are now added to
  119. the header table. This improves compression efficiency at the cost of
  120. slightly more table operations. With thanks to `Tatsuhiro Tsujikawa`_.
  121. .. _Tatsuhiro Tsujikawa: https://github.com/tatsuhiro-t
  122. 1.0.0 (2015-04-13)
  123. ------------------
  124. - Initial fork of the code from `hyper`_.
  125. .. _hyper: https://hyper.readthedocs.org/