Web API: HTTP server: reduce debug message and put more interesting information

This commit is contained in:
f4exb 2018-08-11 23:29:38 +02:00
parent a0a23d3d73
commit b1b6b74681
1 changed files with 13 additions and 1 deletions

View File

@ -97,7 +97,9 @@ void HttpConnectionHandler::createSocket()
void HttpConnectionHandler::run()
{
#ifdef SUPERVERBOSE
qDebug("HttpConnectionHandler (%p): thread started", this);
#endif
try
{
exec();
@ -109,13 +111,17 @@ void HttpConnectionHandler::run()
socket->close();
delete socket;
readTimer.stop();
#ifdef SUPERVERBOSE
qDebug("HttpConnectionHandler (%p): thread stopped", this);
#endif
}
void HttpConnectionHandler::handleConnection(tSocketDescriptor socketDescriptor)
{
#ifdef SUPERVERBOSE
qDebug("HttpConnectionHandler (%p): handle new connection", this);
#endif
busy = true;
Q_ASSERT(socket->isOpen()==false); // if not, then the handler is already busy
@ -228,7 +234,11 @@ void HttpConnectionHandler::read()
if (currentRequest->getStatus()==HttpRequest::complete)
{
readTimer.stop();
qDebug("HttpConnectionHandler (%p): received request",this);
qDebug("HttpConnectionHandler (%p) received request from %s (%s) %s",
this,
qPrintable(currentRequest->getPeerAddress().toString()),
currentRequest->getMethod().toStdString().c_str(),
currentRequest->getPath().toStdString().c_str());
// Copy the Connection:close header to the response
HttpResponse response(socket);
@ -266,7 +276,9 @@ void HttpConnectionHandler::read()
response.write(QByteArray(),true);
}
#ifdef SUPERVERBOSE
qDebug("HttpConnectionHandler (%p): finished request",this);
#endif
// Find out whether the connection must be closed
if (!closeConnection)