From 2707aa2818257d1a2a04e5f07605ec3b99d5c01f Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Thu, 14 Jan 2010 12:37:19 +0000 Subject: [PATCH] - Display favicon in Web UI --- src/httpconnection.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/httpconnection.cpp b/src/httpconnection.cpp index dd95fccb2..74a9b9e62 100644 --- a/src/httpconnection.cpp +++ b/src/httpconnection.cpp @@ -140,6 +140,21 @@ void HttpConnection::respond() return; } QString url = parser.url(); + // Favicon + if(url.endsWith("favicon.ico")) { + qDebug("Returning favicon"); + QFile favicon(":/Icons/skin/qbittorrent16.png"); + if(favicon.open(QIODevice::ReadOnly)) { + QByteArray data = favicon.readAll(); + generator.setStatusLine(200, "OK"); + generator.setContentTypeByExt("png"); + generator.setMessage(data); + write(); + } else { + respondNotFound(); + } + return; + } QStringList list = url.split('/', QString::SkipEmptyParts); if (list.contains(".") || list.contains("..")) {