diff options
Diffstat (limited to 'src/network/access')
63 files changed, 256 insertions, 1121 deletions
diff --git a/src/network/access/access.pri b/src/network/access/access.pri index 0047084eb1..e0a0253b6c 100644 --- a/src/network/access/access.pri +++ b/src/network/access/access.pri @@ -2,7 +2,6 @@ HEADERS += \ access/qftp_p.h \ - access/qhttpheader_p.h \ access/qhttpnetworkheader_p.h \ access/qhttpnetworkrequest_p.h \ access/qhttpnetworkreply_p.h \ @@ -39,7 +38,6 @@ HEADERS += \ SOURCES += \ access/qftp.cpp \ - access/qhttpheader.cpp \ access/qhttpnetworkheader.cpp \ access/qhttpnetworkrequest.cpp \ access/qhttpnetworkreply.cpp \ diff --git a/src/network/access/qabstractnetworkcache.cpp b/src/network/access/qabstractnetworkcache.cpp index 638e93be53..69acf080ec 100644 --- a/src/network/access/qabstractnetworkcache.cpp +++ b/src/network/access/qabstractnetworkcache.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qabstractnetworkcache.h b/src/network/access/qabstractnetworkcache.h index 5d03756957..8d7e77eeb0 100644 --- a/src/network/access/qabstractnetworkcache.h +++ b/src/network/access/qabstractnetworkcache.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -51,7 +51,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Network) class QIODevice; class QDateTime; diff --git a/src/network/access/qabstractnetworkcache_p.h b/src/network/access/qabstractnetworkcache_p.h index 162422f8c0..4577d16b0b 100644 --- a/src/network/access/qabstractnetworkcache_p.h +++ b/src/network/access/qabstractnetworkcache_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp index 6fafff0f56..c7ad810084 100644 --- a/src/network/access/qftp.cpp +++ b/src/network/access/qftp.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -472,7 +472,7 @@ static void _q_fixupDateTime(QDateTime *dateTime) const int futureTolerance = 86400; if (dateTime->secsTo(QDateTime::currentDateTime()) < -futureTolerance) { QDate d = dateTime->date(); - d.setYMD(d.year() - 1, d.month(), d.day()); + d.setDate(d.year() - 1, d.month(), d.day()); dateTime->setDate(d); } } diff --git a/src/network/access/qftp_p.h b/src/network/access/qftp_p.h index 0dc6a2006f..8dc423973a 100644 --- a/src/network/access/qftp_p.h +++ b/src/network/access/qftp_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -61,7 +61,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Network) #ifndef QT_NO_FTP diff --git a/src/network/access/qhttpheader.cpp b/src/network/access/qhttpheader.cpp deleted file mode 100644 index 6e87a05c6b..0000000000 --- a/src/network/access/qhttpheader.cpp +++ /dev/null @@ -1,770 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//#define QHTTP_DEBUG - -#include <qplatformdefs.h> -#include "qhttpheader_p.h" - -#ifndef QT_NO_HTTP -# include "private/qobject_p.h" -# include "qtcpsocket.h" -# include "qsslsocket.h" -# include "qtextstream.h" -# include "qmap.h" -# include "qlist.h" -# include "qstring.h" -# include "qstringlist.h" -# include "qbuffer.h" -# include "private/qringbuffer_p.h" -# include "qcoreevent.h" -# include "qurl.h" -# include "qnetworkproxy.h" -# include "qauthenticator.h" -# include "qauthenticator_p.h" -# include "qdebug.h" -# include "qtimer.h" -#endif - -#ifndef QT_NO_HTTP - -QT_BEGIN_NAMESPACE - -class QHttpHeaderPrivate -{ - Q_DECLARE_PUBLIC(QHttpHeader) -public: - inline virtual ~QHttpHeaderPrivate() {} - - QList<QPair<QString, QString> > values; - bool valid; - QHttpHeader *q_ptr; -}; - -/**************************************************** - * - * QHttpHeader - * - ****************************************************/ - -/*! - \class QHttpHeader - \obsolete - \brief The QHttpHeader class contains header information for HTTP. - - \ingroup network - \inmodule QtNetwork - - In most cases you should use the more specialized derivatives of - this class, QHttpResponseHeader and QHttpRequestHeader, rather - than directly using QHttpHeader. - - QHttpHeader provides the HTTP header fields. A HTTP header field - consists of a name followed by a colon, a single space, and the - field value. (See RFC 1945.) Field names are case-insensitive. A - typical header field looks like this: - \snippet doc/src/snippets/code/src_network_access_qhttp.cpp 0 - - In the API the header field name is called the "key" and the - content is called the "value". You can get and set a header - field's value by using its key with value() and setValue(), e.g. - \snippet doc/src/snippets/code/src_network_access_qhttp.cpp 1 - - Some fields are so common that getters and setters are provided - for them as a convenient alternative to using \l value() and - \l setValue(), e.g. contentLength() and contentType(), - setContentLength() and setContentType(). - - Each header key has a \e single value associated with it. If you - set the value for a key which already exists the previous value - will be discarded. - - \sa QHttpRequestHeader QHttpResponseHeader -*/ - -/*! - \fn int QHttpHeader::majorVersion() const - - Returns the major protocol-version of the HTTP header. -*/ - -/*! - \fn int QHttpHeader::minorVersion() const - - Returns the minor protocol-version of the HTTP header. -*/ - -/*! - Constructs an empty HTTP header. -*/ -QHttpHeader::QHttpHeader() - : d_ptr(new QHttpHeaderPrivate) -{ - Q_D(QHttpHeader); - d->q_ptr = this; - d->valid = true; -} - -/*! - Constructs a copy of \a header. -*/ -QHttpHeader::QHttpHeader(const QHttpHeader &header) - : d_ptr(new QHttpHeaderPrivate) -{ - Q_D(QHttpHeader); - d->q_ptr = this; - d->valid = header.d_func()->valid; - d->values = header.d_func()->values; -} - -/*! - Constructs a HTTP header for \a str. - - This constructor parses the string \a str for header fields and - adds this information. The \a str should consist of one or more - "\r\n" delimited lines; each of these lines should have the format - key, colon, space, value. -*/ -QHttpHeader::QHttpHeader(const QString &str) - : d_ptr(new QHttpHeaderPrivate) -{ - Q_D(QHttpHeader); - d->q_ptr = this; - d->valid = true; - parse(str); -} - -/*! \internal - */ -QHttpHeader::QHttpHeader(QHttpHeaderPrivate &dd, const QString &str) - : d_ptr(&dd) -{ - Q_D(QHttpHeader); - d->q_ptr = this; - d->valid = true; - if (!str.isEmpty()) - parse(str); -} - -/*! \internal - */ -QHttpHeader::QHttpHeader(QHttpHeaderPrivate &dd, const QHttpHeader &header) - : d_ptr(&dd) -{ - Q_D(QHttpHeader); - d->q_ptr = this; - d->valid = header.d_func()->valid; - d->values = header.d_func()->values; -} -/*! - Destructor. -*/ -QHttpHeader::~QHttpHeader() -{ -} - -/*! - Assigns \a h and returns a reference to this http header. -*/ -QHttpHeader &QHttpHeader::operator=(const QHttpHeader &h) -{ - Q_D(QHttpHeader); - d->values = h.d_func()->values; - d->valid = h.d_func()->valid; - return *this; -} - -/*! - Returns true if the HTTP header is valid; otherwise returns false. - - A QHttpHeader is invalid if it was created by parsing a malformed string. -*/ -bool QHttpHeader::isValid() const -{ - Q_D(const QHttpHeader); - return d->valid; -} - -/*! \internal - Parses the HTTP header string \a str for header fields and adds - the keys/values it finds. If the string is not parsed successfully - the QHttpHeader becomes \link isValid() invalid\endlink. - - Returns true if \a str was successfully parsed; otherwise returns false. - - \sa toString() -*/ -bool QHttpHeader::parse(const QString &str) -{ - Q_D(QHttpHeader); - QStringList lst; - int pos = str.indexOf(QLatin1Char('\n')); - if (pos > 0 && str.at(pos - 1) == QLatin1Char('\r')) - lst = str.trimmed().split(QLatin1String("\r\n")); - else - lst = str.trimmed().split(QLatin1String("\n")); - lst.removeAll(QString()); // No empties - - if (lst.isEmpty()) - return true; - - QStringList lines; - QStringList::Iterator it = lst.begin(); - for (; it != lst.end(); ++it) { - if (!(*it).isEmpty()) { - if ((*it)[0].isSpace()) { - if (!lines.isEmpty()) { - lines.last() += QLatin1Char(' '); - lines.last() += (*it).trimmed(); - } - } else { - lines.append((*it)); - } - } - } - - int number = 0; - it = lines.begin(); - for (; it != lines.end(); ++it) { - if (!parseLine(*it, number++)) { - d->valid = false; - return false; - } - } - return true; -} - -/*! \internal -*/ -void QHttpHeader::setValid(bool v) -{ - Q_D(QHttpHeader); - d->valid = v; -} - -/*! - Returns the first value for the entry with the given \a key. If no entry - has this \a key, an empty string is returned. - - \sa setValue() removeValue() hasKey() keys() -*/ -QString QHttpHeader::value(const QString &key) const -{ - Q_D(const QHttpHeader); - QString lowercaseKey = key.toLower(); - QList<QPair<QString, QString> >::ConstIterator it = d->values.constBegin(); - while (it != d->values.constEnd()) { - if ((*it).first.toLower() == lowercaseKey) - return (*it).second; - ++it; - } - return QString(); -} - -/*! - Returns all the entries with the given \a key. If no entry - has this \a key, an empty string list is returned. -*/ -QStringList QHttpHeader::allValues(const QString &key) const -{ - Q_D(const QHttpHeader); - QString lowercaseKey = key.toLower(); - QStringList valueList; - QList<QPair<QString, QString> >::ConstIterator it = d->values.constBegin(); - while (it != d->values.constEnd()) { - if ((*it).first.toLower() == lowercaseKey) - valueList.append((*it).second); - ++it; - } - return valueList; -} - -/*! - Returns a list of the keys in the HTTP header. - - \sa hasKey() -*/ -QStringList QHttpHeader::keys() const -{ - Q_D(const QHttpHeader); - QStringList keyList; - QSet<QString> seenKeys; - QList<QPair<QString, QString> >::ConstIterator it = d->values.constBegin(); - while (it != d->values.constEnd()) { - const QString &key = (*it).first; - QString lowercaseKey = key.toLower(); - if (!seenKeys.contains(lowercaseKey)) { - keyList.append(key); - seenKeys.insert(lowercaseKey); - } - ++it; - } - return keyList; -} - -/*! - Returns true if the HTTP header has an entry with the given \a - key; otherwise returns false. - - \sa value() setValue() keys() -*/ -bool QHttpHeader::hasKey(const QString &key) const -{ - Q_D(const QHttpHeader); - QString lowercaseKey = key.toLower(); - QList<QPair<QString, QString> >::ConstIterator it = d->values.constBegin(); - while (it != d->values.constEnd()) { - if ((*it).first.toLower() == lowercaseKey) - return true; - ++it; - } - return false; -} - -/*! - Sets the value of the entry with the \a key to \a value. - - If no entry with \a key exists, a new entry with the given \a key - and \a value is created. If an entry with the \a key already - exists, the first value is discarded and replaced with the given - \a value. - - \sa value() hasKey() removeValue() -*/ -void QHttpHeader::setValue(const QString &key, const QString &value) -{ - Q_D(QHttpHeader); - QString lowercaseKey = key.toLower(); - QList<QPair<QString, QString> >::Iterator it = d->values.begin(); - while (it != d->values.end()) { - if ((*it).first.toLower() == lowercaseKey) { - (*it).second = value; - return; - } - ++it; - } - // not found so add - addValue(key, value); -} - -/*! - Sets the header entries to be the list of key value pairs in \a values. -*/ -void QHttpHeader::setValues(const QList<QPair<QString, QString> > &values) -{ - Q_D(QHttpHeader); - d->values = values; -} - -/*! - Adds a new entry with the \a key and \a value. -*/ -void QHttpHeader::addValue(const QString &key, const QString &value) -{ - Q_D(QHttpHeader); - d->values.append(qMakePair(key, value)); -} - -/*! - Returns all the entries in the header. -*/ -QList<QPair<QString, QString> > QHttpHeader::values() const -{ - Q_D(const QHttpHeader); - return d->values; -} - -/*! - Removes the entry with the key \a key from the HTTP header. - - \sa value() setValue() -*/ -void QHttpHeader::removeValue(const QString &key) -{ - Q_D(QHttpHeader); - QString lowercaseKey = key.toLower(); - QList<QPair<QString, QString> >::Iterator it = d->values.begin(); - while (it != d->values.end()) { - if ((*it).first.toLower() == lowercaseKey) { - d->values.erase(it); - return; - } - ++it; - } -} - -/*! - Removes all the entries with the key \a key from the HTTP header. -*/ -void QHttpHeader::removeAllValues(const QString &key) -{ - Q_D(QHttpHeader); - QString lowercaseKey = key.toLower(); - QList<QPair<QString, QString> >::Iterator it = d->values.begin(); - while (it != d->values.end()) { - if ((*it).first.toLower() == lowercaseKey) { - it = d->values.erase(it); - continue; - } - ++it; - } -} - -/*! \internal - Parses the single HTTP header line \a line which has the format - key, colon, space, value, and adds key/value to the headers. The - linenumber is \a number. Returns true if the line was successfully - parsed and the key/value added; otherwise returns false. - - \sa parse() -*/ -bool QHttpHeader::parseLine(const QString &line, int) -{ - int i = line.indexOf(QLatin1Char(':')); - if (i == -1) - return false; - - addValue(line.left(i).trimmed(), line.mid(i + 1).trimmed()); - - return true; -} - -/*! - Returns a string representation of the HTTP header. - - The string is suitable for use by the constructor that takes a - QString. It consists of lines with the format: key, colon, space, - value, "\r\n". -*/ -QString QHttpHeader::toString() const -{ - Q_D(const QHttpHeader); - if (!isValid()) - return QLatin1String(""); - - QString ret = QLatin1String(""); - - QList<QPair<QString, QString> >::ConstIterator it = d->values.constBegin(); - while (it != d->values.constEnd()) { - ret += (*it).first + QLatin1String(": ") + (*it).second + QLatin1String("\r\n"); - ++it; - } - return ret; -} - -/*! - Returns true if the header has an entry for the special HTTP - header field \c content-length; otherwise returns false. - - \sa contentLength() setContentLength() -*/ -bool QHttpHeader::hasContentLength() const -{ - return hasKey(QLatin1String("content-length")); -} - -/*! - Returns the value of the special HTTP header field \c - content-length. - - \sa setContentLength() hasContentLength() -*/ -uint QHttpHeader::contentLength() const -{ - return value(QLatin1String("content-length")).toUInt(); -} - -/*! - Sets the value of the special HTTP header field \c content-length - to \a len. - - \sa contentLength() hasContentLength() -*/ -void QHttpHeader::setContentLength(int len) -{ - setValue(QLatin1String("content-length"), QString::number(len)); -} - -/*! - Returns true if the header has an entry for the special HTTP - header field \c content-type; otherwise returns false. - - \sa contentType() setContentType() -*/ -bool QHttpHeader::hasContentType() const -{ - return hasKey(QLatin1String("content-type")); -} - -/*! - Returns the value of the special HTTP header field \c content-type. - - \sa setContentType() hasContentType() -*/ -QString QHttpHeader::contentType() const -{ - QString type = value(QLatin1String("content-type")); - if (type.isEmpty()) - return QString(); - - int pos = type.indexOf(QLatin1Char(';')); - if (pos == -1) - return type; - - return type.left(pos).trimmed(); -} - -/*! - Sets the value of the special HTTP header field \c content-type to - \a type. - - \sa contentType() hasContentType() -*/ -void QHttpHeader::setContentType(const QString &type) -{ - setValue(QLatin1String("content-type"), type); -} - -class QHttpResponseHeaderPrivate : public QHttpHeaderPrivate -{ - Q_DECLARE_PUBLIC(QHttpResponseHeader) -public: - int statCode; - QString reasonPhr; - int majVer; - int minVer; -}; - -/**************************************************** - * - * QHttpResponseHeader - * - ****************************************************/ - -/*! - \class QHttpResponseHeader - \obsolete - \brief The QHttpResponseHeader class contains response header information for HTTP. - - \ingroup network - \inmodule QtNetwork - - HTTP responses have a status code that indicates the status of the - response. This code is a 3-digit integer result code (for details - see to RFC 1945). In addition to the status code, you can also - specify a human-readable text that describes the reason for the - code ("reason phrase"). This class allows you to get the status - code and the reason phrase. - - \sa QHttpRequestHeader, {HTTP Example} -*/ - -/*! - Constructs an empty HTTP response header. -*/ -QHttpResponseHeader::QHttpResponseHeader() - : QHttpHeader(*new QHttpResponseHeaderPrivate) -{ - setValid(false); -} - -/*! - Constructs a copy of \a header. -*/ -QHttpResponseHeader::QHttpResponseHeader(const QHttpResponseHeader &header) - : QHttpHeader(*new QHttpResponseHeaderPrivate, header) -{ - Q_D(QHttpResponseHeader); - d->statCode = header.d_func()->statCode; - d->reasonPhr = header.d_func()->reasonPhr; - d->majVer = header.d_func()->majVer; - d->minVer = header.d_func()->minVer; -} - -/*! - Copies the contents of \a header into this QHttpResponseHeader. -*/ -QHttpResponseHeader &QHttpResponseHeader::operator=(const QHttpResponseHeader &header) -{ - Q_D(QHttpResponseHeader); - QHttpHeader::operator=(header); - d->statCode = header.d_func()->statCode; - d->reasonPhr = header.d_func()->reasonPhr; - d->majVer = header.d_func()->majVer; - d->minVer = header.d_func()->minVer; - return *this; -} - -/*! - Constructs a HTTP response header from the string \a str. The - string is parsed and the information is set. The \a str should - consist of one or more "\r\n" delimited lines; the first line should be the - status-line (format: HTTP-version, space, status-code, space, - reason-phrase); each of remaining lines should have the format key, colon, - space, value. -*/ -QHttpResponseHeader::QHttpResponseHeader(const QString &str) - : QHttpHeader(*new QHttpResponseHeaderPrivate) -{ - parse(str); -} - -/*! - \since 4.1 - - Constructs a QHttpResponseHeader, setting the status code to \a code, the - reason phrase to \a text and the protocol-version to \a majorVer and \a - minorVer. - - \sa statusCode() reasonPhrase() majorVersion() minorVersion() -*/ -QHttpResponseHeader::QHttpResponseHeader(int code, const QString &text, int majorVer, int minorVer) - : QHttpHeader(*new QHttpResponseHeaderPrivate) -{ - setStatusLine(code, text, majorVer, minorVer); -} - -/*! - \since 4.1 - - Sets the status code to \a code, the reason phrase to \a text and - the protocol-version to \a majorVer and \a minorVer. - - \sa statusCode() reasonPhrase() majorVersion() minorVersion() -*/ -void QHttpResponseHeader::setStatusLine(int code, const QString &text, int majorVer, int minorVer) -{ - Q_D(QHttpResponseHeader); - setValid(true); - d->statCode = code; - d->reasonPhr = text; - d->majVer = majorVer; - d->minVer = minorVer; -} - -/*! - Returns the status code of the HTTP response header. - - \sa reasonPhrase() majorVersion() minorVersion() -*/ -int QHttpResponseHeader::statusCode() const -{ - Q_D(const QHttpResponseHeader); - return d->statCode; -} - -/*! - Returns the reason phrase of the HTTP response header. - - \sa statusCode() majorVersion() minorVersion() -*/ -QString QHttpResponseHeader::reasonPhrase() const -{ - Q_D(const QHttpResponseHeader); - return d->reasonPhr; -} - -/*! - Returns the major protocol-version of the HTTP response header. - - \sa minorVersion() statusCode() reasonPhrase() -*/ -int QHttpResponseHeader::majorVersion() const -{ - Q_D(const QHttpResponseHeader); - return d->majVer; -} - -/*! - Returns the minor protocol-version of the HTTP response header. - - \sa majorVersion() statusCode() reasonPhrase() -*/ -int QHttpResponseHeader::minorVersion() const -{ - Q_D(const QHttpResponseHeader); - return d->minVer; -} - -/*! \internal -*/ -bool QHttpResponseHeader::parseLine(const QString &line, int number) -{ - Q_D(QHttpResponseHeader); - if (number != 0) - return QHttpHeader::parseLine(line, number); - - QString l = line.simplified(); - if (l.length() < 10) - return false; - - if (l.left(5) == QLatin1String("HTTP/") && l[5].isDigit() && l[6] == QLatin1Char('.') && - l[7].isDigit() && l[8] == QLatin1Char(' ') && l[9].isDigit()) { - d->majVer = l[5].toLatin1() - '0'; - d->minVer = l[7].toLatin1() - '0'; - - int pos = l.indexOf(QLatin1Char(' '), 9); - if (pos != -1) { - d->reasonPhr = l.mid(pos + 1); - d->statCode = l.mid(9, pos - 9).toInt(); - } else { - d->statCode = l.mid(9).toInt(); - d->reasonPhr.clear(); - } - } else { - return false; - } - - return true; -} - -/*! \reimp -*/ -QString QHttpResponseHeader::toString() const -{ - Q_D(const QHttpResponseHeader); - QString ret(QLatin1String("HTTP/%1.%2 %3 %4\r\n%5\r\n")); - return ret.arg(d->majVer).arg(d->minVer).arg(d->statCode).arg(d->reasonPhr).arg(QHttpHeader::toString()); -} - -QT_END_NAMESPACE - -#endif diff --git a/src/network/access/qhttpheader_p.h b/src/network/access/qhttpheader_p.h deleted file mode 100644 index fec7da4f92..0000000000 --- a/src/network/access/qhttpheader_p.h +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QHTTP_H -#define QHTTP_H - -#include <QtCore/qobject.h> -#include <QtCore/qstringlist.h> -#include <QtCore/qmap.h> -#include <QtCore/qpair.h> -#include <QtCore/qscopedpointer.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Network) - -#ifndef QT_NO_HTTP - -#if 0 -#pragma qt_class(QHttp) -#endif - -class QHttpHeaderPrivate; -class QHttpHeader -{ -public: - QHttpHeader(); - QHttpHeader(const QHttpHeader &header); - QHttpHeader(const QString &str); - virtual ~QHttpHeader(); - - QHttpHeader &operator=(const QHttpHeader &h); - - void setValue(const QString &key, const QString &value); - void setValues(const QList<QPair<QString, QString> > &values); - void addValue(const QString &key, const QString &value); - QList<QPair<QString, QString> > values() const; - bool hasKey(const QString &key) const; - QStringList keys() const; - QString value(const QString &key) const; - QStringList allValues(const QString &key) const; - void removeValue(const QString &key); - void removeAllValues(const QString &key); - - // ### Qt 5: change to qint64 - bool hasContentLength() const; - uint contentLength() const; - void setContentLength(int len); - - bool hasContentType() const; - QString contentType() const; - void setContentType(const QString &type); - - virtual QString toString() const; - bool isValid() const; - - virtual int majorVersion() const = 0; - virtual int minorVersion() const = 0; - -protected: - virtual bool parseLine(const QString &line, int number); - bool parse(const QString &str); - void setValid(bool); - - QHttpHeader(QHttpHeaderPrivate &dd, const QString &str = QString()); - QHttpHeader(QHttpHeaderPrivate &dd, const QHttpHeader &header); - QScopedPointer<QHttpHeaderPrivate> d_ptr; - -private: - Q_DECLARE_PRIVATE(QHttpHeader) -}; - -class QHttpResponseHeaderPrivate; -class QHttpResponseHeader : public QHttpHeader -{ -public: - QHttpResponseHeader(); - QHttpResponseHeader(const QHttpResponseHeader &header); - QHttpResponseHeader(const QString &str); - QHttpResponseHeader(int code, const QString &text = QString(), int majorVer = 1, int minorVer = 1); - QHttpResponseHeader &operator=(const QHttpResponseHeader &header); - - void setStatusLine(int code, const QString &text = QString(), int majorVer = 1, int minorVer = 1); - - int statusCode() const; - QString reasonPhrase() const; - - int majorVersion() const; - int minorVersion() const; - - QString toString() const; - -protected: - bool parseLine(const QString &line, int number); - -private: - Q_DECLARE_PRIVATE(QHttpResponseHeader) - friend class QHttpPrivate; -}; - -#endif // QT_NO_HTTP - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QHTTP_H diff --git a/src/network/access/qhttpmultipart.cpp b/src/network/access/qhttpmultipart.cpp index 6de7a807e4..e24c0606ef 100644 --- a/src/network/access/qhttpmultipart.cpp +++ b/src/network/access/qhttpmultipart.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qhttpmultipart.h b/src/network/access/qhttpmultipart.h index 317b068e3d..c25beb7ae3 100644 --- a/src/network/access/qhttpmultipart.h +++ b/src/network/access/qhttpmultipart.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -50,7 +50,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Network) class QHttpPartPrivate; class QHttpMultiPart; diff --git a/src/network/access/qhttpmultipart_p.h b/src/network/access/qhttpmultipart_p.h index 0ab2fa1d7f..14bf50ec03 100644 --- a/src/network/access/qhttpmultipart_p.h +++ b/src/network/access/qhttpmultipart_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 104a21f591..b49bda04ec 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h index 8ce9bf24fe..41ee11db51 100644 --- a/src/network/access/qhttpnetworkconnection_p.h +++ b/src/network/access/qhttpnetworkconnection_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 3acfe54ef7..70368d5e50 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h index d5a0925f7d..1198ec9941 100644 --- a/src/network/access/qhttpnetworkconnectionchannel_p.h +++ b/src/network/access/qhttpnetworkconnectionchannel_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qhttpnetworkheader.cpp b/src/network/access/qhttpnetworkheader.cpp index 531afe92e0..9c5c8b063f 100644 --- a/src/network/access/qhttpnetworkheader.cpp +++ b/src/network/access/qhttpnetworkheader.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qhttpnetworkheader_p.h b/src/network/access/qhttpnetworkheader_p.h index 00393b5e92..1748514294 100644 --- a/src/network/access/qhttpnetworkheader_p.h +++ b/src/network/access/qhttpnetworkheader_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index a9ba5d2b24..8206cfaab7 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h index 1bb0832d19..97400d3b15 100644 --- a/src/network/access/qhttpnetworkreply_p.h +++ b/src/network/access/qhttpnetworkreply_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -156,6 +156,7 @@ Q_SIGNALS: void authenticationRequired(const QHttpNetworkRequest &request, QAuthenticator *authenticator); private: Q_DECLARE_PRIVATE(QHttpNetworkReply) + friend class QHttpSocketEngine; friend class QHttpNetworkConnection; friend class QHttpNetworkConnectionPrivate; friend class QHttpNetworkConnectionChannel; diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp index e39faaeaa8..f32251935b 100644 --- a/src/network/access/qhttpnetworkrequest.cpp +++ b/src/network/access/qhttpnetworkrequest.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qhttpnetworkrequest_p.h b/src/network/access/qhttpnetworkrequest_p.h index 71e09eba06..949d98484f 100644 --- a/src/network/access/qhttpnetworkrequest_p.h +++ b/src/network/access/qhttpnetworkrequest_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp index 39a7e8ed08..5cf153325b 100644 --- a/src/network/access/qhttpthreaddelegate.cpp +++ b/src/network/access/qhttpthreaddelegate.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qhttpthreaddelegate_p.h b/src/network/access/qhttpthreaddelegate_p.h index 366d3bcc60..24affdd8de 100644 --- a/src/network/access/qhttpthreaddelegate_p.h +++ b/src/network/access/qhttpthreaddelegate_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkaccessauthenticationmanager.cpp b/src/network/access/qnetworkaccessauthenticationmanager.cpp index 30e3174f25..85e7f65ba2 100644 --- a/src/network/access/qnetworkaccessauthenticationmanager.cpp +++ b/src/network/access/qnetworkaccessauthenticationmanager.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkaccessauthenticationmanager_p.h b/src/network/access/qnetworkaccessauthenticationmanager_p.h index 7e7be8ca8a..92f5fcb5b4 100644 --- a/src/network/access/qnetworkaccessauthenticationmanager_p.h +++ b/src/network/access/qnetworkaccessauthenticationmanager_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 6647c58f8d..d7b6b78e22 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index f9563da4a7..f4c6bb65ac 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkaccesscache.cpp b/src/network/access/qnetworkaccesscache.cpp index 2594e53949..bd3cee530f 100644 --- a/src/network/access/qnetworkaccesscache.cpp +++ b/src/network/access/qnetworkaccesscache.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkaccesscache_p.h b/src/network/access/qnetworkaccesscache_p.h index 813ba3c35f..dfe33b8db7 100644 --- a/src/network/access/qnetworkaccesscache_p.h +++ b/src/network/access/qnetworkaccesscache_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkaccesscachebackend.cpp b/src/network/access/qnetworkaccesscachebackend.cpp index baf6292124..6abe42f795 100644 --- a/src/network/access/qnetworkaccesscachebackend.cpp +++ b/src/network/access/qnetworkaccesscachebackend.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkaccesscachebackend_p.h b/src/network/access/qnetworkaccesscachebackend_p.h index 5444703793..112a9ccfa9 100644 --- a/src/network/access/qnetworkaccesscachebackend_p.h +++ b/src/network/access/qnetworkaccesscachebackend_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkaccessdebugpipebackend.cpp b/src/network/access/qnetworkaccessdebugpipebackend.cpp index 678d6e404e..5a4cd7b20d 100644 --- a/src/network/access/qnetworkaccessdebugpipebackend.cpp +++ b/src/network/access/qnetworkaccessdebugpipebackend.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkaccessdebugpipebackend_p.h b/src/network/access/qnetworkaccessdebugpipebackend_p.h index 411c38b3ba..edac78383a 100644 --- a/src/network/access/qnetworkaccessdebugpipebackend_p.h +++ b/src/network/access/qnetworkaccessdebugpipebackend_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkaccessfilebackend.cpp b/src/network/access/qnetworkaccessfilebackend.cpp index 0080e23a8f..dbe964ac8d 100644 --- a/src/network/access/qnetworkaccessfilebackend.cpp +++ b/src/network/access/qnetworkaccessfilebackend.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkaccessfilebackend_p.h b/src/network/access/qnetworkaccessfilebackend_p.h index 2fbf806851..4b25a2c651 100644 --- a/src/network/access/qnetworkaccessfilebackend_p.h +++ b/src/network/access/qnetworkaccessfilebackend_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkaccessftpbackend.cpp b/src/network/access/qnetworkaccessftpbackend.cpp index 7b7ebb5e46..98967e730e 100644 --- a/src/network/access/qnetworkaccessftpbackend.cpp +++ b/src/network/access/qnetworkaccessftpbackend.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkaccessftpbackend_p.h b/src/network/access/qnetworkaccessftpbackend_p.h index 7338121493..6105be9816 100644 --- a/src/network/access/qnetworkaccessftpbackend_p.h +++ b/src/network/access/qnetworkaccessftpbackend_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 3a80b9ed92..8537502116 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -985,7 +985,6 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera #endif // QT_NO_HTTP // first step: create the reply - QUrl url = request.url(); QNetworkReplyImpl *reply = new QNetworkReplyImpl(this); #ifndef QT_NO_BEARERMANAGEMENT if (!isLocalFile) { diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index 72fd86c5a5..fdbcf01dad 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -48,7 +48,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Network) class QIODevice; class QAbstractNetworkCache; diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index bc8df575a0..0733756be4 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp index a5c4fb516c..c987c50017 100644 --- a/src/network/access/qnetworkcookie.cpp +++ b/src/network/access/qnetworkcookie.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -156,7 +156,7 @@ QNetworkCookie &QNetworkCookie::operator=(const QNetworkCookie &other) However, in some contexts, two cookies of the same name could be considered equal. - \sa operator!=() + \sa operator!=(), hasSameIdentifier() */ bool QNetworkCookie::operator==(const QNetworkCookie &other) const { @@ -172,6 +172,17 @@ bool QNetworkCookie::operator==(const QNetworkCookie &other) const } /*! + Returns true if this cookie has the same identifier tuple as \a other. + The identifier tuple is composed of the name, domain and path. + + \sa operator==() +*/ +bool QNetworkCookie::hasSameIdentifier(const QNetworkCookie &other) const +{ + return d->name == other.d->name && d->domain == other.d->domain && d->path == other.d->path; +} + +/*! Returns true if the "secure" option was specified in the cookie string, false otherwise. @@ -1042,6 +1053,30 @@ QList<QNetworkCookie> QNetworkCookiePrivate::parseSetCookieHeaderLine(const QByt return result; } +/*! + This functions normalizes the path and domain of the cookie if they were previously empty. +*/ +void QNetworkCookie::normalize(const QUrl &url) +{ + // don't do path checking. See http://bugreports.qt.nokia.com/browse/QTBUG-5815 + if (d->path.isEmpty()) { + QString pathAndFileName = url.path(); + QString defaultPath = pathAndFileName.left(pathAndFileName.lastIndexOf(QLatin1Char('/'))+1); + if (defaultPath.isEmpty()) + defaultPath = QLatin1Char('/'); + d->path = defaultPath; + } + + if (d->domain.isEmpty()) + d->domain = url.host(); + else if (!d->domain.startsWith(QLatin1Char('.'))) + // Ensure the domain starts with a dot if its field was not empty + // in the HTTP header. There are some servers that forget the + // leading dot and this is actually forbidden according to RFC 2109, + // but all browsers accept it anyway so we do that as well. + d->domain.prepend(QLatin1Char('.')); +} + #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug s, const QNetworkCookie &cookie) { diff --git a/src/network/access/qnetworkcookie.h b/src/network/access/qnetworkcookie.h index fd9c825ddc..32307e305e 100644 --- a/src/network/access/qnetworkcookie.h +++ b/src/network/access/qnetworkcookie.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -51,7 +51,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Network) class QByteArray; class QDateTime; @@ -98,6 +97,9 @@ public: QByteArray toRawForm(RawForm form = Full) const; + bool hasSameIdentifier(const QNetworkCookie &other) const; + void normalize(const QUrl &url); + static QList<QNetworkCookie> parseCookies(const QByteArray &cookieString); private: diff --git a/src/network/access/qnetworkcookie_p.h b/src/network/access/qnetworkcookie_p.h index 7e45219fce..2d74fad7c9 100644 --- a/src/network/access/qnetworkcookie_p.h +++ b/src/network/access/qnetworkcookie_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkcookiejar.cpp b/src/network/access/qnetworkcookiejar.cpp index 54c2ccfaba..4136043e2e 100644 --- a/src/network/access/qnetworkcookiejar.cpp +++ b/src/network/access/qnetworkcookiejar.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -155,8 +155,7 @@ static inline bool isParentDomain(QString domain, QString reference) /*! Adds the cookies in the list \a cookieList to this cookie - jar. Default values for path and domain are taken from the \a - url object. + jar. Before being inserted cookies are normalized. Returns true if one or more cookies are set for \a url, otherwise false. @@ -173,72 +172,18 @@ static inline bool isParentDomain(QString domain, QString reference) size. Reimplement this function to discard older cookies to create room for new ones. - \sa cookiesForUrl(), QNetworkAccessManager::setCookieJar() + \sa cookiesForUrl(), QNetworkAccessManager::setCookieJar(), QNetworkCookie::normalize() */ bool QNetworkCookieJar::setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url) { - Q_D(QNetworkCookieJar); - QString defaultDomain = url.host(); - QString pathAndFileName = url.path(); - QString defaultPath = pathAndFileName.left(pathAndFileName.lastIndexOf(QLatin1Char('/'))+1); - if (defaultPath.isEmpty()) - defaultPath = QLatin1Char('/'); - - int added = 0; - QDateTime now = QDateTime::currentDateTime(); + bool added = false; foreach (QNetworkCookie cookie, cookieList) { - bool isDeletion = !cookie.isSessionCookie() && - cookie.expirationDate() < now; - - // validate the cookie & set the defaults if unset - if (cookie.path().isEmpty()) - cookie.setPath(defaultPath); - // don't do path checking. See http://bugreports.qt.nokia.com/browse/QTBUG-5815 -// else if (!isParentPath(pathAndFileName, cookie.path())) { -// continue; // not accepted -// } - if (cookie.domain().isEmpty()) { - cookie.setDomain(defaultDomain); - } else { - // Ensure the domain starts with a dot if its field was not empty - // in the HTTP header. There are some servers that forget the - // leading dot and this is actually forbidden according to RFC 2109, - // but all browsers accept it anyway so we do that as well. - if (!cookie.domain().startsWith(QLatin1Char('.'))) - cookie.setDomain(QLatin1Char('.') + cookie.domain()); - - QString domain = cookie.domain(); - if (!(isParentDomain(domain, defaultDomain) - || isParentDomain(defaultDomain, domain))) - continue; // not accepted - - // the check for effective TLDs makes the "embedded dot" rule from RFC 2109 section 4.3.2 - // redundant; the "leading dot" rule has been relaxed anyway, see above - // we remove the leading dot for this check - if (qIsEffectiveTLD(domain.remove(0, 1))) - continue; // not accepted - } - - QList<QNetworkCookie>::Iterator it = d->allCookies.begin(), - end = d->allCookies.end(); - for ( ; it != end; ++it) - // does this cookie already exist? - if (cookie.name() == it->name() && - cookie.domain() == it->domain() && - cookie.path() == it->path()) { - // found a match - d->allCookies.erase(it); - break; - } - - // did not find a match - if (!isDeletion) { - d->allCookies += cookie; - ++added; - } + cookie.normalize(url); + if (validateCookie(cookie, url) && insertCookie(cookie)) + added = true; } - return (added > 0); + return added; } /*! @@ -304,4 +249,81 @@ QList<QNetworkCookie> QNetworkCookieJar::cookiesForUrl(const QUrl &url) const return result; } +/*! + Adds \a cookie to this cookie jar. + + Returns true if \a cookie was added, false otherwise. + + If a cookie with the same identifier already exists in the + cookie jar, it will be overridden. +*/ +bool QNetworkCookieJar::insertCookie(const QNetworkCookie &cookie) +{ + Q_D(QNetworkCookieJar); + QDateTime now = QDateTime::currentDateTime(); + bool isDeletion = !cookie.isSessionCookie() && + cookie.expirationDate() < now; + + deleteCookie(cookie); + + if (!isDeletion) { + d->allCookies += cookie; + return true; + } + return false; +} + +/*! + If a cookie with the same identifier as \a cookie exists in this cookie jar + it will be updated. This function uses insertCookie(). + + Returns true if \a cookie was updated, false if no cookie in the jar matches + the identifier of \a cookie. + + \sa QNetworkCookie::hasSameIdentifier() +*/ +bool QNetworkCookieJar::updateCookie(const QNetworkCookie &cookie) +{ + if (deleteCookie(cookie)) + return insertCookie(cookie); + return false; +} + +/*! + Deletes from cookie jar the cookie found to have the same identifier as \a cookie. + + Returns true if a cookie was deleted, false otherwise. + + \sa QNetworkCookie::hasSameIdentifier() +*/ +bool QNetworkCookieJar::deleteCookie(const QNetworkCookie &cookie) +{ + Q_D(QNetworkCookieJar); + QList<QNetworkCookie>::Iterator it; + for (it = d->allCookies.begin(); it != d->allCookies.end(); it++) + if (it->hasSameIdentifier(cookie)) { + d->allCookies.erase(it); + return true; + } + return false; +} + +/*! + Returns true if the domain and path of \a cookie are valid, false otherwise. +*/ +bool QNetworkCookieJar::validateCookie(const QNetworkCookie &cookie, const QUrl &url) const +{ + QString domain = cookie.domain(); + if (!(isParentDomain(domain, url.host()) || isParentDomain(url.host(), domain))) + return false; // not accepted + + // the check for effective TLDs makes the "embedded dot" rule from RFC 2109 section 4.3.2 + // redundant; the "leading dot" rule has been relaxed anyway, see QNetworkCookie::normalize() + // we remove the leading dot for this check if it's present + if (qIsEffectiveTLD(domain.startsWith('.') ? domain.remove(0, 1) : domain)) + return false; // not accepted + + return true; +} + QT_END_NAMESPACE diff --git a/src/network/access/qnetworkcookiejar.h b/src/network/access/qnetworkcookiejar.h index 4ff27d8cf0..513fb3b66c 100644 --- a/src/network/access/qnetworkcookiejar.h +++ b/src/network/access/qnetworkcookiejar.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -49,7 +49,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Network) class QNetworkCookie; @@ -64,9 +63,14 @@ public: virtual QList<QNetworkCookie> cookiesForUrl(const QUrl &url) const; virtual bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url); + virtual bool insertCookie(const QNetworkCookie &cookie); + virtual bool updateCookie(const QNetworkCookie &cookie); + virtual bool deleteCookie(const QNetworkCookie &cookie); + protected: QList<QNetworkCookie> allCookies() const; void setAllCookies(const QList<QNetworkCookie> &cookieList); + virtual bool validateCookie(const QNetworkCookie &cookie, const QUrl &url) const; private: Q_DECLARE_PRIVATE(QNetworkCookieJar) diff --git a/src/network/access/qnetworkcookiejar_p.h b/src/network/access/qnetworkcookiejar_p.h index 32fdecdb50..a3caa1d03d 100644 --- a/src/network/access/qnetworkcookiejar_p.h +++ b/src/network/access/qnetworkcookiejar_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp index 8dd2033a35..bcaf81a6a0 100644 --- a/src/network/access/qnetworkdiskcache.cpp +++ b/src/network/access/qnetworkdiskcache.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkdiskcache.h b/src/network/access/qnetworkdiskcache.h index b8f1de5930..20da4cac8a 100644 --- a/src/network/access/qnetworkdiskcache.h +++ b/src/network/access/qnetworkdiskcache.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -48,7 +48,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Network) #ifndef QT_NO_NETWORKDISKCACHE diff --git a/src/network/access/qnetworkdiskcache_p.h b/src/network/access/qnetworkdiskcache_p.h index d8f386e9eb..eb2b474964 100644 --- a/src/network/access/qnetworkdiskcache_p.h +++ b/src/network/access/qnetworkdiskcache_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp index db62f2935a..123418dbcd 100644 --- a/src/network/access/qnetworkreply.cpp +++ b/src/network/access/qnetworkreply.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkreply.h b/src/network/access/qnetworkreply.h index 492336bbf6..89ccc2fb92 100644 --- a/src/network/access/qnetworkreply.h +++ b/src/network/access/qnetworkreply.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -53,7 +53,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Network) class QUrl; class QVariant; diff --git a/src/network/access/qnetworkreply_p.h b/src/network/access/qnetworkreply_p.h index b725a11520..9c838a5539 100644 --- a/src/network/access/qnetworkreply_p.h +++ b/src/network/access/qnetworkreply_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkreplydataimpl.cpp b/src/network/access/qnetworkreplydataimpl.cpp index 22f40b2420..ab2c97b653 100644 --- a/src/network/access/qnetworkreplydataimpl.cpp +++ b/src/network/access/qnetworkreplydataimpl.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkreplydataimpl_p.h b/src/network/access/qnetworkreplydataimpl_p.h index 0b47bbbb34..10cee7231b 100644 --- a/src/network/access/qnetworkreplydataimpl_p.h +++ b/src/network/access/qnetworkreplydataimpl_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkreplyfileimpl.cpp b/src/network/access/qnetworkreplyfileimpl.cpp index 0b4c89987c..6b5dba2bfa 100644 --- a/src/network/access/qnetworkreplyfileimpl.cpp +++ b/src/network/access/qnetworkreplyfileimpl.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkreplyfileimpl_p.h b/src/network/access/qnetworkreplyfileimpl_p.h index c097fedb68..c7c2bba671 100644 --- a/src/network/access/qnetworkreplyfileimpl_p.h +++ b/src/network/access/qnetworkreplyfileimpl_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 2c1ad95ea8..71bc03e8d0 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -1499,10 +1499,11 @@ bool QNetworkReplyHttpImplPrivate::start() { #ifndef QT_NO_BEARERMANAGEMENT if (!managerPrivate->networkSession) { +#endif postRequest(); return true; +#ifndef QT_NO_BEARERMANAGEMENT } -#endif // This is not ideal. const QString host = url.host(); @@ -1513,15 +1514,14 @@ bool QNetworkReplyHttpImplPrivate::start() return true; } -#ifndef QT_NO_BEARERMANAGEMENT if (managerPrivate->networkSession->isOpen() && managerPrivate->networkSession->state() == QNetworkSession::Connected) { postRequest(); return true; } -#endif return false; +#endif } void QNetworkReplyHttpImplPrivate::_q_startOperation() @@ -1533,13 +1533,12 @@ void QNetworkReplyHttpImplPrivate::_q_startOperation() } state = Working; + if (!start()) { #ifndef QT_NO_BEARERMANAGEMENT - if (!start()) { // ### we should call that method even if bearer is not used // backend failed to start because the session state is not Connected. // QNetworkAccessManager will call reply->backend->start() again for us when the session // state changes. state = WaitingForSession; - QNetworkSession *session = managerPrivate->networkSession.data(); if (session) { @@ -1553,10 +1552,9 @@ void QNetworkReplyHttpImplPrivate::_q_startOperation() } else { qWarning("Backend is waiting for QNetworkSession to connect, but there is none!"); } - +#endif return; } -#endif if (synchronous) { state = Finished; @@ -1964,7 +1962,7 @@ void QNetworkReplyHttpImplPrivate::setCachingEnabled(bool enable) if (enable) { if (bytesDownloaded) { - qDebug("setCachingEnabled: %d bytesDownloaded", bytesDownloaded); + qDebug("setCachingEnabled: %lld bytesDownloaded", bytesDownloaded); // refuse to enable in this case qCritical("QNetworkReplyImpl: backend error: caching was enabled after some bytes had been written"); return; diff --git a/src/network/access/qnetworkreplyhttpimpl_p.h b/src/network/access/qnetworkreplyhttpimpl_p.h index 432b769add..b0a8e59b94 100644 --- a/src/network/access/qnetworkreplyhttpimpl_p.h +++ b/src/network/access/qnetworkreplyhttpimpl_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 1f9efa6ed9..f97d98ec5a 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index 0b7664acc6..39c3b9ca2e 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index c909ce2fea..b9c149e5d8 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/access/qnetworkrequest.h b/src/network/access/qnetworkrequest.h index 66bfcf5942..1eb0fff045 100644 --- a/src/network/access/qnetworkrequest.h +++ b/src/network/access/qnetworkrequest.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -51,7 +51,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Network) class QSslConfiguration; diff --git a/src/network/access/qnetworkrequest_p.h b/src/network/access/qnetworkrequest_p.h index eb61f092f1..13861cc80e 100644 --- a/src/network/access/qnetworkrequest_p.h +++ b/src/network/access/qnetworkrequest_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ |