|
|
|
@ -194,7 +194,7 @@ srs_error_t SrsGoApiRoot::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage*
|
|
|
|
|
SrsAutoFree(SrsJsonObject, obj);
|
|
|
|
|
|
|
|
|
|
obj->set("code", SrsJsonAny::integer(ERROR_SUCCESS));
|
|
|
|
|
obj->set("server", SrsJsonAny::integer(stat->server_id()));
|
|
|
|
|
obj->set("server", SrsJsonAny::str(stat->server_id().c_str()));
|
|
|
|
|
|
|
|
|
|
SrsJsonObject* urls = SrsJsonAny::object();
|
|
|
|
|
obj->set("urls", urls);
|
|
|
|
@ -232,7 +232,7 @@ srs_error_t SrsGoApiApi::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage*
|
|
|
|
|
SrsAutoFree(SrsJsonObject, obj);
|
|
|
|
|
|
|
|
|
|
obj->set("code", SrsJsonAny::integer(ERROR_SUCCESS));
|
|
|
|
|
obj->set("server", SrsJsonAny::integer(stat->server_id()));
|
|
|
|
|
obj->set("server", SrsJsonAny::str(stat->server_id().c_str()));
|
|
|
|
|
|
|
|
|
|
SrsJsonObject* urls = SrsJsonAny::object();
|
|
|
|
|
obj->set("urls", urls);
|
|
|
|
@ -258,7 +258,7 @@ srs_error_t SrsGoApiV1::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r
|
|
|
|
|
SrsAutoFree(SrsJsonObject, obj);
|
|
|
|
|
|
|
|
|
|
obj->set("code", SrsJsonAny::integer(ERROR_SUCCESS));
|
|
|
|
|
obj->set("server", SrsJsonAny::integer(stat->server_id()));
|
|
|
|
|
obj->set("server", SrsJsonAny::str(stat->server_id().c_str()));
|
|
|
|
|
|
|
|
|
|
SrsJsonObject* urls = SrsJsonAny::object();
|
|
|
|
|
obj->set("urls", urls);
|
|
|
|
@ -307,7 +307,7 @@ srs_error_t SrsGoApiVersion::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessa
|
|
|
|
|
SrsAutoFree(SrsJsonObject, obj);
|
|
|
|
|
|
|
|
|
|
obj->set("code", SrsJsonAny::integer(ERROR_SUCCESS));
|
|
|
|
|
obj->set("server", SrsJsonAny::integer(stat->server_id()));
|
|
|
|
|
obj->set("server", SrsJsonAny::str(stat->server_id().c_str()));
|
|
|
|
|
|
|
|
|
|
SrsJsonObject* data = SrsJsonAny::object();
|
|
|
|
|
obj->set("data", data);
|
|
|
|
@ -336,7 +336,7 @@ srs_error_t SrsGoApiSummaries::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMes
|
|
|
|
|
SrsAutoFree(SrsJsonObject, obj);
|
|
|
|
|
|
|
|
|
|
obj->set("code", SrsJsonAny::integer(ERROR_SUCCESS));
|
|
|
|
|
obj->set("server", SrsJsonAny::integer(stat->server_id()));
|
|
|
|
|
obj->set("server", SrsJsonAny::str(stat->server_id().c_str()));
|
|
|
|
|
|
|
|
|
|
srs_api_dump_summaries(obj);
|
|
|
|
|
|
|
|
|
@ -359,7 +359,7 @@ srs_error_t SrsGoApiRusages::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessa
|
|
|
|
|
SrsAutoFree(SrsJsonObject, obj);
|
|
|
|
|
|
|
|
|
|
obj->set("code", SrsJsonAny::integer(ERROR_SUCCESS));
|
|
|
|
|
obj->set("server", SrsJsonAny::integer(stat->server_id()));
|
|
|
|
|
obj->set("server", SrsJsonAny::str(stat->server_id().c_str()));
|
|
|
|
|
|
|
|
|
|
SrsJsonObject* data = SrsJsonAny::object();
|
|
|
|
|
obj->set("data", data);
|
|
|
|
@ -404,7 +404,7 @@ srs_error_t SrsGoApiSelfProcStats::serve_http(ISrsHttpResponseWriter* w, ISrsHtt
|
|
|
|
|
SrsAutoFree(SrsJsonObject, obj);
|
|
|
|
|
|
|
|
|
|
obj->set("code", SrsJsonAny::integer(ERROR_SUCCESS));
|
|
|
|
|
obj->set("server", SrsJsonAny::integer(stat->server_id()));
|
|
|
|
|
obj->set("server", SrsJsonAny::str(stat->server_id().c_str()));
|
|
|
|
|
|
|
|
|
|
SrsJsonObject* data = SrsJsonAny::object();
|
|
|
|
|
obj->set("data", data);
|
|
|
|
@ -481,7 +481,7 @@ srs_error_t SrsGoApiSystemProcStats::serve_http(ISrsHttpResponseWriter* w, ISrsH
|
|
|
|
|
SrsAutoFree(SrsJsonObject, obj);
|
|
|
|
|
|
|
|
|
|
obj->set("code", SrsJsonAny::integer(ERROR_SUCCESS));
|
|
|
|
|
obj->set("server", SrsJsonAny::integer(stat->server_id()));
|
|
|
|
|
obj->set("server", SrsJsonAny::str(stat->server_id().c_str()));
|
|
|
|
|
|
|
|
|
|
SrsJsonObject* data = SrsJsonAny::object();
|
|
|
|
|
obj->set("data", data);
|
|
|
|
@ -520,7 +520,7 @@ srs_error_t SrsGoApiMemInfos::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMess
|
|
|
|
|
SrsAutoFree(SrsJsonObject, obj);
|
|
|
|
|
|
|
|
|
|
obj->set("code", SrsJsonAny::integer(ERROR_SUCCESS));
|
|
|
|
|
obj->set("server", SrsJsonAny::integer(stat->server_id()));
|
|
|
|
|
obj->set("server", SrsJsonAny::str(stat->server_id().c_str()));
|
|
|
|
|
|
|
|
|
|
SrsJsonObject* data = SrsJsonAny::object();
|
|
|
|
|
obj->set("data", data);
|
|
|
|
@ -560,7 +560,7 @@ srs_error_t SrsGoApiAuthors::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessa
|
|
|
|
|
SrsAutoFree(SrsJsonObject, obj);
|
|
|
|
|
|
|
|
|
|
obj->set("code", SrsJsonAny::integer(ERROR_SUCCESS));
|
|
|
|
|
obj->set("server", SrsJsonAny::integer(stat->server_id()));
|
|
|
|
|
obj->set("server", SrsJsonAny::str(stat->server_id().c_str()));
|
|
|
|
|
|
|
|
|
|
SrsJsonObject* data = SrsJsonAny::object();
|
|
|
|
|
obj->set("data", data);
|
|
|
|
@ -587,7 +587,7 @@ srs_error_t SrsGoApiFeatures::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMess
|
|
|
|
|
SrsAutoFree(SrsJsonObject, obj);
|
|
|
|
|
|
|
|
|
|
obj->set("code", SrsJsonAny::integer(ERROR_SUCCESS));
|
|
|
|
|
obj->set("server", SrsJsonAny::integer(stat->server_id()));
|
|
|
|
|
obj->set("server", SrsJsonAny::str(stat->server_id().c_str()));
|
|
|
|
|
|
|
|
|
|
SrsJsonObject* data = SrsJsonAny::object();
|
|
|
|
|
obj->set("data", data);
|
|
|
|
@ -655,7 +655,7 @@ srs_error_t SrsGoApiRequests::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMess
|
|
|
|
|
SrsAutoFree(SrsJsonObject, obj);
|
|
|
|
|
|
|
|
|
|
obj->set("code", SrsJsonAny::integer(ERROR_SUCCESS));
|
|
|
|
|
obj->set("server", SrsJsonAny::integer(stat->server_id()));
|
|
|
|
|
obj->set("server", SrsJsonAny::str(stat->server_id().c_str()));
|
|
|
|
|
|
|
|
|
|
SrsJsonObject* data = SrsJsonAny::object();
|
|
|
|
|
obj->set("data", data);
|
|
|
|
@ -699,10 +699,10 @@ srs_error_t SrsGoApiVhosts::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessag
|
|
|
|
|
|
|
|
|
|
// path: {pattern}{vhost_id}
|
|
|
|
|
// e.g. /api/v1/vhosts/100 pattern= /api/v1/vhosts/, vhost_id=100
|
|
|
|
|
std::string vid = r->parse_rest_id(entry->pattern);
|
|
|
|
|
string vid = r->parse_rest_id(entry->pattern);
|
|
|
|
|
SrsStatisticVhost* vhost = NULL;
|
|
|
|
|
|
|
|
|
|
if (vid != "" && (vhost = stat->find_vhost(vid)) == NULL) {
|
|
|
|
|
if (!vid.empty() && (vhost = stat->find_vhost_by_id(vid)) == NULL) {
|
|
|
|
|
return srs_api_response_code(w, r, ERROR_RTMP_VHOST_NOT_FOUND);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -710,7 +710,7 @@ srs_error_t SrsGoApiVhosts::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessag
|
|
|
|
|
SrsAutoFree(SrsJsonObject, obj);
|
|
|
|
|
|
|
|
|
|
obj->set("code", SrsJsonAny::integer(ERROR_SUCCESS));
|
|
|
|
|
obj->set("server", SrsJsonAny::integer(stat->server_id()));
|
|
|
|
|
obj->set("server", SrsJsonAny::str(stat->server_id().c_str()));
|
|
|
|
|
|
|
|
|
|
if (r->is_http_get()) {
|
|
|
|
|
if (!vhost) {
|
|
|
|
@ -755,10 +755,10 @@ srs_error_t SrsGoApiStreams::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessa
|
|
|
|
|
|
|
|
|
|
// path: {pattern}{stream_id}
|
|
|
|
|
// e.g. /api/v1/streams/100 pattern= /api/v1/streams/, stream_id=100
|
|
|
|
|
std::string sid = r->parse_rest_id(entry->pattern);
|
|
|
|
|
string sid = r->parse_rest_id(entry->pattern);
|
|
|
|
|
|
|
|
|
|
SrsStatisticStream* stream = NULL;
|
|
|
|
|
if (sid != "" && (stream = stat->find_stream(sid)) == NULL) {
|
|
|
|
|
if (!sid.empty() && (stream = stat->find_stream(sid)) == NULL) {
|
|
|
|
|
return srs_api_response_code(w, r, ERROR_RTMP_STREAM_NOT_FOUND);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -766,7 +766,7 @@ srs_error_t SrsGoApiStreams::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessa
|
|
|
|
|
SrsAutoFree(SrsJsonObject, obj);
|
|
|
|
|
|
|
|
|
|
obj->set("code", SrsJsonAny::integer(ERROR_SUCCESS));
|
|
|
|
|
obj->set("server", SrsJsonAny::integer(stat->server_id()));
|
|
|
|
|
obj->set("server", SrsJsonAny::str(stat->server_id().c_str()));
|
|
|
|
|
|
|
|
|
|
if (r->is_http_get()) {
|
|
|
|
|
if (!stream) {
|
|
|
|
@ -811,10 +811,10 @@ srs_error_t SrsGoApiClients::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessa
|
|
|
|
|
|
|
|
|
|
// path: {pattern}{client_id}
|
|
|
|
|
// e.g. /api/v1/clients/100 pattern= /api/v1/clients/, client_id=100
|
|
|
|
|
std::string client_id = r->parse_rest_id(entry->pattern);
|
|
|
|
|
string client_id = r->parse_rest_id(entry->pattern);
|
|
|
|
|
|
|
|
|
|
SrsStatisticClient* client = NULL;
|
|
|
|
|
if (client_id != "" && (client = stat->find_client(client_id)) == NULL) {
|
|
|
|
|
if (!client_id.empty() && (client = stat->find_client(client_id)) == NULL) {
|
|
|
|
|
return srs_api_response_code(w, r, ERROR_RTMP_CLIENT_NOT_FOUND);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -822,7 +822,7 @@ srs_error_t SrsGoApiClients::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessa
|
|
|
|
|
SrsAutoFree(SrsJsonObject, obj);
|
|
|
|
|
|
|
|
|
|
obj->set("code", SrsJsonAny::integer(ERROR_SUCCESS));
|
|
|
|
|
obj->set("server", SrsJsonAny::integer(stat->server_id()));
|
|
|
|
|
obj->set("server", SrsJsonAny::str(stat->server_id().c_str()));
|
|
|
|
|
|
|
|
|
|
if (r->is_http_get()) {
|
|
|
|
|
if (!client) {
|
|
|
|
|