Details
Description
When using QNetworkAccessManager and disable buffering of upload data, after sending the first request, if the server side closes the connection, and the client side tries to send another request, it will get ContentReSendError via QNetworkReply.
Here is a test case:
#include <QNetworkAccessManager> #include <QNetworkRequest> #include <QNetworkReply> #include <QDebug> #include <QCoreApplication> #include <QUrl> #include <QTextStream> using namespace std; int main(int argc,char** argv) { QTextStream in(stdin,QIODevice::ReadOnly); QCoreApplication loop(argc,argv); QNetworkAccessManager manager; QByteArray content("123"); QNetworkRequest request(QUrl("http://www.yahoo.com")); request.setAttribute(QNetworkRequest::DoNotBufferUploadDataAttribute,QVariant(true)); while(1) { QNetworkReply* reply=manager.post(request,content); QObject::connect(reply,SIGNAL(finished()),&loop,SLOT(quit())); loop.exec(); QNetworkReply::NetworkError error=reply->error(); if(error!=QNetworkReply::NoError) qDebug()<<"error: "<<error; else qDebug()<<"success"; reply->deleteLater(); in.readLine(); } }
To test the above code, after seeing the "success" message, wait for about 30 seconds for the server side to close the connection, and then press enter to send the second request. An error message "error: 205" should then appear.
Since the connection is closed before the 2nd request is sent, instead of reporting ContentReSendError, it should have create another connection.