7#include "private/qhttpnetworkrequest_p.h"
8#include "private/qhttpnetworkreply_p.h"
12#include <QtCore/qbytearray.h>
13#include <QtCore/qstring.h>
30 {0x50, 0x52, 0x49, 0x20, 0x2a, 0x20,
31 0x48, 0x54, 0x54, 0x50, 0x2f, 0x32,
32 0x2e, 0x30, 0x0d, 0x0a, 0x0d, 0x0a,
33 0x53, 0x4d, 0x0d, 0x0a, 0x0d, 0x0a};
40 builder.
append(Settings::ENABLE_PUSH_ID);
45 builder.
append(Settings::INITIAL_WINDOW_SIZE_ID);
50 builder.
append(Settings::MAX_FRAME_SIZE_ID);
64 const char *
src =
reinterpret_cast<const char *
>(
frame.dataBegin());
82 QByteArray value = connectionHeader + separator +
"Upgrade, HTTP2-Settings";
85 request->setHeaderField(
"Upgrade",
"h2c");
97 errorMessage =
"RST_STREAM with unknown error code (%1)"_L1;
104 switch (http2Error) {
127 errorMessage =
"Server received frame(s) on a half-closed stream"_L1;
131 errorMessage =
"Server received a frame with an invalid size"_L1;
144 "header compression context for the connection"_L1;
149 errorMessage =
"The connection established in response "
150 "to a CONNECT request was reset or abnormally closed"_L1;
154 errorMessage =
"Server dislikes our behavior, excessive load detected."_L1;
158 errorMessage =
"The underlying transport has properties "
159 "that do not meet minimum security "
165 "be used instead of HTTP/2."_L1;
187 if (
reply.statusCode() != 101)
201 std::vector<uchar> hpackBlock;
204 for (
const auto &
frame : frames) {
212 hpackBlock.resize(total);
213 auto dst = hpackBlock.begin();
214 for (
const auto &
frame : frames) {
215 if (
const auto hpackBlockSize =
frame.hpackBlockSize()) {
217 std::copy(
src,
src + hpackBlockSize,
dst);
218 dst += hpackBlockSize;
void append(ValueType val)
static QByteArray fromRawData(const char *data, qsizetype size)
Constructs a QByteArray that uses the first size bytes of the data array.
The QHttp2Configuration class controls HTTP/2 parameters and settings.
QVariant header(QNetworkRequest::KnownHeaders header) const
Returns the value of the known header header, if that header was sent by the remote server.
NetworkError
Indicates all possible error conditions found during the processing of the request.
\macro QT_RESTRICTED_CAST_FROM_ASCII
std::vector< uchar > assemble_hpack_block(const std::vector< Frame > &frames)
const char Http2clientPreface[clientPrefaceLength]
bool is_protocol_upgraded(const QHttpNetworkReply &reply)
void appendProtocolUpgradeHeaders(const QHttp2Configuration &config, QHttpNetworkRequest *request)
@ defaultSessionWindowSize
Frame configurationToSettingsFrame(const QHttp2Configuration &config)
QByteArray settingsFrameToBase64(const Frame &frame)
void qt_error(quint32 errorCode, QNetworkReply::NetworkError &error, QString &errorMessage)
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
Q_DECL_COLD_FUNCTION Q_CORE_EXPORT QString qt_error_string(int errorCode=-1)
#define Q_LOGGING_CATEGORY(name,...)
std::enable_if_t< std::is_unsigned_v< T >, bool > qAddOverflow(T v1, T v2, T *r)
GLsizei const GLfloat * v
[13]
GLuint GLsizei const GLchar * message
static QString errorMessage(QUrlPrivate::ErrorCode errorCode, const QString &errorSource, qsizetype errorPosition)
QNetworkRequest request(url)