Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2015-08-28 13:01:04 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f16761637981e74a262a23ad9669a071cfc77cc4
f1676163
1 parent
75ca759e
rename the config_query to query
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
21 行增加
和
21 行删除
trunk/conf/full.conf
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_config.hpp
trunk/src/app/srs_app_http_api.cpp
trunk/src/app/srs_app_http_api.hpp
trunk/conf/full.conf
查看文件 @
f167616
...
...
@@ -129,9 +129,9 @@ http_api {
# whether enable rpc reload.
# default: off
allow_reload
off
;
# whether enable rpc
config_
query.
# whether enable rpc query.
# default: off
allow_
config_
query
off
;
allow_query
off
;
}
}
# embeded http server in srs.
...
...
trunk/src/app/srs_app_config.cpp
查看文件 @
f167616
...
...
@@ -1831,7 +1831,7 @@ int SrsConfig::raw_to_json(SrsAmf0Object* obj)
ssobj
->
set
(
ssdir
->
name
,
ssdir
->
dumps_arg0_to_boolean
());
}
else
if
(
ssdir
->
name
==
"allow_reload"
)
{
ssobj
->
set
(
ssdir
->
name
,
ssdir
->
dumps_arg0_to_boolean
());
}
else
if
(
ssdir
->
name
==
"allow_
config_
query"
)
{
}
else
if
(
ssdir
->
name
==
"allow_query"
)
{
ssobj
->
set
(
ssdir
->
name
,
ssdir
->
dumps_arg0_to_boolean
());
}
}
...
...
@@ -2019,7 +2019,7 @@ int SrsConfig::check_config()
if
(
n
==
"raw_api"
)
{
for
(
int
j
=
0
;
j
<
(
int
)
obj
->
directives
.
size
();
j
++
)
{
string
m
=
obj
->
at
(
j
)
->
name
;
if
(
m
!=
"enabled"
&&
m
!=
"allow_reload"
&&
m
!=
"allow_
config_
query"
)
{
if
(
m
!=
"enabled"
&&
m
!=
"allow_reload"
&&
m
!=
"allow_query"
)
{
ret
=
ERROR_SYSTEM_CONFIG_INVALID
;
srs_error
(
"unsupported http_api.raw_api directive %s, ret=%d"
,
m
.
c_str
(),
ret
);
return
ret
;
...
...
@@ -4647,7 +4647,7 @@ bool SrsConfig::get_raw_api_allow_reload()
return
SRS_CONF_PERFER_FALSE
(
conf
->
arg0
());
}
bool
SrsConfig
::
get_raw_api_allow_
config_
query
()
bool
SrsConfig
::
get_raw_api_allow_query
()
{
static
bool
DEFAULT
=
false
;
...
...
@@ -4661,7 +4661,7 @@ bool SrsConfig::get_raw_api_allow_config_query()
return
DEFAULT
;
}
conf
=
conf
->
get
(
"allow_
config_
query"
);
conf
=
conf
->
get
(
"allow_query"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
return
DEFAULT
;
}
...
...
trunk/src/app/srs_app_config.hpp
查看文件 @
f167616
...
...
@@ -1071,9 +1071,9 @@ public:
*/
virtual
bool
get_raw_api_allow_reload
();
/**
* whether allow rpc
config_
query.
* whether allow rpc query.
*/
virtual
bool
get_raw_api_allow_
config_
query
();
virtual
bool
get_raw_api_allow_query
();
// http stream section
private:
/**
...
...
trunk/src/app/srs_app_http_api.cpp
查看文件 @
f167616
...
...
@@ -845,7 +845,7 @@ SrsGoApiRaw::SrsGoApiRaw(SrsServer* svr)
raw_api
=
_srs_config
->
get_raw_api
();
allow_reload
=
_srs_config
->
get_raw_api_allow_reload
();
allow_
config_query
=
_srs_config
->
get_raw_api_allow_config
_query
();
allow_
query
=
_srs_config
->
get_raw_api_allow
_query
();
_srs_config
->
subscribe
(
this
);
}
...
...
@@ -868,7 +868,7 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
// the rpc is required.
std
::
string
rpc
=
r
->
query_get
(
"rpc"
);
if
(
rpc
.
empty
()
||
(
rpc
!=
"reload"
&&
rpc
!=
"
config_
query"
&&
rpc
!=
"raw"
))
{
if
(
rpc
.
empty
()
||
(
rpc
!=
"reload"
&&
rpc
!=
"query"
&&
rpc
!=
"raw"
))
{
ret
=
ERROR_SYSTEM_CONFIG_RAW
;
srs_error
(
"raw api invalid rpc=%s. ret=%d"
,
rpc
.
c_str
(),
ret
);
return
srs_api_response_code
(
w
,
r
,
ret
);
...
...
@@ -903,16 +903,16 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
return
srs_api_response
(
w
,
r
,
obj
->
to_json
());
}
// for rpc=
config_
query, to get the configs of server.
// for rpc=query, to get the configs of server.
// @param scope the scope to query for config, it can be:
// global, the configs belongs to the root, donot includes any sub directives.
// vhost, the configs for specified vhost by @param vhost.
// @param vhost the vhost name for @param scope is vhost to query config.
// for the default vhost, must be __defaultVhost__
if
(
rpc
==
"config_query"
)
{
if
(
!
allow_config_query
)
{
if
(
rpc
==
"query"
)
{
if
(
!
allow_query
)
{
ret
=
ERROR_SYSTEM_CONFIG_RAW_DISABLED
;
srs_error
(
"raw api allow_
config_
query disabled rpc=%s. ret=%d"
,
rpc
.
c_str
(),
ret
);
srs_error
(
"raw api allow_query disabled rpc=%s. ret=%d"
,
rpc
.
c_str
(),
ret
);
return
srs_api_response_code
(
w
,
r
,
ret
);
}
...
...
@@ -920,7 +920,7 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
std
::
string
vhost
=
r
->
query_get
(
"vhost"
);
if
(
scope
.
empty
()
||
(
scope
!=
"global"
&&
scope
!=
"vhost"
))
{
ret
=
ERROR_SYSTEM_CONFIG_RAW_PARAMS
;
srs_error
(
"raw api
config_
query invalid scope=%s. ret=%d"
,
scope
.
c_str
(),
ret
);
srs_error
(
"raw api query invalid scope=%s. ret=%d"
,
scope
.
c_str
(),
ret
);
return
srs_api_response_code
(
w
,
r
,
ret
);
}
...
...
@@ -928,7 +928,7 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
// query vhost scope.
if
(
vhost
.
empty
())
{
ret
=
ERROR_SYSTEM_CONFIG_RAW_PARAMS
;
srs_error
(
"raw api
config_
query vhost invalid vhost=%s. ret=%d"
,
vhost
.
c_str
(),
ret
);
srs_error
(
"raw api query vhost invalid vhost=%s. ret=%d"
,
vhost
.
c_str
(),
ret
);
return
ret
;
}
...
...
@@ -936,14 +936,14 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
SrsConfDirective
*
conf
=
root
->
get
(
"vhost"
,
vhost
);
if
(
!
conf
)
{
ret
=
ERROR_SYSTEM_CONFIG_RAW_PARAMS
;
srs_error
(
"raw api
config_
query vhost invalid vhost=%s. ret=%d"
,
vhost
.
c_str
(),
ret
);
srs_error
(
"raw api query vhost invalid vhost=%s. ret=%d"
,
vhost
.
c_str
(),
ret
);
return
ret
;
}
SrsAmf0Object
*
data
=
SrsAmf0Any
::
object
();
obj
->
set
(
"vhost"
,
data
);
if
((
ret
=
_srs_config
->
vhost_to_json
(
conf
,
data
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"raw api
config_
query vhost failed. ret=%d"
,
ret
);
srs_error
(
"raw api query vhost failed. ret=%d"
,
ret
);
return
srs_api_response_code
(
w
,
r
,
ret
);
}
}
else
{
...
...
@@ -952,7 +952,7 @@ int SrsGoApiRaw::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
// query global scope.
if
((
ret
=
_srs_config
->
global_to_json
(
data
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"raw api
config_
query global failed. ret=%d"
,
ret
);
srs_error
(
"raw api query global failed. ret=%d"
,
ret
);
return
srs_api_response_code
(
w
,
r
,
ret
);
}
}
...
...
@@ -967,7 +967,7 @@ int SrsGoApiRaw::on_reload_http_api_raw_api()
{
raw_api
=
_srs_config
->
get_raw_api
();
allow_reload
=
_srs_config
->
get_raw_api_allow_reload
();
allow_
config_query
=
_srs_config
->
get_raw_api_allow_config
_query
();
allow_
query
=
_srs_config
->
get_raw_api_allow
_query
();
return
ERROR_SUCCESS
;
}
...
...
trunk/src/app/srs_app_http_api.hpp
查看文件 @
f167616
...
...
@@ -186,7 +186,7 @@ private:
private
:
bool
raw_api
;
bool
allow_reload
;
bool
allow_
config_
query
;
bool
allow_query
;
public
:
SrsGoApiRaw
(
SrsServer
*
svr
);
virtual
~
SrsGoApiRaw
();
...
...
请
注册
或
登录
后发表评论