allow static .json files being served by HTTP port
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
* new "read" option "-n" for retrieving name/value pairs in numeric form
|
* new "read" option "-n" for retrieving name/value pairs in numeric form
|
||||||
* new "find" option "-e" for exactly matching name and optional circuit (ignoring case)
|
* new "find" option "-e" for exactly matching name and optional circuit (ignoring case)
|
||||||
* added numeric and verbose options to JSON and use "null" for unset or replacement value
|
* added numeric and verbose options to JSON and use "null" for unset or replacement value
|
||||||
|
* allow static ".json" files being served by HTTP port
|
||||||
* allow passing raw value when writing name/value pairs
|
* allow passing raw value when writing name/value pairs
|
||||||
|
|
||||||
## Changed files
|
## Changed files
|
||||||
|
|||||||
@@ -966,7 +966,7 @@ string MainLoop::executeGet(vector<string> &args, bool& connected)
|
|||||||
result << "HTTP/1.0 200 OK\r\n";
|
result << "HTTP/1.0 200 OK\r\n";
|
||||||
result << "Content-Type: application/json;charset=utf-8\r\n";
|
result << "Content-Type: application/json;charset=utf-8\r\n";
|
||||||
result << "Content-Length: " << setw(0) << dec << static_cast<unsigned>(str.length());
|
result << "Content-Length: " << setw(0) << dec << static_cast<unsigned>(str.length());
|
||||||
result << "\r\n\r\n";
|
result << "\r\nConnection: close\r\n\r\n";
|
||||||
result << str;
|
result << str;
|
||||||
return result.str();
|
return result.str();
|
||||||
}
|
}
|
||||||
@@ -994,6 +994,8 @@ string MainLoop::executeGet(vector<string> &args, bool& connected)
|
|||||||
type = 4;
|
type = 4;
|
||||||
} else if (ext == "svg") {
|
} else if (ext == "svg") {
|
||||||
type = 5;
|
type = 5;
|
||||||
|
} else if (ext == "json") {
|
||||||
|
type = 6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type < 0) {
|
if (type < 0) {
|
||||||
@@ -1026,6 +1028,9 @@ string MainLoop::executeGet(vector<string> &args, bool& connected)
|
|||||||
case 5:
|
case 5:
|
||||||
result << "image/svg+xml";
|
result << "image/svg+xml";
|
||||||
break;
|
break;
|
||||||
|
case 6:
|
||||||
|
result << "application/json;charset=utf-8";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
result << "text/html";
|
result << "text/html";
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user