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
qhttpnetworkheader.cpp
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
5
6#include <algorithm>
7
9
14
16{
17 bool ok = false;
18 // We are not using the headerField() method here because servers might send us multiple content-length
19 // headers which is crap (see QTBUG-15311). Therefore just take the first content-length header field.
20 QByteArray value = parser.firstHeaderField("content-length");
22 if (ok)
23 return length;
24 return -1; // the header field is not set
25}
26
31
33{
34 QList<QByteArray> allValues = headerFieldValues(name);
35 if (allValues.isEmpty())
36 return defaultValue;
37 else
38 return allValues.join(", ");
39}
40
45
50
55
60
65
67{
68 return (url == other.url);
69}
70
71
\inmodule QtCore
Definition qbytearray.h:57
qulonglong toULongLong(bool *ok=nullptr, int base=10) const
Returns the byte array converted to an {unsigned long long} using base base, which is ten by default.
static QByteArray number(int, int base=10)
Returns a byte-array representing the whole number n as text.
const QHttpHeaders & headers() const
QList< QByteArray > headerFieldValues(QByteArrayView name) const
void setHeaderField(const QByteArray &name, const QByteArray &data)
QByteArray firstHeaderField(QByteArrayView name, const QByteArray &defaultValue=QByteArray()) const
void prependHeaderField(const QByteArray &name, const QByteArray &data)
QList< QByteArray > headerFieldValues(QByteArrayView name) const
QHttpNetworkHeaderPrivate(const QUrl &newUrl=QUrl())
QByteArray headerField(QByteArrayView name, const QByteArray &defaultValue=QByteArray()) const
bool operator==(const QHttpNetworkHeaderPrivate &other) const
void setHeaderField(const QByteArray &name, const QByteArray &data)
void setContentLength(qint64 length)
void prependHeaderField(const QByteArray &name, const QByteArray &data)
\inmodule QtCore
Definition qurl.h:94
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLenum GLuint GLenum GLsizei length
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLuint name
long long qint64
Definition qtypes.h:60
QUrl url("example.com")
[constructor-url-reference]
QSharedPointer< T > other(t)
[5]