Some prolem with slow connection. Qt 5.4 Win 7 x64
vedun opened this issue · comments
vedun commented
Greetings.
The following minimum code demonstrates the problem:
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
HttpServer server;
QObject::connect(&server, &HttpServer::requestReady,
[](HttpServerRequest &request, HttpServerResponse &res) {
qDebug() << "request body = " << request.readBody();
res.writeHead(200, "OK");
res.end("Hello World\n");
});
server.listen(QHostAddress::Any, 8000);
return a.exec();
}
When client sends POST request with some time pause between headers and request body, i see empty request body in handler.
Investigation of source has not yet led to a beautiful solution. Please advise how to act in a case where I need to use POST request data in handler?
Thank.
Vinícius dos Santos Oliveira commented
The data()
signal is emitted when a piece of body is received. Use readBody()
after data()
or end()
are emitted.