正在显示
5 个修改的文件
包含
21 行增加
和
21 行删除
| @@ -129,9 +129,9 @@ http_api { | @@ -129,9 +129,9 @@ http_api { | ||
| 129 | # whether enable rpc reload. | 129 | # whether enable rpc reload. |
| 130 | # default: off | 130 | # default: off |
| 131 | allow_reload off; | 131 | allow_reload off; |
| 132 | - # whether enable rpc config_query. | 132 | + # whether enable rpc query. |
| 133 | # default: off | 133 | # default: off |
| 134 | - allow_config_query off; | 134 | + allow_query off; |
| 135 | } | 135 | } |
| 136 | } | 136 | } |
| 137 | # embeded http server in srs. | 137 | # embeded http server in srs. |
| @@ -1831,7 +1831,7 @@ int SrsConfig::raw_to_json(SrsAmf0Object* obj) | @@ -1831,7 +1831,7 @@ int SrsConfig::raw_to_json(SrsAmf0Object* obj) | ||
| 1831 | ssobj->set(ssdir->name, ssdir->dumps_arg0_to_boolean()); | 1831 | ssobj->set(ssdir->name, ssdir->dumps_arg0_to_boolean()); |
| 1832 | } else if (ssdir->name == "allow_reload") { | 1832 | } else if (ssdir->name == "allow_reload") { |
| 1833 | ssobj->set(ssdir->name, ssdir->dumps_arg0_to_boolean()); | 1833 | ssobj->set(ssdir->name, ssdir->dumps_arg0_to_boolean()); |
| 1834 | - } else if (ssdir->name == "allow_config_query") { | 1834 | + } else if (ssdir->name == "allow_query") { |
| 1835 | ssobj->set(ssdir->name, ssdir->dumps_arg0_to_boolean()); | 1835 | ssobj->set(ssdir->name, ssdir->dumps_arg0_to_boolean()); |
| 1836 | } | 1836 | } |
| 1837 | } | 1837 | } |
| @@ -2019,7 +2019,7 @@ int SrsConfig::check_config() | @@ -2019,7 +2019,7 @@ int SrsConfig::check_config() | ||
| 2019 | if (n == "raw_api") { | 2019 | if (n == "raw_api") { |
| 2020 | for (int j = 0; j < (int)obj->directives.size(); j++) { | 2020 | for (int j = 0; j < (int)obj->directives.size(); j++) { |
| 2021 | string m = obj->at(j)->name; | 2021 | string m = obj->at(j)->name; |
| 2022 | - if (m != "enabled" && m != "allow_reload" && m != "allow_config_query") { | 2022 | + if (m != "enabled" && m != "allow_reload" && m != "allow_query") { |
| 2023 | ret = ERROR_SYSTEM_CONFIG_INVALID; | 2023 | ret = ERROR_SYSTEM_CONFIG_INVALID; |
| 2024 | srs_error("unsupported http_api.raw_api directive %s, ret=%d", m.c_str(), ret); | 2024 | srs_error("unsupported http_api.raw_api directive %s, ret=%d", m.c_str(), ret); |
| 2025 | return ret; | 2025 | return ret; |
| @@ -4647,7 +4647,7 @@ bool SrsConfig::get_raw_api_allow_reload() | @@ -4647,7 +4647,7 @@ bool SrsConfig::get_raw_api_allow_reload() | ||
| 4647 | return SRS_CONF_PERFER_FALSE(conf->arg0()); | 4647 | return SRS_CONF_PERFER_FALSE(conf->arg0()); |
| 4648 | } | 4648 | } |
| 4649 | 4649 | ||
| 4650 | -bool SrsConfig::get_raw_api_allow_config_query() | 4650 | +bool SrsConfig::get_raw_api_allow_query() |
| 4651 | { | 4651 | { |
| 4652 | static bool DEFAULT = false; | 4652 | static bool DEFAULT = false; |
| 4653 | 4653 | ||
| @@ -4661,7 +4661,7 @@ bool SrsConfig::get_raw_api_allow_config_query() | @@ -4661,7 +4661,7 @@ bool SrsConfig::get_raw_api_allow_config_query() | ||
| 4661 | return DEFAULT; | 4661 | return DEFAULT; |
| 4662 | } | 4662 | } |
| 4663 | 4663 | ||
| 4664 | - conf = conf->get("allow_config_query"); | 4664 | + conf = conf->get("allow_query"); |
| 4665 | if (!conf || conf->arg0().empty()) { | 4665 | if (!conf || conf->arg0().empty()) { |
| 4666 | return DEFAULT; | 4666 | return DEFAULT; |
| 4667 | } | 4667 | } |
| @@ -1071,9 +1071,9 @@ public: | @@ -1071,9 +1071,9 @@ public: | ||
| 1071 | */ | 1071 | */ |
| 1072 | virtual bool get_raw_api_allow_reload(); | 1072 | virtual bool get_raw_api_allow_reload(); |
| 1073 | /** | 1073 | /** |
| 1074 | - * whether allow rpc config_query. | 1074 | + * whether allow rpc query. |
| 1075 | */ | 1075 | */ |
| 1076 | - virtual bool get_raw_api_allow_config_query(); | 1076 | + virtual bool get_raw_api_allow_query(); |
| 1077 | // http stream section | 1077 | // http stream section |
| 1078 | private: | 1078 | private: |
| 1079 | /** | 1079 | /** |
| @@ -845,7 +845,7 @@ SrsGoApiRaw::SrsGoApiRaw(SrsServer* svr) | @@ -845,7 +845,7 @@ SrsGoApiRaw::SrsGoApiRaw(SrsServer* svr) | ||
| 845 | 845 | ||
| 846 | raw_api = _srs_config->get_raw_api(); | 846 | raw_api = _srs_config->get_raw_api(); |
| 847 | allow_reload = _srs_config->get_raw_api_allow_reload(); | 847 | allow_reload = _srs_config->get_raw_api_allow_reload(); |
| 848 | - allow_config_query = _srs_config->get_raw_api_allow_config_query(); | 848 | + allow_query = _srs_config->get_raw_api_allow_query(); |
| 849 | 849 | ||
| 850 | _srs_config->subscribe(this); | 850 | _srs_config->subscribe(this); |
| 851 | } | 851 | } |
| @@ -868,7 +868,7 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | @@ -868,7 +868,7 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | ||
| 868 | 868 | ||
| 869 | // the rpc is required. | 869 | // the rpc is required. |
| 870 | std::string rpc = r->query_get("rpc"); | 870 | std::string rpc = r->query_get("rpc"); |
| 871 | - if (rpc.empty() || (rpc != "reload" && rpc != "config_query" && rpc != "raw")) { | 871 | + if (rpc.empty() || (rpc != "reload" && rpc != "query" && rpc != "raw")) { |
| 872 | ret = ERROR_SYSTEM_CONFIG_RAW; | 872 | ret = ERROR_SYSTEM_CONFIG_RAW; |
| 873 | srs_error("raw api invalid rpc=%s. ret=%d", rpc.c_str(), ret); | 873 | srs_error("raw api invalid rpc=%s. ret=%d", rpc.c_str(), ret); |
| 874 | return srs_api_response_code(w, r, ret); | 874 | return srs_api_response_code(w, r, ret); |
| @@ -903,16 +903,16 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | @@ -903,16 +903,16 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | ||
| 903 | return srs_api_response(w, r, obj->to_json()); | 903 | return srs_api_response(w, r, obj->to_json()); |
| 904 | } | 904 | } |
| 905 | 905 | ||
| 906 | - // for rpc=config_query, to get the configs of server. | 906 | + // for rpc=query, to get the configs of server. |
| 907 | // @param scope the scope to query for config, it can be: | 907 | // @param scope the scope to query for config, it can be: |
| 908 | // global, the configs belongs to the root, donot includes any sub directives. | 908 | // global, the configs belongs to the root, donot includes any sub directives. |
| 909 | // vhost, the configs for specified vhost by @param vhost. | 909 | // vhost, the configs for specified vhost by @param vhost. |
| 910 | // @param vhost the vhost name for @param scope is vhost to query config. | 910 | // @param vhost the vhost name for @param scope is vhost to query config. |
| 911 | // for the default vhost, must be __defaultVhost__ | 911 | // for the default vhost, must be __defaultVhost__ |
| 912 | - if (rpc == "config_query") { | ||
| 913 | - if (!allow_config_query) { | 912 | + if (rpc == "query") { |
| 913 | + if (!allow_query) { | ||
| 914 | ret = ERROR_SYSTEM_CONFIG_RAW_DISABLED; | 914 | ret = ERROR_SYSTEM_CONFIG_RAW_DISABLED; |
| 915 | - srs_error("raw api allow_config_query disabled rpc=%s. ret=%d", rpc.c_str(), ret); | 915 | + srs_error("raw api allow_query disabled rpc=%s. ret=%d", rpc.c_str(), ret); |
| 916 | return srs_api_response_code(w, r, ret); | 916 | return srs_api_response_code(w, r, ret); |
| 917 | } | 917 | } |
| 918 | 918 | ||
| @@ -920,7 +920,7 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | @@ -920,7 +920,7 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | ||
| 920 | std::string vhost = r->query_get("vhost"); | 920 | std::string vhost = r->query_get("vhost"); |
| 921 | if (scope.empty() || (scope != "global" && scope != "vhost")) { | 921 | if (scope.empty() || (scope != "global" && scope != "vhost")) { |
| 922 | ret = ERROR_SYSTEM_CONFIG_RAW_PARAMS; | 922 | ret = ERROR_SYSTEM_CONFIG_RAW_PARAMS; |
| 923 | - srs_error("raw api config_query invalid scope=%s. ret=%d", scope.c_str(), ret); | 923 | + srs_error("raw api query invalid scope=%s. ret=%d", scope.c_str(), ret); |
| 924 | return srs_api_response_code(w, r, ret); | 924 | return srs_api_response_code(w, r, ret); |
| 925 | } | 925 | } |
| 926 | 926 | ||
| @@ -928,7 +928,7 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | @@ -928,7 +928,7 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | ||
| 928 | // query vhost scope. | 928 | // query vhost scope. |
| 929 | if (vhost.empty()) { | 929 | if (vhost.empty()) { |
| 930 | ret = ERROR_SYSTEM_CONFIG_RAW_PARAMS; | 930 | ret = ERROR_SYSTEM_CONFIG_RAW_PARAMS; |
| 931 | - srs_error("raw api config_query vhost invalid vhost=%s. ret=%d", vhost.c_str(), ret); | 931 | + srs_error("raw api query vhost invalid vhost=%s. ret=%d", vhost.c_str(), ret); |
| 932 | return ret; | 932 | return ret; |
| 933 | } | 933 | } |
| 934 | 934 | ||
| @@ -936,14 +936,14 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | @@ -936,14 +936,14 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | ||
| 936 | SrsConfDirective* conf = root->get("vhost", vhost); | 936 | SrsConfDirective* conf = root->get("vhost", vhost); |
| 937 | if (!conf) { | 937 | if (!conf) { |
| 938 | ret = ERROR_SYSTEM_CONFIG_RAW_PARAMS; | 938 | ret = ERROR_SYSTEM_CONFIG_RAW_PARAMS; |
| 939 | - srs_error("raw api config_query vhost invalid vhost=%s. ret=%d", vhost.c_str(), ret); | 939 | + srs_error("raw api query vhost invalid vhost=%s. ret=%d", vhost.c_str(), ret); |
| 940 | return ret; | 940 | return ret; |
| 941 | } | 941 | } |
| 942 | 942 | ||
| 943 | SrsAmf0Object* data = SrsAmf0Any::object(); | 943 | SrsAmf0Object* data = SrsAmf0Any::object(); |
| 944 | obj->set("vhost", data); | 944 | obj->set("vhost", data); |
| 945 | if ((ret = _srs_config->vhost_to_json(conf, data)) != ERROR_SUCCESS) { | 945 | if ((ret = _srs_config->vhost_to_json(conf, data)) != ERROR_SUCCESS) { |
| 946 | - srs_error("raw api config_query vhost failed. ret=%d", ret); | 946 | + srs_error("raw api query vhost failed. ret=%d", ret); |
| 947 | return srs_api_response_code(w, r, ret); | 947 | return srs_api_response_code(w, r, ret); |
| 948 | } | 948 | } |
| 949 | } else { | 949 | } else { |
| @@ -952,7 +952,7 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | @@ -952,7 +952,7 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | ||
| 952 | 952 | ||
| 953 | // query global scope. | 953 | // query global scope. |
| 954 | if ((ret = _srs_config->global_to_json(data)) != ERROR_SUCCESS) { | 954 | if ((ret = _srs_config->global_to_json(data)) != ERROR_SUCCESS) { |
| 955 | - srs_error("raw api config_query global failed. ret=%d", ret); | 955 | + srs_error("raw api query global failed. ret=%d", ret); |
| 956 | return srs_api_response_code(w, r, ret); | 956 | return srs_api_response_code(w, r, ret); |
| 957 | } | 957 | } |
| 958 | } | 958 | } |
| @@ -967,7 +967,7 @@ int SrsGoApiRaw::on_reload_http_api_raw_api() | @@ -967,7 +967,7 @@ int SrsGoApiRaw::on_reload_http_api_raw_api() | ||
| 967 | { | 967 | { |
| 968 | raw_api = _srs_config->get_raw_api(); | 968 | raw_api = _srs_config->get_raw_api(); |
| 969 | allow_reload = _srs_config->get_raw_api_allow_reload(); | 969 | allow_reload = _srs_config->get_raw_api_allow_reload(); |
| 970 | - allow_config_query = _srs_config->get_raw_api_allow_config_query(); | 970 | + allow_query = _srs_config->get_raw_api_allow_query(); |
| 971 | 971 | ||
| 972 | return ERROR_SUCCESS; | 972 | return ERROR_SUCCESS; |
| 973 | } | 973 | } |
| @@ -186,7 +186,7 @@ private: | @@ -186,7 +186,7 @@ private: | ||
| 186 | private: | 186 | private: |
| 187 | bool raw_api; | 187 | bool raw_api; |
| 188 | bool allow_reload; | 188 | bool allow_reload; |
| 189 | - bool allow_config_query; | 189 | + bool allow_query; |
| 190 | public: | 190 | public: |
| 191 | SrsGoApiRaw(SrsServer* svr); | 191 | SrsGoApiRaw(SrsServer* svr); |
| 192 | virtual ~SrsGoApiRaw(); | 192 | virtual ~SrsGoApiRaw(); |
-
请 注册 或 登录 后发表评论