6#include "qplatformdefs.h"
12#include "private/http2protocol_p.h"
15#include "QtCore/qdatetime.h"
16#include "QtCore/qlocale.h"
17#include "QtCore/qshareddata.h"
18#include "QtCore/qtimezone.h"
19#include "QtCore/private/qtools_p.h"
22#if QT_CONFIG(datestring)
415 static const int maxRedirectCount = 50;
421 , maxRedirectsAllowed(maxRedirectCount)
423 { qRegisterMetaType<QNetworkRequest>(); }
427 delete sslConfiguration;
436 priority =
other.priority;
437 maxRedirectsAllowed =
other.maxRedirectsAllowed;
439 sslConfiguration =
nullptr;
440 if (
other.sslConfiguration)
443 peerVerifyName =
other.peerVerifyName;
445 h1Configuration =
other.h1Configuration;
446 h2Configuration =
other.h2Configuration;
447 decompressedSafetyCheckThreshold =
other.decompressedSafetyCheckThreshold;
449 transferTimeout =
other.transferTimeout;
455 priority ==
other.priority &&
456 rawHeaders ==
other.rawHeaders &&
457 attributes ==
other.attributes &&
458 maxRedirectsAllowed ==
other.maxRedirectsAllowed &&
459 peerVerifyName ==
other.peerVerifyName
461 && h1Configuration ==
other.h1Configuration
462 && h2Configuration ==
other.h2Configuration
463 && decompressedSafetyCheckThreshold ==
other.decompressedSafetyCheckThreshold
465 && transferTimeout ==
other.transferTimeout
480 qint64 decompressedSafetyCheckThreshold = 10ll * 1024ll * 1024ll;
502 d->h2Configuration.setServerPushEnabled(
false);
873 return d->h1Configuration;
884 d->h1Configuration = configuration;
910 return d->h2Configuration;
928 d->h2Configuration = configuration;
941qint64 QNetworkRequest::decompressedSafetyCheckThreshold()
const
943 return d->decompressedSafetyCheckThreshold;
968void QNetworkRequest::setDecompressedSafetyCheckThreshold(
qint64 threshold)
970 d->decompressedSafetyCheckThreshold = threshold;
974#if QT_CONFIG(http) || defined (Q_OS_WASM)
985int QNetworkRequest::transferTimeout()
const
1004void QNetworkRequest::setTransferTimeout(
int timeout)
1014 return "Content-Type";
1017 return "Content-Length";
1023 return "Last-Modified";
1026 return "If-Modified-Since";
1035 return "If-None-Match";
1041 return "Set-Cookie";
1044 return "Content-Disposition";
1047 return "User-Agent";
1070 return value.toByteArray();
1073 switch (
value.userType()) {
1074 case QMetaType::QUrl:
1075 return value.toUrl().toEncoded();
1078 return value.toByteArray();
1083 switch (
value.userType()) {
1085 case QMetaType::QDate:
1087 case QMetaType::QDateTime:
1091 return value.toByteArray();
1096 if (cookies.
isEmpty() &&
value.userType() == qMetaTypeId<QNetworkCookie>())
1097 cookies << qvariant_cast<QNetworkCookie>(
value);
1112 if (cookies.
isEmpty() &&
value.userType() == qMetaTypeId<QNetworkCookie>())
1113 cookies << qvariant_cast<QNetworkCookie>(
value);
1135 auto is = [&](
const char *what) {
1141 if (is(
"content-type"))
1143 else if (is(
"content-length"))
1145 else if (is(
"cookie"))
1147 else if (is(
"content-disposition"))
1157 if (is(
"if-modified-since"))
1161 if (is(
"if-none-match"))
1168 else if (is(
"last-modified"))
1173 if (is(
"set-cookie"))
1175 else if (is(
"server"))
1180 if (is(
"user-agent"))
1200 for (
const QByteArray &cookie : cookieList) {
1202 if (parsed.
size() != 1)
1226 if (trimmedRaw ==
"*")
1247 if (trimmedRaw ==
"*")
1372 parseAndSetHeader(
it->first,
it->second);
1379 if (
name.isEmpty()) {
1381 qWarning(
"QNetworkRequest::setHeader: invalid header value KnownHeader(%d) received",
header);
1385 if (
value.isNull()) {
1391 qWarning(
"QNetworkRequest::setHeader: QVariant of type %s cannot be used with header %s",
1396 setRawHeaderInternal(
name, rawValue);
1413 pair.second =
value;
1421 if (parsedKeyAsInt != -1) {
1424 if (
value.isNull()) {
1442 switch (month_str[0]) {
1444 switch (month_str[1]) {
1448 switch (month_str[2] ) {
1459 switch (month_str[2] ) {
1467 switch (month_str[1]) {
1497#if QT_CONFIG(datestring)
1506 int day, year, hour, minute, second;
1509 if (sscanf_s(
value.constData(),
"%*3s, %d %3s %d %d:%d:%d 'GMT'", &day, month_name, 4, &year, &hour, &minute, &second) == 6)
1513 if (sscanf(
value.constData(),
"%*3s, %d %3s %d %d:%d:%d 'GMT'", &day, month_name, &year, &hour, &minute, &second) == 6)
1521 dt =
c.toDateTime(sansWeekday,
"dd-MMM-yy hh:mm:ss 'GMT'"_L1);
bool startsWith(QByteArrayView other) const noexcept
bool endsWith(QByteArrayView other) const noexcept
QByteArrayView trimmed() const noexcept
QByteArray trimmed() const &
char * data()
\macro QT_NO_CAST_FROM_BYTEARRAY
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
QList< QByteArray > split(char sep) const
Splits the byte array into subarrays wherever sep occurs, and returns the list of those arrays.
bool isEmpty() const noexcept
Returns true if the byte array has size 0; otherwise returns false.
\inmodule QtCore\reentrant
QDateTime toUTC() const
Returns a copy of this datetime converted to UTC.
bool isValid() const
Returns true if this datetime represents a definite moment, otherwise false.
void setTimeZone(const QTimeZone &toZone)
\inmodule QtCore \reentrant
bool remove(const Key &key)
Removes the item that has the key from the hash.
bool contains(const Key &key) const noexcept
Returns true if the hash contains an item with the key; otherwise returns false.
T value(const Key &key) const noexcept
void clear() noexcept(std::is_nothrow_destructible< Node >::value)
Removes all items from the hash and frees up all memory used by it.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
The QHttp1Configuration class controls HTTP/1 parameters and settings.
The QHttp2Configuration class controls HTTP/2 parameters and settings.
qsizetype size() const noexcept
bool isEmpty() const noexcept
const_iterator constBegin() const noexcept
qsizetype removeIf(Predicate pred)
void append(parameter_type t)
const_iterator constEnd() const noexcept
const_iterator ConstIterator
static QLocale c()
Returns a QLocale object initialized to the "C" locale.
QString toString(qlonglong i) const
Returns a localized string representation of i.
The QNetworkCookie class holds one network cookie.
static QList< QNetworkCookie > parseCookies(const QByteArray &cookieString)
Parses the cookie string cookieString as received from a server response in the "Set-Cookie:" header.
~QNetworkRequestPrivate()
QSslConfiguration * sslConfiguration
bool operator==(const QNetworkRequestPrivate &other) const
QNetworkRequest::Priority priority
QNetworkRequestPrivate(const QNetworkRequestPrivate &other)
The QNetworkRequest class holds a request to be sent with QNetworkAccessManager.
bool operator==(const QNetworkRequest &other) const
Returns true if this object is the same as other (i.e., if they have the same URL,...
void setOriginatingObject(QObject *object)
KnownHeaders
List of known header types that QNetworkRequest parses.
@ ContentDispositionHeader
void setSslConfiguration(const QSslConfiguration &configuration)
Sets this network request's SSL configuration to be config.
~QNetworkRequest()
Disposes of the QNetworkRequest object.
void setHeader(KnownHeaders header, const QVariant &value)
Sets the value of the known header header to be value, overriding any previously set headers.
void setAttribute(Attribute code, const QVariant &value)
Sets the attribute associated with code code to be value value.
Priority priority() const
QVariant attribute(Attribute code, const QVariant &defaultValue=QVariant()) const
Returns the attribute associated with the code code.
QVariant header(KnownHeaders header) const
Returns the value of the known network header header if it is present in this request.
void setRawHeader(const QByteArray &headerName, const QByteArray &value)
Sets the header headerName to be of value headerValue.
QNetworkRequest()
Constructs a QNetworkRequest object with no URL to be requested.
QObject * originatingObject() const
int maximumRedirectsAllowed() const
QList< QByteArray > rawHeaderList() const
Returns a list of all raw headers that are set in this network request.
QNetworkRequest & operator=(QNetworkRequest &&other) noexcept
void setPeerVerifyName(const QString &peerName)
bool hasRawHeader(const QByteArray &headerName) const
Returns true if the raw header headerName is present in this network request.
void setMaximumRedirectsAllowed(int maximumRedirectsAllowed)
void setUrl(const QUrl &url)
Sets the URL this network request is referring to be url.
QUrl url() const
Returns the URL this network request is referring to.
void setPriority(Priority priority)
QString peerVerifyName() const
QByteArray rawHeader(const QByteArray &headerName) const
Returns the raw form of header headerName.
QSslConfiguration sslConfiguration() const
Returns this network request's SSL configuration.
The QSslConfiguration class holds the configuration and state of an SSL connection.
static QSslConfiguration defaultConfiguration()
Returns the default SSL configuration to be used in new SSL connections.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QByteArray toLatin1() const &
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString first(qsizetype n) const
int compare(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
\inmodule QtCore \reentrant
static QUrl fromEncoded(QByteArrayView input, ParsingMode mode=TolerantMode)
Parses input and returns the corresponding QUrl.
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
QSet< QString >::iterator it
const qint32 qtDefaultStreamReceiveWindowSize
const qint32 maxSessionReceiveWindowSize((quint32(1)<< 31) - 1)
Combined button and popup list for selecting options.
constexpr char toAsciiLower(char ch) noexcept
int qstrnicmp(const char *str1, qsizetype len1, const char *str2, qsizetype len2)
static QString header(const QString &name)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
static int parseHeaderName(const QByteArray &headerName)
static int name_to_month(const char *month_str)
static QVariant parseETag(const QByteArray &raw)
static QVariant parseHttpDate(const QByteArray &raw)
static QVariant parseCookieHeader(const QByteArray &raw)
static QVariant parseIfNoneMatch(const QByteArray &raw)
static QByteArray headerValue(QNetworkRequest::KnownHeaders header, const QVariant &value)
static QVariant parseHeaderValue(QNetworkRequest::KnownHeaders header, const QByteArray &value)
static QByteArray headerName(QNetworkRequest::KnownHeaders header)
static int parseHeaderName(const QByteArray &headerName)
static QVariant parseIfMatch(const QByteArray &raw)
GLbitfield GLuint64 timeout
[4]
static void split(QT_FT_Vector *b)
#define QStringLiteral(str)
QUrl url("example.com")
[constructor-url-reference]