[Qt-interest] ContentReSendError of QNetworkAccessManager
某人
hans.cs97 at nctu.edu.tw
Sun Apr 10 19:45:34 CEST 2011
Hello, when running the following small program, it will first show
"success", which is normal, but if I wait for about 30 seconds, press
enter, then I receive "error: 205" (ContentReSendError).
===============BEGIN=================
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QDebug>
#include <QApplication>
#include <QUrl>
#include <QVariant>
#include <QTextStream>
using namespace std;
int main(int argc,char** argv)
{
QTextStream in(stdin,QIODevice::ReadOnly);
QApplication app(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()),&app,SLOT(quit()));
app.exec();
QNetworkReply::NetworkError error=reply->error();
if(error!=QNetworkReply::NoError)
qDebug()<<"error: "<<error;
else
qDebug()<<"success";
reply->deleteLater();
in.readLine();
}
}
===============END=================
If I remove the DoNotBufferUploadDataAttribute setting, it will work normal.
I found that the signal is emitted from _q_startNextRequest() in
qhttpnetworkconnectionchannel.cpp
And I observed that it will send a FIN+ACK to close a connection when
the second request is send.
This behavior isn't normal, is it? Thanks.
I haved tried Qt 4.7.0 and 4.7.3, and the OS is Windows 7 x64.
More information about the Qt-interest-old
mailing list