[Interest] QNetworkAccessManager put uploads contents twice

ashish dabhade ashishd157 at gmail.com
Mon Nov 30 12:10:14 CET 2015


Hi,

I'm trying to upload a file to Webdav using QNetworkAccessManager's **put**
method. But to the surprise it seems the file contents are uploaded
twice!!. Is this is known problem ? The Webdav is configured to allow Basic
Authentication. I supply the info when authenticationRequired is emitted.
Here is the sample code:

QFile *m_file = new QFile("SomeFile");
    if(!m_file->open(QIODevice::ReadOnly)) {
        m_file->deleteLater();
        return false;
    }

    QNetworkRequest request;
    request.setUrl(QUrl("WebdavUrl"));

    QNetWork *m_reply = put(request, m_file);
    connect(m_reply, SIGNAL(finished()), this, SLOT(onFinished()));
    connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), this,
SLOT(onNetworkError(QNetworkReply::NetworkError)));
    connect(m_reply, SIGNAL(uploadProgress(qint64,qint64)), this,
SLOT(onUploadProgress(qint64, qint64)));

And the sample output from uploadProgress:
File Size: 4193356 bytes

16384 4193356 <- Start of upload
1327104 4193356
2621440 4193356
3948544 4193356
4193356 4193356 <- End reached but finished() not emitted
393216 4193356 <- Starts again here
2408448 4193356
3620864 4193356
4193356 4193356 <- End reached and finished() emitted this time


I have tested this with Qt5 on both Linux and Windows.

Can someone else do a similar test ? I guess I'm not missing something
silly.


Regards,

Ashisd D
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151130/87e6e707/attachment.html>


More information about the Interest mailing list