QNetworkReplyHttpImpl: code cleanup
authorMartin Petersson <Martin.Petersson@nokia.com>
Wed, 23 May 2012 12:39:27 +0000 (14:39 +0200)
committerQt by Nokia <qt-info@nokia.com>
Thu, 24 May 2012 05:14:54 +0000 (07:14 +0200)
When the QNetworkAccessHttpBackend was merged into the
QNetworkReplyHttpImpl there was some code and comments comming from the
backend that was left in the new class. This removes some of these
leftovers from the QNetworkAccessHttpBackend.

Change-Id: Ifa118160438e2740fb9bf52907066096d8de9ae7
Reviewed-by: Markus Goetz <markus@woboq.com>
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
src/network/access/qnetworkreplyhttpimpl.cpp
src/network/access/qnetworkreplyhttpimpl_p.h

index 574a2ed..eb4edc8 100644 (file)
@@ -439,10 +439,8 @@ QNetworkReplyHttpImplPrivate::QNetworkReplyHttpImplPrivate()
     , resumeOffset(0)
     , preMigrationDownloaded(-1)
     , bytesDownloaded(0)
-    , lastBytesDownloaded(-1)
     , downloadBufferReadPosition(0)
     , downloadBufferCurrentSize(0)
-    , downloadBufferMaximumSize(0)
     , downloadZerocopyBuffer(0)
     , pendingDownloadDataEmissions(new QAtomicInt())
     , pendingDownloadProgressEmissions(new QAtomicInt())
@@ -644,7 +642,6 @@ void QNetworkReplyHttpImplPrivate::postRequest()
 
     // FIXME the proxy stuff should be done in the HTTP thread
     foreach (const QNetworkProxy &p, managerPrivate->queryProxy(QNetworkProxyQuery(request.url()))) {
-    //foreach (const QNetworkProxy &p, proxyList()) {
         // use the first proxy that works
         // for non-encrypted connections, any transparent or HTTP proxy
         // for encrypted, only transparent proxies
@@ -1016,7 +1013,6 @@ void QNetworkReplyHttpImplPrivate::replyDownloadData(QByteArray d)
     pendingDownloadDataCopy.clear();
 
     bytesDownloaded += bytesWritten;
-    lastBytesDownloaded = bytesDownloaded;
 
 
     QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader);
@@ -1056,8 +1052,6 @@ void QNetworkReplyHttpImplPrivate::checkForRedirect(const int statusCode)
         QUrl url = QUrl(QString::fromUtf8(header));
         if (!url.isValid())
             url = QUrl(QLatin1String(header));
-        // FIXME?
-        //redirectionRequested(url);
         q->setAttribute(QNetworkRequest::RedirectionTargetAttribute, url);
     }
 }
@@ -1069,17 +1063,16 @@ void QNetworkReplyHttpImplPrivate::replyDownloadMetaData
          qint64 contentLength)
 {
     Q_Q(QNetworkReplyHttpImpl);
+    Q_UNUSED(contentLength);
 
     statusCode = sc;
     reasonPhrase = rp;
 
     // Download buffer
     if (!db.isNull()) {
-        //setDownloadBuffer(db, contentLength);
         downloadBufferPointer = db;
         downloadZerocopyBuffer = downloadBufferPointer.data();
         downloadBufferCurrentSize = 0;
-        downloadBufferMaximumSize = contentLength;
         q->setAttribute(QNetworkRequest::DownloadBufferAttribute, QVariant::fromValue<QSharedPointer<char> > (downloadBufferPointer));
     }
 
@@ -1089,8 +1082,6 @@ void QNetworkReplyHttpImplPrivate::replyDownloadMetaData
     QList<QPair<QByteArray, QByteArray> > headerMap = hm;
     QList<QPair<QByteArray, QByteArray> >::ConstIterator it = headerMap.constBegin(),
                                                         end = headerMap.constEnd();
-    QByteArray header;
-
     for (; it != end; ++it) {
         QByteArray value = q->rawHeader(it->first);
         if (!value.isEmpty()) {
@@ -1182,7 +1173,6 @@ void QNetworkReplyHttpImplPrivate::replyDownloadProgressSlot(qint64 bytesReceive
     }
 
     bytesDownloaded = bytesReceived;
-    lastBytesDownloaded = bytesReceived;
 
     downloadBufferCurrentSize = bytesReceived;
 
@@ -1607,10 +1597,6 @@ void QNetworkReplyHttpImplPrivate::_q_startOperation()
         q_func()->setFinished(true);
     } else {
         if (state != Finished) {
-//            if (operation == QNetworkAccessManager::GetOperation)
-//                pendingNotifications.append(NotifyDownstreamReadyWrite);
-
-//            handleNotifications();
 
         }
     }
@@ -1630,8 +1616,6 @@ void QNetworkReplyHttpImplPrivate::_q_cacheLoadReadyRead()
     // metaDataChanged ?
 
 
-    // FIXME
-    lastBytesDownloaded = bytesDownloaded;
     QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader);
 
     // emit readyRead before downloadProgress incase this will cause events to be
index fb7dfb5..8c91177 100644 (file)
@@ -181,14 +181,11 @@ public:
 #endif
     void _q_finished();
 
-
-    // FIXME
     void finished();
     void error(QNetworkReply::NetworkError code, const QString &errorString);
     void _q_error(QNetworkReply::NetworkError code, const QString &errorString);
     void metaDataChanged();
 
-    void redirectionRequested(const QUrl &target);
     void checkForRedirect(const int statusCode);
 
 
@@ -219,7 +216,6 @@ public:
     void setCachingEnabled(bool enable);
     bool isCachingEnabled() const;
     void initCacheSaveDevice();
-    QAbstractNetworkCache *networkCache() const;
     QIODevice *cacheLoadDevice;
     bool loadingFromCache;
 
@@ -230,7 +226,6 @@ public:
     QUrl urlForLastAuthentication;
 #ifndef QT_NO_NETWORKPROXY
     QNetworkProxy lastProxyAuthentication;
-    QList<QNetworkProxy> proxyList;
 #endif
 
 
@@ -244,15 +239,11 @@ public:
     QByteDataBuffer downloadMultiBuffer;
     QByteDataBuffer pendingDownloadData; // For signal compression
     qint64 bytesDownloaded;
-    qint64 lastBytesDownloaded;
-    void setDownloadBuffer(QSharedPointer<char> sp, qint64 size);
-    char* getDownloadBuffer(qint64 size);
 
     // only used when the "zero copy" style is used. Else downloadMultiBuffer is used.
     // Please note that the whole "zero copy" download buffer API is private right now. Do not use it.
     qint64 downloadBufferReadPosition;
     qint64 downloadBufferCurrentSize;
-    qint64 downloadBufferMaximumSize;
     QSharedPointer<char> downloadBufferPointer;
     char* downloadZerocopyBuffer;