Qt 4.8
qnetworkrequest.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtNetwork module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include "qplatformdefs.h"
43 #include "qnetworkrequest.h"
44 #include "qnetworkcookie.h"
45 #include "qnetworkrequest_p.h"
46 #include "qsslconfiguration.h"
47 #include "QtCore/qshareddata.h"
48 #include "QtCore/qlocale.h"
49 #include "QtCore/qdatetime.h"
50 
51 #include <ctype.h>
52 #ifndef QT_NO_DATESTRING
53 # include <stdio.h>
54 #endif
55 
57 
291 {
292 public:
294  : priority(QNetworkRequest::NormalPriority)
295 #ifndef QT_NO_OPENSSL
296  , sslConfiguration(0)
297 #endif
298  { qRegisterMetaType<QNetworkRequest>(); }
300  {
301 #ifndef QT_NO_OPENSSL
302  delete sslConfiguration;
303 #endif
304  }
305 
306 
308  : QSharedData(other), QNetworkHeadersPrivate(other)
309  {
310  url = other.url;
311  priority = other.priority;
312 
313 #ifndef QT_NO_OPENSSL
314  sslConfiguration = 0;
315  if (other.sslConfiguration)
317 #endif
318  }
319 
320  inline bool operator==(const QNetworkRequestPrivate &other) const
321  {
322  return url == other.url &&
323  priority == other.priority &&
324  rawHeaders == other.rawHeaders &&
325  attributes == other.attributes;
326  // don't compare cookedHeaders
327  }
328 
331 #ifndef QT_NO_OPENSSL
333 #endif
334 };
335 
344 {
345  d->url = url;
346 }
347 
352  : d(other.d)
353 {
354 }
355 
360 {
361  // QSharedDataPointer auto deletes
362  d = 0;
363 }
364 
372 {
373  return d == other.d || *d == *other.d;
374 }
375 
391 {
392  d = other.d;
393  return *this;
394 }
395 
402 {
403  return d->url;
404 }
405 
412 {
413  d->url = url;
414 }
415 
424 {
425  return d->cookedHeaders.value(header);
426 }
427 
436 {
437  d->setCookedHeader(header, value);
438 }
439 
447 {
448  return d->findRawHeader(headerName) != d->rawHeaders.constEnd();
449 }
450 
462 {
464  d->findRawHeader(headerName);
465  if (it != d->rawHeaders.constEnd())
466  return it->second;
467  return QByteArray();
468 }
469 
477 {
478  return d->rawHeadersKeys();
479 }
480 
501 {
502  d->setRawHeader(headerName, headerValue);
503 }
504 
514 QVariant QNetworkRequest::attribute(Attribute code, const QVariant &defaultValue) const
515 {
516  return d->attributes.value(code, defaultValue);
517 }
518 
528 {
529  if (value.isValid())
530  d->attributes.insert(code, value);
531  else
532  d->attributes.remove(code);
533 }
534 
535 #ifndef QT_NO_OPENSSL
536 
543 {
544  if (!d->sslConfiguration)
546  return *d->sslConfiguration;
547 }
548 
562 {
563  if (!d->sslConfiguration)
564  d->sslConfiguration = new QSslConfiguration(config);
565  else
566  *d->sslConfiguration = config;
567 }
568 #endif
569 
585 {
586  d->originatingObject = object;
587 }
588 
602 {
603  return d->originatingObject.data();
604 }
605 
617 {
618  return d->priority;
619 }
620 
650 {
651  d->priority = priority;
652 }
653 
655 {
656  switch (header) {
658  return "Content-Type";
659 
661  return "Content-Length";
662 
664  return "Location";
665 
667  return "Last-Modified";
668 
670  return "Cookie";
671 
673  return "Set-Cookie";
674 
676  return "Content-Disposition";
677 
678  // no default:
679  // if new values are added, this will generate a compiler warning
680  }
681 
682  return QByteArray();
683 }
684 
686 {
687  switch (header) {
691  return value.toByteArray();
692 
694  switch (value.type()) {
695  case QVariant::Url:
696  return value.toUrl().toEncoded();
697 
698  default:
699  return value.toByteArray();
700  }
701 
703  switch (value.type()) {
704  case QVariant::Date:
705  case QVariant::DateTime:
706  // generate RFC 1123/822 dates:
708 
709  default:
710  return value.toByteArray();
711  }
712 
715  if (cookies.isEmpty() && value.userType() == qMetaTypeId<QNetworkCookie>())
716  cookies << qvariant_cast<QNetworkCookie>(value);
717 
718  QByteArray result;
719  bool first = true;
720  foreach (const QNetworkCookie &cookie, cookies) {
721  if (!first)
722  result += "; ";
723  first = false;
725  }
726  return result;
727  }
728 
731  if (cookies.isEmpty() && value.userType() == qMetaTypeId<QNetworkCookie>())
732  cookies << qvariant_cast<QNetworkCookie>(value);
733 
734  QByteArray result;
735  bool first = true;
736  foreach (const QNetworkCookie &cookie, cookies) {
737  if (!first)
738  result += ", ";
739  first = false;
740  result += cookie.toRawForm(QNetworkCookie::Full);
741  }
742  return result;
743  }
744  }
745 
746  return QByteArray();
747 }
748 
750 {
751  if (headerName.isEmpty())
753 
754  switch (tolower(headerName.at(0))) {
755  case 'c':
756  if (qstricmp(headerName.constData(), "content-type") == 0)
758  else if (qstricmp(headerName.constData(), "content-length") == 0)
760  else if (qstricmp(headerName.constData(), "cookie") == 0)
762  break;
763 
764  case 'l':
765  if (qstricmp(headerName.constData(), "location") == 0)
767  else if (qstricmp(headerName.constData(), "last-modified") == 0)
769  break;
770 
771  case 's':
772  if (qstricmp(headerName.constData(), "set-cookie") == 0)
774  break;
775  }
776 
777  return QNetworkRequest::KnownHeaders(-1); // nothing found
778 }
779 
781 {
783  if (dt.isValid())
784  return dt;
785  return QVariant(); // transform an invalid QDateTime into a null QVariant
786 }
787 
789 {
790  QList<QNetworkCookie> result;
791  QList<QByteArray> cookieList = raw.split(';');
792  foreach (const QByteArray &cookie, cookieList) {
794  if (parsed.count() != 1)
795  return QVariant(); // invalid Cookie: header
796 
797  result += parsed;
798  }
799 
800  return QVariant::fromValue(result);
801 }
802 
804 {
805  // header is always a valid value
806  switch (header) {
808  // copy exactly, convert to QString
809  return QString::fromLatin1(value);
810 
812  bool ok;
813  qint64 result = value.trimmed().toLongLong(&ok);
814  if (ok)
815  return result;
816  return QVariant();
817  }
818 
820  QUrl result = QUrl::fromEncoded(value, QUrl::StrictMode);
821  if (result.isValid() && !result.scheme().isEmpty())
822  return result;
823  return QVariant();
824  }
825 
827  return parseHttpDate(value);
828 
830  return parseCookieHeader(value);
831 
834 
835  default:
836  Q_ASSERT(0);
837  }
838  return QVariant();
839 }
840 
843 {
844  RawHeadersList::ConstIterator it = rawHeaders.constBegin();
845  RawHeadersList::ConstIterator end = rawHeaders.constEnd();
846  for ( ; it != end; ++it)
847  if (qstricmp(it->first.constData(), key.constData()) == 0)
848  return it;
849 
850  return end; // not found
851 }
852 
854 {
855  return rawHeaders;
856 }
857 
859 {
860  QList<QByteArray> result;
861  RawHeadersList::ConstIterator it = rawHeaders.constBegin(),
862  end = rawHeaders.constEnd();
863  for ( ; it != end; ++it)
864  result << it->first;
865 
866  return result;
867 }
868 
870 {
871  if (key.isEmpty())
872  // refuse to accept an empty raw header
873  return;
874 
875  setRawHeaderInternal(key, value);
876  parseAndSetHeader(key, value);
877 }
878 
891 {
892  cookedHeaders.clear();
893  rawHeaders = list;
894 
895  RawHeadersList::ConstIterator it = rawHeaders.constBegin();
896  RawHeadersList::ConstIterator end = rawHeaders.constEnd();
897  for ( ; it != end; ++it)
898  parseAndSetHeader(it->first, it->second);
899 }
900 
902  const QVariant &value)
903 {
904  QByteArray name = headerName(header);
905  if (name.isEmpty()) {
906  // headerName verifies that \a header is a known value
907  qWarning("QNetworkRequest::setHeader: invalid header value KnownHeader(%d) received", header);
908  return;
909  }
910 
911  if (value.isNull()) {
912  setRawHeaderInternal(name, QByteArray());
913  cookedHeaders.remove(header);
914  } else {
915  QByteArray rawValue = headerValue(header, value);
916  if (rawValue.isEmpty()) {
917  qWarning("QNetworkRequest::setHeader: QVariant of type %s cannot be used with header %s",
918  value.typeName(), name.constData());
919  return;
920  }
921 
922  setRawHeaderInternal(name, rawValue);
923  cookedHeaders.insert(header, value);
924  }
925 }
926 
928 {
929  RawHeadersList::Iterator it = rawHeaders.begin();
930  while (it != rawHeaders.end()) {
931  if (qstricmp(it->first.constData(), key.constData()) == 0)
932  it = rawHeaders.erase(it);
933  else
934  ++it;
935  }
936 
937  if (value.isNull())
938  return; // only wanted to erase key
939 
940  RawHeaderPair pair;
941  pair.first = key;
942  pair.second = value;
943  rawHeaders.append(pair);
944 }
945 
947 {
948  // is it a known header?
950  if (parsedKey != QNetworkRequest::KnownHeaders(-1)) {
951  if (value.isNull()) {
952  cookedHeaders.remove(parsedKey);
953  } else if (parsedKey == QNetworkRequest::ContentLengthHeader
954  && cookedHeaders.contains(QNetworkRequest::ContentLengthHeader)) {
955  // Only set the cooked header "Content-Length" once.
956  // See bug QTBUG-15311
957  } else {
958  cookedHeaders.insert(parsedKey, parseHeaderValue(parsedKey, value));
959  }
960 
961  }
962 }
963 
964 // Fast month string to int conversion. This code
965 // assumes that the Month name is correct and that
966 // the string is at least three chars long.
967 static int name_to_month(const char* month_str)
968 {
969  switch (month_str[0]) {
970  case 'J':
971  switch (month_str[1]) {
972  case 'a':
973  return 1;
974  break;
975  case 'u':
976  switch (month_str[2] ) {
977  case 'n':
978  return 6;
979  break;
980  case 'l':
981  return 7;
982  break;
983  }
984  }
985  break;
986  case 'F':
987  return 2;
988  break;
989  case 'M':
990  switch (month_str[2] ) {
991  case 'r':
992  return 3;
993  break;
994  case 'y':
995  return 5;
996  break;
997  }
998  break;
999  case 'A':
1000  switch (month_str[1]) {
1001  case 'p':
1002  return 4;
1003  break;
1004  case 'u':
1005  return 8;
1006  break;
1007  }
1008  break;
1009  case 'O':
1010  return 10;
1011  break;
1012  case 'S':
1013  return 9;
1014  break;
1015  case 'N':
1016  return 11;
1017  break;
1018  case 'D':
1019  return 12;
1020  break;
1021  }
1022 
1023  return 0;
1024 }
1025 
1027 {
1028  // HTTP dates have three possible formats:
1029  // RFC 1123/822 - ddd, dd MMM yyyy hh:mm:ss "GMT"
1030  // RFC 850 - dddd, dd-MMM-yy hh:mm:ss "GMT"
1031  // ANSI C's asctime - ddd MMM d hh:mm:ss yyyy
1032  // We only handle them exactly. If they deviate, we bail out.
1033 
1034  int pos = value.indexOf(',');
1035  QDateTime dt;
1036 #ifndef QT_NO_DATESTRING
1037  if (pos == -1) {
1038  // no comma -> asctime(3) format
1040  } else {
1041  // Use sscanf over QLocal/QDateTimeParser for speed reasons. See the
1042  // QtWebKit performance benchmarks to get an idea.
1043  if (pos == 3) {
1044  char month_name[4];
1045  int day, year, hour, minute, second;
1046  if (sscanf(value.constData(), "%*3s, %d %3s %d %d:%d:%d 'GMT'", &day, month_name, &year, &hour, &minute, &second) == 6)
1047  dt = QDateTime(QDate(year, name_to_month(month_name), day), QTime(hour, minute, second));
1048  } else {
1049  QLocale c = QLocale::c();
1050  // eat the weekday, the comma and the space following it
1051  QString sansWeekday = QString::fromLatin1(value.constData() + pos + 2);
1052  // must be RFC 850 date
1053  dt = c.toDateTime(sansWeekday, QLatin1String("dd-MMM-yy hh:mm:ss 'GMT'"));
1054  }
1055  }
1056 #endif // QT_NO_DATESTRING
1057 
1058  if (dt.isValid())
1059  dt.setTimeSpec(Qt::UTC);
1060  return dt;
1061 }
1062 
1064 {
1065  return QLocale::c().toString(dt, QLatin1String("ddd, dd MMM yyyy hh:mm:ss 'GMT'"))
1066  .toLatin1();
1067 }
1068 
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
double d
Definition: qnumeric_p.h:62
QNetworkRequestPrivate(const QNetworkRequestPrivate &other)
void setUrl(const QUrl &url)
Sets the URL this network request is referring to to be url.
void setAllRawHeaders(const RawHeadersList &list)
Sets the internal raw headers list to match list.
QObject * originatingObject() const
Returns a reference to the object that initiated this network request; returns 0 if not set or the ob...
bool isValid() const
Returns true if the URL is valid; otherwise returns false.
Definition: qurl.cpp:4303
unsigned char c[8]
Definition: qnumeric_p.h:62
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
bool hasRawHeader(const QByteArray &headerName) const
Returns true if the raw header headerName is present in this network request.
QSslConfiguration sslConfiguration() const
Returns this network request&#39;s SSL configuration.
QNetworkRequest(const QUrl &url=QUrl())
Constructs a QNetworkRequest object with url as the URL to be requested.
int remove(const Key &key)
Removes all the items that have the key from the hash.
Definition: qhash.h:784
bool isNull() const
Returns true if this is a NULL variant, false otherwise.
Definition: qvariant.cpp:3102
#define it(className, varName)
QByteArray & append(char c)
Appends the character ch to this byte array.
QByteArray rawHeader(const QByteArray &headerName) const
Returns the raw form of header headerName.
static QByteArray headerName(QNetworkRequest::KnownHeaders header)
qlonglong toLongLong(bool *ok=0, int base=10) const
Returns the byte array converted to a {long long} using base base, which is 10 by default and must be...
QDateTime toDateTime(const QString &string, FormatType format=LongFormat) const
Parses the date/time string given in string and returns the time.
Definition: qlocale.cpp:1649
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
void setRawHeader(const QByteArray &key, const QByteArray &value)
QVariant attribute(Attribute code, const QVariant &defaultValue=QVariant()) const
Returns the attribute associated with the code code.
T1 first
Definition: qpair.h:65
RawHeadersList allRawHeaders() const
QSharedDataPointer< QNetworkRequestPrivate > d
T2 second
Definition: qpair.h:66
QNetworkRequest & operator=(const QNetworkRequest &other)
Creates a copy of other.
QDateTime toDateTime() const
Returns the variant as a QDateTime if the variant has type() DateTime , Date , or String ; otherwise ...
Definition: qvariant.cpp:2349
bool operator==(const QNetworkRequest &other) const
Returns true if this object is the same as other (i.e., if they have the same URL, same headers and same meta-data settings).
Priority
This enum lists the possible network request priorities.
bool isValid() const
Returns true if both the date and the time are valid; otherwise returns false.
Definition: qdatetime.cpp:2346
The QDate class provides date functions.
Definition: qdatetime.h:55
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
static int name_to_month(const char *month_str)
The QUrl class provides a convenient interface for working with URLs.
Definition: qurl.h:61
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
static QVariant parseCookieHeader(const QByteArray &raw)
KnownHeaders
List of known header types that QNetworkRequest parses.
T * data() const
QString toString(qlonglong i) const
Returns a localized string representation of i.
Definition: qlocale.cpp:1295
QByteArray toByteArray() const
Returns the variant as a QByteArray if the variant has type() ByteArray or String (converted using QS...
Definition: qvariant.cpp:2383
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606
void setAttribute(Attribute code, const QVariant &value)
Sets the attribute associated with code code to be value value.
iterator Iterator
Qt-style synonym for QList::iterator.
Definition: qlist.h:278
bool operator==(const QNetworkRequestPrivate &other) const
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
QUrl url() const
Returns the URL this network request is referring to.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:753
static QList< QNetworkCookie > parseCookies(const QByteArray &cookieString)
Parses the cookie string cookieString as received from a server response in the "Set-Cookie:" header...
void setPriority(Priority priority)
Set the priority of this request to priority.
QByteArray toRawForm(RawForm form=Full) const
Returns the raw form of this QNetworkCookie.
QNetworkRequest::Priority priority
static QDateTime fromString(const QString &s, Qt::DateFormat f=Qt::TextDate)
Returns the QDateTime represented by the string, using the format given, or an invalid datetime if th...
Definition: qdatetime.cpp:3487
The QTime class provides clock time functions.
Definition: qdatetime.h:148
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
QVariant header(KnownHeaders header) const
Returns the value of the known network header header if it is present in this request.
QWeakPointer< QObject > originatingObject
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
const char * name
QByteArray trimmed() const
Returns a byte array that has whitespace removed from the start and the end.
static QDateTime fromHttpDate(const QByteArray &value)
QSslConfiguration * sslConfiguration
Q_CORE_EXPORT void qWarning(const char *,...)
void setSslConfiguration(const QSslConfiguration &configuration)
Sets this network request&#39;s SSL configuration to be config.
static QSslConfiguration defaultConfiguration()
Returns the default SSL configuration to be used in new SSL connections.
void parseAndSetHeader(const QByteArray &key, const QByteArray &value)
void setTimeSpec(Qt::TimeSpec spec)
Sets the time specification used in this datetime to spec.
Definition: qdatetime.cpp:2431
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
Definition: qstring.cpp:3993
__int64 qint64
Definition: qglobal.h:942
static QVariant fromValue(const T &value)
Returns a QVariant containing a copy of value.
Definition: qvariant.h:336
bool isNull() const
Returns true if this byte array is null; otherwise returns false.
void setHeader(KnownHeaders header, const QVariant &value)
Sets the value of the known header header to be value, overriding any previously set headers...
const char * typeName() const
Returns the name of the type stored in the variant.
Definition: qvariant.cpp:1984
QUrl toUrl() const
Returns the variant as a QUrl if the variant has type() Url ; otherwise returns an invalid QUrl...
Definition: qvariant.cpp:2528
int indexOf(char c, int from=0) const
Returns the index position of the first occurrence of the character ch in the byte array...
static QVariant parseHttpDate(const QByteArray &raw)
Attribute
Attribute codes for the QNetworkRequest and QNetworkReply.
QByteArray toEncoded(FormattingOptions options=None) const
Returns the encoded representation of the URL if it&#39;s valid; otherwise an empty QByteArray is returne...
Definition: qurl.cpp:5949
T & first()
Returns a reference to the first item in the list.
Definition: qlist.h:282
The QNetworkCookie class holds one network cookie.
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
QList< QByteArray > split(char sep) const
Splits the byte array into subarrays wherever sep occurs, and returns the list of those arrays...
void setRawHeader(const QByteArray &headerName, const QByteArray &value)
Sets the header headerName to be of value headerValue.
QString scheme() const
Returns the scheme of the URL.
Definition: qurl.cpp:4550
int userType() const
Returns the storage type of the value stored in the variant.
Definition: qvariant.cpp:1913
static QLocale c()
Returns a QLocale object initialized to the "C" locale.
Definition: qlocale.h:773
The QDateTime class provides date and time functions.
Definition: qdatetime.h:216
Priority priority() const
Return the priority of this request.
CookedHeadersMap cookedHeaders
QList< QByteArray > rawHeadersKeys() const
The QSharedData class is a base class for shared data objects.
Definition: qshareddata.h:56
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
Type type() const
Returns the storage type of the value stored in the variant.
Definition: qvariant.cpp:1901
const_iterator ConstIterator
Qt-style synonym for QList::const_iterator.
Definition: qlist.h:279
int key
RawHeadersList::ConstIterator findRawHeader(const QByteArray &key) const
void setOriginatingObject(QObject *object)
Allows setting a reference to the object initiating the request.
T qvariant_cast(const QVariant &)
Definition: qvariant.h:571
The QNetworkRequest class holds a request to be sent with QNetworkAccessManager.
static QByteArray toHttpDate(const QDateTime &dt)
void setCookedHeader(QNetworkRequest::KnownHeaders header, const QVariant &value)
~QNetworkRequest()
Disposes of the QNetworkRequest object.
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
Definition: qbytearray.h:421
static QNetworkRequest::KnownHeaders parseHeaderName(const QByteArray &headerName)
The QSslConfiguration class holds the configuration and state of an SSL connection.
QList< QByteArray > rawHeaderList() const
Returns a list of all raw headers that are set in this network request.
static QUrl fromEncoded(const QByteArray &url)
Parses input and returns the corresponding QUrl.
Definition: qurl.cpp:5964
Q_CORE_EXPORT int qstricmp(const char *, const char *)
char at(int i) const
Returns the character at index position i in the byte array.
Definition: qbytearray.h:413
bool isValid() const
Returns true if the storage type of this variant is not QVariant::Invalid; otherwise returns false...
Definition: qvariant.h:485
static const KeyPair *const end
static QByteArray headerValue(QNetworkRequest::KnownHeaders header, const QVariant &value)
void setRawHeaderInternal(const QByteArray &key, const QByteArray &value)
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:272
static QVariant parseHeaderValue(QNetworkRequest::KnownHeaders header, const QByteArray &value)