/*---------------------------------------------------------------------------*/ QVariant HttpRecognizer::comment( IConnection* connection ) { Q_ASSERT (connection); if (!mConnections.contains( connection->networkInfo() )) return "No comment yet"; const HttpConnection con = mConnections.value( connection->networkInfo() ); const QHttpRequestHeader request = con.lastRequestHeader(); const QHttpResponseHeader response = con.lastResponseHeader(); return request.method() + " " + request.value( "host" ) + request.path() + (response.isValid() ? "\nHTTP " + QString::number( response.statusCode() ) + " " + response.reasonPhrase() : "" ); }
void DJDownloadManager::httpDone( bool error ) { djDebug() << "httpDone error = " << error << m_http->state(); djDebug() << "error string = "<<m_http->errorString(); if ( error ) { m_file->setFileName(""); } m_file->close(); m_progress->cancel(); if ( QHttp::Unconnected == m_http->state() ) { djDebug() << "emit fileFinished"; QHttpResponseHeader response = m_http->lastResponse(); int lastStatusCode = 0; if ( response.isValid() ) { lastStatusCode = response.statusCode(); } m_isDownloading = false; emit fileFinished( m_file, m_localFile, m_fileType, m_id, m_name, lastStatusCode ); }else { djDebug() << "close http"; m_http->close(); } }