Fixed favicon.ico
This commit is contained in:
parent
88834e53ba
commit
fd5b9805de
2 changed files with 27 additions and 14 deletions
|
@ -32,6 +32,11 @@ namespace Mist {
|
|||
}
|
||||
|
||||
void OutHTTP::onFail(){
|
||||
// send logo icon
|
||||
if (H.url.length() > 4 && H.url.substr(H.url.length() - 4, 4) == ".ico"){
|
||||
sendIcon();
|
||||
return;
|
||||
}
|
||||
INFO_MSG("Failing: %s", H.url.c_str());
|
||||
if (H.url.size() >= 3 && H.url.substr(H.url.size() - 3) == ".js"){
|
||||
if (H.url.size() >= 5 && H.url.substr(0, 5) == "/json"){
|
||||
|
@ -250,20 +255,7 @@ namespace Mist {
|
|||
}
|
||||
// send logo icon
|
||||
if (H.url.length() > 4 && H.url.substr(H.url.length() - 4, 4) == ".ico"){
|
||||
H.Clean();
|
||||
#include "../icon.h"
|
||||
H.SetHeader("Content-Type", "image/x-icon");
|
||||
H.SetHeader("Server", "MistServer/" PACKAGE_VERSION);
|
||||
H.SetHeader("Content-Length", icon_len);
|
||||
H.setCORSHeaders();
|
||||
if(method == "OPTIONS" || method == "HEAD"){
|
||||
H.SendResponse("200", "OK", myConn);
|
||||
H.Clean();
|
||||
return;
|
||||
}
|
||||
H.SendResponse("200", "OK", myConn);
|
||||
myConn.SendNow((const char*)icon_data, icon_len);
|
||||
H.Clean();
|
||||
sendIcon();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -618,4 +610,24 @@ namespace Mist {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void OutHTTP::sendIcon(){
|
||||
std::string method = H.method;
|
||||
H.Clean();
|
||||
#include "../icon.h"
|
||||
H.SetHeader("Content-Type", "image/x-icon");
|
||||
H.SetHeader("Server", "MistServer/" PACKAGE_VERSION);
|
||||
H.SetHeader("Content-Length", icon_len);
|
||||
H.setCORSHeaders();
|
||||
if(method == "OPTIONS" || method == "HEAD"){
|
||||
H.SendResponse("200", "OK", myConn);
|
||||
H.Clean();
|
||||
return;
|
||||
}
|
||||
H.SendResponse("200", "OK", myConn);
|
||||
myConn.SendNow((const char*)icon_data, icon_len);
|
||||
H.Clean();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ namespace Mist {
|
|||
virtual void onFail();
|
||||
void onHTTP();
|
||||
bool isReadyForPlay();
|
||||
void sendIcon();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue