Fixed behaviour when stream cannot be loaded for JSON/JS and HTML page outputs
# Conflicts: # src/output/output_http_internal.cpp
This commit is contained in:
parent
6594f9bc94
commit
a1ea79af0c
1 changed files with 12 additions and 0 deletions
|
@ -44,6 +44,9 @@ namespace Mist {
|
||||||
if (H.url.size() >= 3 && H.url.substr(H.url.size() - 3) == ".js"){
|
if (H.url.size() >= 3 && H.url.substr(H.url.size() - 3) == ".js"){
|
||||||
JSON::Value json_resp;
|
JSON::Value json_resp;
|
||||||
json_resp["error"] = "Could not retrieve stream. Sorry.";
|
json_resp["error"] = "Could not retrieve stream. Sorry.";
|
||||||
|
if (config->getString("nostreamtext") != ""){
|
||||||
|
json_resp["on_error"] = config->getString("nostreamtext");
|
||||||
|
}
|
||||||
if (H.url.size() >= 5 && H.url.substr(0, 5) == "/json"){
|
if (H.url.size() >= 5 && H.url.substr(0, 5) == "/json"){
|
||||||
H.Clean();
|
H.Clean();
|
||||||
H.SetBody(json_resp.toString());
|
H.SetBody(json_resp.toString());
|
||||||
|
@ -224,6 +227,15 @@ namespace Mist {
|
||||||
void OutHTTP::HTMLResponse(){
|
void OutHTTP::HTMLResponse(){
|
||||||
std::string method = H.method;
|
std::string method = H.method;
|
||||||
HTTP::URL fullURL(H.GetHeader("Host"));
|
HTTP::URL fullURL(H.GetHeader("Host"));
|
||||||
|
/*LTS-START*/
|
||||||
|
if (config->getString("pubaddr") != ""){
|
||||||
|
HTTP::URL altURL(config->getString("pubaddr"));
|
||||||
|
fullURL.protocol = altURL.protocol;
|
||||||
|
if (altURL.host.size()){fullURL.host = altURL.host;}
|
||||||
|
fullURL.port = altURL.port;
|
||||||
|
fullURL.path = altURL.path;
|
||||||
|
}
|
||||||
|
/*LTS-END*/
|
||||||
std::string uAgent = H.GetHeader("User-Agent");
|
std::string uAgent = H.GetHeader("User-Agent");
|
||||||
H.Clean();
|
H.Clean();
|
||||||
H.SetHeader("Content-Type", "text/html");
|
H.SetHeader("Content-Type", "text/html");
|
||||||
|
|
Loading…
Add table
Reference in a new issue