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
qnetworkrequest.cpp File Reference

(0fef8f53c3e52dd31648c55a2376006f223a7054)

#include "qnetworkrequest.h"
#include "qnetworkrequest_p.h"
#include "qplatformdefs.h"
#include "qnetworkcookie.h"
#include "qsslconfiguration.h"
#include "qhttpheadershelper_p.h"
#include "QtCore/qdatetime.h"
#include "QtCore/qlocale.h"
#include "QtCore/qshareddata.h"
#include "QtCore/qtimezone.h"
#include "QtCore/private/qduplicatetracker_p.h"
#include "QtCore/private/qtools_p.h"
#include <ctype.h>
#include <algorithm>
#include <q20algorithm.h>
#include "moc_qnetworkrequest.cpp"
+ Include dependency graph for qnetworkrequest.cpp:

Go to the source code of this file.

Classes

class  QNetworkRequestPrivate
 \variable QNetworkRequest::DefaultTransferTimeout More...
 

Functions

static std::optional< QNetworkRequest::KnownHeaderstoKnownHeader (QHttpHeaders::WellKnownHeader key)
 
static std::optional< QHttpHeaders::WellKnownHeadertoWellKnownHeader (QNetworkRequest::KnownHeaders key)
 
static QByteArray makeCookieHeader (const QList< QNetworkCookie > &cookies, QNetworkCookie::RawForm type, QByteArrayView separator)
 
static QByteArray makeCookieHeader (const QVariant &value, QNetworkCookie::RawForm type, QByteArrayView separator)
 
static QByteArray headerValue (QNetworkRequest::KnownHeaders header, const QVariant &value)
 
static int parseHeaderName (QByteArrayView headerName)
 
static QVariant parseHttpDate (QByteArrayView raw)
 
static QList< QNetworkCookieparseCookieHeader (QByteArrayView raw)
 
static QVariant parseETag (QByteArrayView raw)
 
template<typename T >
static QStringList parseMatchImpl (QByteArrayView raw, T op)
 
static QStringList parseIfMatch (QByteArrayView raw)
 
static QStringList parseIfNoneMatch (QByteArrayView raw)
 
static QVariant parseHeaderValue (QNetworkRequest::KnownHeaders header, QByteArrayView value)
 
static QVariant parseHeaderValue (QNetworkRequest::KnownHeaders header, QList< QByteArray > values)
 
static bool isSetCookie (QByteArrayView name)
 
static bool isSetCookie (QHttpHeaders::WellKnownHeader name)
 
template<class HeaderName >
static void setFromRawHeader (QHttpHeaders &headers, HeaderName header, QByteArrayView value)
 
static int name_to_month (const char *month_str)
 

Variables

static constexpr HeaderPair knownHeadersArr []
 

Function Documentation

◆ headerValue()

◆ isSetCookie() [1/2]

static bool isSetCookie ( QByteArrayView name)
static

Definition at line 1418 of file qnetworkrequest.cpp.

References Qt::CaseInsensitive, QHttpHeaders::SetCookie, and QHttpHeaders::wellKnownHeaderName().

Referenced by QNetworkHeadersPrivate::fromHttpToRaw(), QNetworkHeadersPrivate::fromRawToHttp(), and setFromRawHeader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSetCookie() [2/2]

static bool isSetCookie ( QHttpHeaders::WellKnownHeader name)
static

Definition at line 1424 of file qnetworkrequest.cpp.

References QHttpHeaders::SetCookie.

◆ makeCookieHeader() [1/2]

static QByteArray makeCookieHeader ( const QList< QNetworkCookie > & cookies,
QNetworkCookie::RawForm type,
QByteArrayView separator )
static

Definition at line 1141 of file qnetworkrequest.cpp.

References QByteArrayView::chop(), and QByteArrayView::size().

Referenced by QNetworkHeadersPrivate::fromCookieList(), headerValue(), and makeCookieHeader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ makeCookieHeader() [2/2]

static QByteArray makeCookieHeader ( const QVariant & value,
QNetworkCookie::RawForm type,
QByteArrayView separator )
static

Definition at line 1155 of file qnetworkrequest.cpp.

References makeCookieHeader().

+ Here is the call graph for this function:

◆ name_to_month()

static int name_to_month ( const char * month_str)
static

Definition at line 1604 of file qnetworkrequest.cpp.

Referenced by QNetworkHeadersPrivate::fromHttpDate().

+ Here is the caller graph for this function:

◆ parseCookieHeader()

static QList< QNetworkCookie > parseCookieHeader ( QByteArrayView raw)
static

Definition at line 1276 of file qnetworkrequest.cpp.

References QNetworkCookie::parseCookies(), and QLatin1StringView::tokenize().

Referenced by parseHeaderValue(), and QNetworkHeadersPrivate::toCookieList().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseETag()

static QVariant parseETag ( QByteArrayView raw)
static

Definition at line 1290 of file qnetworkrequest.cpp.

References QString::fromLatin1().

Referenced by parseHeaderValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseHeaderName()

◆ parseHeaderValue() [1/2]

◆ parseHeaderValue() [2/2]

static QVariant parseHeaderValue ( QNetworkRequest::KnownHeaders header,
QList< QByteArray > values )
static

Definition at line 1383 of file qnetworkrequest.cpp.

References QNetworkRequest::CookieHeader, QVariant::fromValue(), header(), QNetworkRequest::IfMatchHeader, QNetworkRequest::IfNoneMatchHeader, QNetworkCookie::parseCookies(), parseHeaderValue(), parseIfMatch(), parseIfNoneMatch(), QNetworkRequest::SetCookieHeader, and QNetworkHeadersPrivate::toCookieList().

+ Here is the call graph for this function:

◆ parseHttpDate()

static QVariant parseHttpDate ( QByteArrayView raw)
static

Definition at line 1268 of file qnetworkrequest.cpp.

References QNetworkHeadersPrivate::fromHttpDate().

Referenced by parseHeaderValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseIfMatch()

static QStringList parseIfMatch ( QByteArrayView raw)
static

Definition at line 1318 of file qnetworkrequest.cpp.

References QByteArrayView::endsWith(), parseMatchImpl(), and QByteArrayView::startsWith().

Referenced by parseHeaderValue(), and parseHeaderValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseIfNoneMatch()

static QStringList parseIfNoneMatch ( QByteArrayView raw)
static

Definition at line 1325 of file qnetworkrequest.cpp.

References QByteArrayView::endsWith(), parseMatchImpl(), and QByteArrayView::startsWith().

Referenced by parseHeaderValue(), and parseHeaderValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseMatchImpl()

template<typename T >
static QStringList parseMatchImpl ( QByteArrayView raw,
T op )
static

Definition at line 1303 of file qnetworkrequest.cpp.

References QString::fromLatin1(), QStringLiteral, QLatin1StringView::tokenize(), and QByteArrayView::trimmed().

Referenced by parseIfMatch(), and parseIfNoneMatch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setFromRawHeader()

template<class HeaderName >
static void setFromRawHeader ( QHttpHeaders & headers,
HeaderName header,
QByteArrayView value )
static

Definition at line 1430 of file qnetworkrequest.cpp.

References QHttpHeaders::append(), header(), isSetCookie(), QHttpHeaders::removeAll(), QHttpHeaders::SetCookie, and QLatin1StringView::tokenize().

Referenced by QNetworkHeadersPrivate::setCookedHeader(), and QNetworkHeadersPrivate::setRawHeader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toKnownHeader()

static std::optional< QNetworkRequest::KnownHeaders > toKnownHeader ( QHttpHeaders::WellKnownHeader key)
static

Definition at line 1124 of file qnetworkrequest.cpp.

References it, and knownHeadersArr.

Referenced by QNetworkHeadersPrivate::setHeader().

+ Here is the caller graph for this function:

◆ toWellKnownHeader()

static std::optional< QHttpHeaders::WellKnownHeader > toWellKnownHeader ( QNetworkRequest::KnownHeaders key)
static

Definition at line 1132 of file qnetworkrequest.cpp.

References it, and knownHeadersArr.

Referenced by QNetworkHeadersPrivate::setCookedHeader().

+ Here is the caller graph for this function:

Variable Documentation

◆ knownHeadersArr

constexpr HeaderPair knownHeadersArr[]
staticconstexpr
Initial value:
= {
}

Definition at line 1105 of file qnetworkrequest.cpp.

Referenced by toKnownHeader(), and toWellKnownHeader().