Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
hpack_p.h
Go to the documentation of this file.
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
4#ifndef HPACK_P_H
5#define HPACK_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of other Qt classes. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "hpacktable_p.h"
19
20#include <QtCore/qglobal.h>
21#include <QtCore/qurl.h>
22
23#include <vector>
24#include <optional>
25
27
28class QByteArray;
29
30namespace HPack
31{
32
33using HttpHeader = std::vector<HeaderField>;
35
37{
38public:
39 Encoder(quint32 maxTableSize, bool compressStrings);
40
41 quint32 dynamicTableSize() const;
42
43 bool encodeRequest(class BitOStream &outputStream,
44 const HttpHeader &header);
45 bool encodeResponse(BitOStream &outputStream,
46 const HttpHeader &header);
47
48 bool encodeSizeUpdate(BitOStream &outputStream,
49 quint32 newSize);
50
51 void setMaxDynamicTableSize(quint32 size);
52 void setCompressStrings(bool compress);
53
54private:
55 bool encodeRequestPseudoHeaders(BitOStream &outputStream,
56 const HttpHeader &header);
57 bool encodeHeaderField(BitOStream &outputStream,
58 const HeaderField &field);
59 bool encodeMethod(BitOStream &outputStream,
60 const HeaderField &field);
61
62 bool encodeResponsePseudoHeaders(BitOStream &outputStream,
63 const HttpHeader &header);
64
65 bool encodeIndexedField(BitOStream &outputStream, quint32 index) const;
66
67
68 bool encodeLiteralField(BitOStream &outputStream,
69 const struct BitPattern &fieldType,
70 quint32 nameIndex,
71 const QByteArray &value,
72 bool withCompression);
73
74 bool encodeLiteralField(BitOStream &outputStream,
75 const BitPattern &fieldType,
76 const QByteArray &name,
77 const QByteArray &value,
78 bool withCompression);
79
80 FieldLookupTable lookupTable;
81 bool compressStrings;
82};
83
85{
86public:
87 Decoder(quint32 maxTableSize);
88
89 bool decodeHeaderFields(class BitIStream &inputStream);
90
92 {
93 return header;
94 }
95
96 quint32 dynamicTableSize() const;
97
98 void setMaxDynamicTableSize(quint32 size);
99
100private:
101
102 bool decodeIndexedField(BitIStream &inputStream);
103 bool decodeSizeUpdate(BitIStream &inputStream);
104 bool decodeLiteralField(const BitPattern &fieldType,
105 BitIStream &inputStream);
106
107 bool processDecodedField(const BitPattern &fieldType,
108 const QByteArray &name,
109 const QByteArray &value);
110
111 void handleStreamError(BitIStream &inputStream);
112
114 FieldLookupTable lookupTable;
115};
116
117std::optional<QUrl> makePromiseKeyUrl(const HttpHeader &requestHeader);
118}
119
121
122#endif
123
const HttpHeader & decodedHeader() const
Definition hpack_p.h:91
\inmodule QtCore
Definition qbytearray.h:57
QPair< bool, quint32 > HeaderSize
std::vector< HeaderField > HttpHeader
Definition hpack_p.h:33
HeaderSize header_size(const HttpHeader &header)
Definition hpack.cpp:17
std::optional< QUrl > makePromiseKeyUrl(const HttpHeader &requestHeader)
Definition hpack.cpp:507
Combined button and popup list for selecting options.
static QString header(const QString &name)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint index
[2]
GLuint name
#define Q_AUTOTEST_EXPORT
unsigned int quint32
Definition qtypes.h:50