Sync from SUSE:SLFO:Main python-hpack revision 3440a6b5c43fb244e76556e4832c189a

This commit is contained in:
Adrian Schröter 2024-05-03 20:58:03 +02:00
commit cc3862cbcc
6 changed files with 280 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

27
healthcheck.patch Normal file
View File

@ -0,0 +1,27 @@
--- a/test/test_hpack.py
+++ b/test/test_hpack.py
@@ -2,7 +2,7 @@
import itertools
import pytest
-from hypothesis import given
+from hypothesis import given, settings, HealthCheck
from hypothesis.strategies import text, binary, sets, one_of
from hpack import (
@@ -760,6 +760,7 @@ class TestDictToIterable:
binary().filter(lambda k: k and not k.startswith(b':'))
)
+ @settings(suppress_health_check=[HealthCheck.too_slow])
@given(
special_keys=sets(keys),
boring_keys=sets(keys),
@@ -797,6 +798,7 @@ class TestDictToIterable:
assert special_keys == received_special
assert boring_keys == received_boring
+ @settings(suppress_health_check=[HealthCheck.too_slow])
@given(
special_keys=sets(keys),
boring_keys=sets(keys),

BIN
hpack-4.0.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

159
python-hpack.changes Normal file
View File

@ -0,0 +1,159 @@
-------------------------------------------------------------------
Fri Apr 21 12:26:14 UTC 2023 - Dirk Müller <dmueller@suse.com>
- add sle15_python_module_pythons (jsc#PED-68)
-------------------------------------------------------------------
Thu Apr 13 22:41:50 UTC 2023 - Matej Cepl <mcepl@suse.com>
- Make calling of %{sle15modernpython} optional.
-------------------------------------------------------------------
Tue Dec 15 21:36:53 UTC 2020 - Matej Cepl <mcepl@suse.com>
- Upgrade to 4.0.0:
- remove pytest5.patch, which was included in the upstream tarball.
- support for Python < 3.6 (including 2.7) has been removed.
- support for Python 3.8 has been added.
- Performance improvement of static header search. Use dict search
instead of linear search.
- Fix debug output of headers during encoding.
-------------------------------------------------------------------
Wed May 6 07:37:26 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Add patch to work with pytest5:
* pytest5.patch
-------------------------------------------------------------------
Wed Jan 15 13:24:22 UTC 2020 - Ondřej Súkup <mimi.vx@gmail.com>
- add healthcheck.patch to disarm too_slow healthcheck random fails
-------------------------------------------------------------------
Fri Jul 19 09:49:33 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Restrict pytest5 for now
-------------------------------------------------------------------
Wed Jan 2 12:47:37 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Skip one more flaky test
- Update url to point to upstream github
-------------------------------------------------------------------
Tue Dec 4 12:48:55 UTC 2018 - Matej Cepl <mcepl@suse.com>
- Remove superfluous devel dependency for noarch package
-------------------------------------------------------------------
Sat Apr 22 08:11:31 UTC 2017 - aloisio@gmx.com
- Update to version 3.0.0
API Changes (Backward Incompatible):
* Removed nghttp2 support. This support had rotted and was
essentially non-functional, so it has now been removed until
someone has time to re-add the support in a functional form.
* Attempts by the encoder to exceed the maximum allowed header
table size via dynamic table size updates (or the absence
thereof) are now forbidden.
API Changes (Backward Compatible):
* Added a new InvalidTableSizeError thrown when the encoder does
not respect the maximum table size set by the user.
* Added a Decoder.max_allowed_table_size field that sets the
maximum allowed size of the decoder header table. See the
documentation for an indication of how this should be used.
Bugfixes:
* Up to 25% performance improvement decoding HPACK-packed
integers, depending on the platform.
* HPACK now tolerates receiving multiple header table size
changes in sequence, rather than only one.
* HPACK now forbids header table size changes anywhere but first
in a header block, as required by RFC 7541 § 4.2.
* Other miscellaneous performance improvements.
Version 2.3.0
Security Fixes:
* CVE-2016-6581: HPACK Bomb. This release now enforces a maximum
value of the decompressed size of the header list. This is to
avoid the so-called “HPACK Bomb” vulnerability, which is caused
when a malicious peer sends a compressed HPACK body that
decompresses to a gigantic header list size.
This also adds a OversizedHeaderListError, which is thrown by
the decode method if the maximum header list size is being
violated. This places the HPACK decoder into a broken state: it
must not be used after this exception is thrown.
This also adds a max_header_list_size to the Decoder object. This
controls the maximum allowable decompressed size of the header
list. By default this is set to 64kB.
- Converted to single-spec
- Enabled tests
-------------------------------------------------------------------
Mon May 2 12:00:12 UTC 2016 - freitag@owncloud.com
- Fixed messy changelog.
-------------------------------------------------------------------
Mon Apr 25 11:16:50 UTC 2016 - freitag@owncloud.com
- Update to version 2.2.0:
API Changes (Backward Compatible)
* Added HeaderTuple and NeverIndexedHeaderTuple classes that signal
whether a given header field may ever be indexed in HTTP/2 header
compression.
* Changed Decoder.decode() to return the newly added HeaderTuple
class and subclass. These objects behave like two-tuples, so this
change does not break working code.
Bugfixes
* Improve Huffman decoding speed by 4x using an approach borrowed
from nghttp2.
* Improve HPACK decoding speed by 10% by caching header table sizes.
- Bugfixes since 2.1.1:
* When passing a dictionary or dictionary subclass to Encoder.encode,
HPACK now ensures that HTTP/2 special headers (headers whose names
begin with `:` characters) appear first in the header block.
- Changes in 2.1.0 (2016-02-02)
API Changes (Backward Compatible)
* Added new InvalidTableIndex exception, a subclass of
HPACKDecodingError.
* Instead of throwing IndexError when encountering invalid encoded
integers HPACK now throws HPACKDecodingError.
* Instead of throwing UnicodeDecodeError when encountering headers
that are not UTF-8 encoded, HPACK now throws HPACKDecodingError.
* Instead of throwing IndexError when encountering invalid table
offsets, HPACK now throws InvalidTableIndex.
* Added raw flag to decode, allowing decode to return bytes instead
of attempting to decode the headers as UTF-8.
Bugfixes
* memoryview objects are now used when decoding HPACK, improving
the performance by avoiding unnecessary data copies.
-------------------------------------------------------------------
Wed Jan 6 19:43:13 UTC 2016 - freitag@opensuse.org
- Update to version 2.0.1
* Fixed a bug where the Python HPACK implementation would only
emit header table size changes for the total change between one
header block and another, rather than for the entire sequence
of changes.
- Additional changes from version 2.0.0 (2015-10-12)
* Remove unused HPACKEncodingError.
* Add the shortcut ability to import the public API (Encoder,
Decoder, HPACKError, HPACKDecodingError) directly, rather than
from hpack.hpack.
-------------------------------------------------------------------
Tue Aug 25 12:39:56 UTC 2015 - freitag@owncloud.com
- Add forgotten doc files to filelist
-------------------------------------------------------------------
Mon Aug 24 18:33:25 UTC 2015 - freitag@opensuse.org
- Initial package version 1.1.0

65
python-hpack.spec Normal file
View File

@ -0,0 +1,65 @@
#
# spec file for package python-hpack
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%{?sle15_python_module_pythons}
Name: python-hpack
Version: 4.0.0
Release: 0
Summary: Pure-Python HPACK header compression
License: MIT
URL: https://github.com/python-hyper/hpack
Source0: https://files.pythonhosted.org/packages/source/h/hpack/hpack-%{version}.tar.gz
# Content of https://github.com/python-hyper/hpack/tree/master/test/test_fixtures
Source1: test_fixtures.tar.xz
Patch0: healthcheck.patch
BuildRequires: %{python_module hypothesis}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildArch: noarch
%python_subpackages
%description
This module contains a pure-Python HTTP/2 header encoding (HPACK) logic for use in
Python programs that implement HTTP/2. It also contains a compatibility layer that
automatically enables the use of nghttp2 if its available.
%prep
%autosetup -p1 -a1 -n hpack-%{version}
%build
export LC_ALL="en_US.UTF-8"
%python_build
%install
export LC_ALL="en_US.UTF-8"
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%pytest -k "not (test_can_decode_a_story or test_can_decode_a_story_no_huffman or test_can_encode_a_story_with_huffman or test_can_encode_a_story_no_huffman or test_decode_either_succeeds_or_raises_error)"
%files %{python_files}
%license LICENSE
%doc CHANGELOG.rst CONTRIBUTORS.rst README.rst
%{python_sitelib}/hpack
%{python_sitelib}/hpack-%{version}-py%{python_version}.egg-info
%changelog

BIN
test_fixtures.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.