QHttp2Connection: add take- and clearDownloadBuffer

Instead of retaining the data in the buffer forever.
The downloadBuffer function was only added because there may be data
received before there is a chance to connect to the signal. But then
there is no reason to keep it there forever.

Removing the downloadBuffer() function might be an idea at some point
in preference of using these.

Change-Id: I0b66676c8827570c5a25de2a28617880ccd9cf18
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit ff26a209eaac9a9013a0cc41185a38d448af97e2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Mårten Nordheim 2024-06-13 16:28:14 +02:00 committed by Qt Cherry-pick Bot
parent cb8a8afe42
commit fb79071e16

View File

@ -114,6 +114,8 @@ public:
HPack::HttpHeader receivedHeaders() const noexcept { return m_headers; }
QByteDataBuffer downloadBuffer() const noexcept { return m_downloadBuffer; }
QByteDataBuffer takeDownloadBuffer() noexcept { return std::exchange(m_downloadBuffer, {}); }
void clearDownloadBuffer() { m_downloadBuffer.clear(); }
Q_SIGNALS:
void headersReceived(const HPack::HttpHeader &headers, bool endStream);