1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:critical reason:network-protocol
4
5#include "http2streams_p.h"
6
7#include "private/qhttp2protocolhandler_p.h"
8#include "private/qhttpnetworkreply_p.h"
9
10#include <QtCore/qdebug.h>
11
12QT_BEGIN_NAMESPACE
13
14namespace Http2
15{
16
17Stream::Stream()
18{
19}
20
21Stream::Stream(const HttpMessagePair &message, quint32 id, qint32 sendSize, qint32 recvSize)
22 : httpPair(message),
23 streamID(id),
24 sendWindow(sendSize),
25 recvWindow(recvSize)
26{
27}
28
29Stream::Stream(const QString &cacheKey, quint32 id, qint32 recvSize)
30 : streamID(id),
31 // sendWindow is 0, this stream only receives data
32 recvWindow(recvSize),
33 state(remoteReserved),
34 key(cacheKey)
35{
36}
37
38QHttpNetworkReply *Stream::reply() const
39{
40 return httpPair.second;
41}
42
43const QHttpNetworkRequest &Stream::request() const
44{
45 return httpPair.first;
46}
47
48QHttpNetworkRequest &Stream::request()
49{
50 return httpPair.first;
51}
52
53QHttpNetworkRequest::Priority Stream::priority() const
54{
55 return httpPair.first.priority();
56}
57
58uchar Stream::weight() const
59{
60 switch (priority()) {
61 case QHttpNetworkRequest::LowPriority:
62 return 0;
63 case QHttpNetworkRequest::NormalPriority:
64 return 127;
65 case QHttpNetworkRequest::HighPriority:
66 default:
67 return 255;
68 }
69}
70
71QNonContiguousByteDevice *Stream::data() const
72{
73 return httpPair.first.uploadByteDevice();
74}
75
76} // namespace Http2
77
78QT_END_NAMESPACE
79

Provided by KDAB

Privacy Policy
Learn Advanced QML with KDAB
Find out more

source code of qtbase/src/network/access/http2/http2streams.cpp