Merge tag 'upstream/2.6.1' into upstream
Upstream version 2.6.1
Thomas Goirand
3 years ago
3 | 3 |
py-amqp is fork of amqplib used by Kombu containing additional features and improvements.
|
4 | 4 |
The previous amqplib changelog is here:
|
5 | 5 |
http://code.google.com/p/py-amqplib/source/browse/CHANGES
|
|
6 |
|
|
7 |
.. _version-2.6.0:
|
|
8 |
|
|
9 |
2.6.1
|
|
10 |
=====
|
|
11 |
:release-date: 2020-07-31 10.30 P.M UTC+6:00
|
|
12 |
:release-by: Asif Saif Uddin
|
|
13 |
|
|
14 |
- Fix buffer overflow in frame_writer after frame_max is increased. `frame_writer`
|
|
15 |
allocates a `bytearray` on intialization with a length based on the `connection.frame_max`
|
|
16 |
value. If `connection.frame_max` is changed to a larger value, this causes an
|
|
17 |
error like `pack_into requires a buffer of at least 408736 bytes`.
|
|
18 |
|
6 | 19 |
|
7 | 20 |
.. _version-2.6.0:
|
8 | 21 |
|
0 | 0 |
Metadata-Version: 1.2
|
1 | 1 |
Name: amqp
|
2 | |
Version: 2.6.0
|
|
2 |
Version: 2.6.1
|
3 | 3 |
Summary: Low-level AMQP client for Python (fork of amqplib).
|
4 | 4 |
Home-page: http://github.com/celery/py-amqp
|
5 | 5 |
Author: Barry Pederson
|
|
17 | 17 |
Classifier: Programming Language :: Python :: 3.5
|
18 | 18 |
Classifier: Programming Language :: Python :: 3.6
|
19 | 19 |
Classifier: Programming Language :: Python :: 3.7
|
|
20 |
Classifier: Programming Language :: Python :: 3.8
|
20 | 21 |
Classifier: License :: OSI Approved :: BSD License
|
21 | 22 |
Classifier: Intended Audience :: Developers
|
22 | 23 |
Classifier: Operating System :: OS Independent
|
3 | 3 |
|
4 | 4 |
|build-status| |coverage| |license| |wheel| |pyversion| |pyimp|
|
5 | 5 |
|
6 | |
:Version: 2.6.0
|
|
6 |
:Version: 2.6.1
|
7 | 7 |
:Web: https://amqp.readthedocs.io/
|
8 | 8 |
:Download: https://pypi.org/project/amqp/
|
9 | 9 |
:Source: http://github.com/celery/py-amqp/
|
5 | 5 |
|
6 | 6 |
from collections import namedtuple
|
7 | 7 |
|
8 | |
__version__ = '2.6.0'
|
|
8 |
__version__ = '2.6.1'
|
9 | 9 |
__author__ = 'Barry Pederson'
|
10 | 10 |
__maintainer__ = 'Asif Saif Uddin, Matus Valo'
|
11 | 11 |
__contact__ = 'pyamqp@celeryproject.org'
|
84 | 84 |
return on_frame
|
85 | 85 |
|
86 | 86 |
|
|
87 |
class Buffer(object):
|
|
88 |
def __init__(self, buf):
|
|
89 |
self.buf = buf
|
|
90 |
|
|
91 |
@property
|
|
92 |
def buf(self):
|
|
93 |
return self._buf
|
|
94 |
|
|
95 |
@buf.setter
|
|
96 |
def buf(self, buf):
|
|
97 |
self._buf = buf
|
|
98 |
self.view = memoryview(buf)
|
|
99 |
|
|
100 |
|
87 | 101 |
def frame_writer(connection, transport,
|
88 | 102 |
pack=pack, pack_into=pack_into, range=range, len=len,
|
89 | 103 |
bytes=bytes, str_to_bytes=str_to_bytes, text_t=text_t):
|
90 | 104 |
"""Create closure that writes frames."""
|
91 | 105 |
write = transport.write
|
92 | 106 |
|
93 | |
# memoryview first supported in Python 2.7
|
94 | |
# Initial support was very shaky, so could be we have to
|
95 | |
# check for a bugfix release.
|
96 | |
buf = bytearray(connection.frame_max - 8)
|
97 | |
view = memoryview(buf)
|
|
107 |
buffer_store = Buffer(bytearray(connection.frame_max - 8))
|
98 | 108 |
|
99 | 109 |
def write_frame(type_, channel, method_sig, args, content):
|
100 | 110 |
chunk_size = connection.frame_max - 8
|
|
111 |
# frame_max can be updated via connection._on_tune. If
|
|
112 |
# it became larger, then we need to resize the buffer
|
|
113 |
# to prevent overflow.
|
|
114 |
if chunk_size > len(buffer_store.buf):
|
|
115 |
buffer_store.buf = bytearray(chunk_size)
|
|
116 |
buf = buffer_store.buf
|
|
117 |
view = buffer_store.view
|
101 | 118 |
offset = 0
|
102 | 119 |
properties = None
|
103 | 120 |
args = str_to_bytes(args)
|
0 | 0 |
Metadata-Version: 1.2
|
1 | 1 |
Name: amqp
|
2 | |
Version: 2.6.0
|
|
2 |
Version: 2.6.1
|
3 | 3 |
Summary: Low-level AMQP client for Python (fork of amqplib).
|
4 | 4 |
Home-page: http://github.com/celery/py-amqp
|
5 | 5 |
Author: Barry Pederson
|
|
17 | 17 |
Classifier: Programming Language :: Python :: 3.5
|
18 | 18 |
Classifier: Programming Language :: Python :: 3.6
|
19 | 19 |
Classifier: Programming Language :: Python :: 3.7
|
|
20 |
Classifier: Programming Language :: Python :: 3.8
|
20 | 21 |
Classifier: License :: OSI Approved :: BSD License
|
21 | 22 |
Classifier: Intended Audience :: Developers
|
22 | 23 |
Classifier: Operating System :: OS Independent
|
0 | |
:Version: 2.6.0
|
|
0 |
:Version: 2.6.1
|
1 | 1 |
:Web: https://amqp.readthedocs.io/
|
2 | 2 |
:Download: https://pypi.org/project/amqp/
|
3 | 3 |
:Source: http://github.com/celery/py-amqp/
|
25 | 25 |
Programming Language :: Python :: 3.5
|
26 | 26 |
Programming Language :: Python :: 3.6
|
27 | 27 |
Programming Language :: Python :: 3.7
|
|
28 |
Programming Language :: Python :: 3.8
|
28 | 29 |
License :: OSI Approved :: BSD License
|
29 | 30 |
Intended Audience :: Developers
|
30 | 31 |
Operating System :: OS Independent
|
137 | 137 |
assert isinstance(memory, memoryview)
|
138 | 138 |
assert 'body'.encode('utf-16') in memory.tobytes()
|
139 | 139 |
assert msg.properties['content_encoding'] == 'utf-16'
|
|
140 |
|
|
141 |
def test_frame_max_update(self):
|
|
142 |
msg = Message(body='t' * (self.connection.frame_max + 10))
|
|
143 |
frame = 2, 1, spec.Basic.Publish, b'x' * 10, msg
|
|
144 |
self.connection.frame_max += 100
|
|
145 |
self.g(*frame)
|
|
146 |
self.write.assert_called()
|
|
147 |
memory = self.write.call_args[0][0]
|
|
148 |
assert isinstance(memory, memoryview)
|