diff --git a/src/network/access/qhttpheaders.cpp b/src/network/access/qhttpheaders.cpp index 06f6368b7f5..65e456b945f 100644 --- a/src/network/access/qhttpheaders.cpp +++ b/src/network/access/qhttpheaders.cpp @@ -69,41 +69,6 @@ Q_LOGGING_CATEGORY(lcQHttpHeaders, "qt.network.http.headers"); the values. */ -// A clarification on case-sensitivity: -// - Header *names* are case-insensitive; Content-Type and content-type are considered equal -// - Header *values* are case-sensitive -// (In addition, the HTTP/2 and HTTP/3 standards mandate that all headers must be lower-cased when -// encoded into transmission) -struct Header { - QByteArray name; - QByteArray value; - -private: - friend bool operator==(const Header &lhs, const Header &rhs) noexcept - { - return lhs.value == rhs.value && lhs.name == rhs.name; - } -}; - -class QHttpHeadersPrivate : public QSharedData -{ -public: - QHttpHeadersPrivate() = default; - - QList
headers; -}; - -QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QHttpHeadersPrivate) -template <> void QExplicitlySharedDataPointer::detach() -{ - if (!d) { - d = new QHttpHeadersPrivate(); - d->ref.ref(); - } else if (d->ref.loadRelaxed() != 1) { - detach_helper(); - } -} - // This list is from IANA HTTP Field Name Registry // https://www.iana.org/assignments/http-fields // It contains entries that are either "permanent" @@ -478,6 +443,41 @@ static constexpr auto headerNames = qOffsetStringArray( \value ProtocolQuery */ +// A clarification on case-sensitivity: +// - Header *names* are case-insensitive; Content-Type and content-type are considered equal +// - Header *values* are case-sensitive +// (In addition, the HTTP/2 and HTTP/3 standards mandate that all headers must be lower-cased when +// encoded into transmission) +struct Header { + QByteArray name; + QByteArray value; + +private: + friend bool operator==(const Header &lhs, const Header &rhs) noexcept + { + return lhs.value == rhs.value && lhs.name == rhs.name; + } +}; + +class QHttpHeadersPrivate : public QSharedData +{ +public: + QHttpHeadersPrivate() = default; + + QList
headers; +}; + +QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QHttpHeadersPrivate) +template <> void QExplicitlySharedDataPointer::detach() +{ + if (!d) { + d = new QHttpHeadersPrivate(); + d->ref.ref(); + } else if (d->ref.loadRelaxed() != 1) { + detach_helper(); + } +} + /*! Creates a new QHttpHeaders object. */