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-06-08 17:28:39 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
19e1f610a35e1f4120a567d6d0386801f8ac2a24
19e1f610
1 parent
574cf6a0
merge from bravo, parse the http reponse in json of bravo system.
显示空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
32 行增加
和
2 行删除
trunk/src/app/srs_app_http_hooks.cpp
trunk/src/kernel/srs_kernel_error.hpp
trunk/src/app/srs_app_http_hooks.cpp
查看文件 @
19e1f61
...
...
@@ -433,11 +433,37 @@ int SrsHttpHooks::do_post(std::string url, std::string req, int& code, string& r
return
ERROR_HTTP_STATUS_INVLIAD
;
}
// TODO: FIXME: parse json.
if
(
res
.
empty
()
||
res
!=
SRS_HTTP_RESPONSE_OK
)
{
if
(
res
.
empty
())
{
return
ERROR_HTTP_DATA_INVLIAD
;
}
// parse string res to json.
SrsJsonAny
*
info
=
SrsJsonAny
::
loads
((
char
*
)
res
.
c_str
());
SrsAutoFree
(
SrsJsonAny
,
info
);
// if res is number of error code
if
(
!
info
->
is_object
())
{
if
(
res
!=
SRS_HTTP_RESPONSE_OK
)
{
return
ERROR_HTTP_DATA_INVLIAD
;
}
return
ret
;
}
// if res is json obj, like: {"code": 0, "data": ""}
SrsJsonObject
*
res_info
=
info
->
to_object
();
SrsJsonAny
*
res_code
=
NULL
;
if
((
res_code
=
res_info
->
ensure_property_integer
(
"code"
))
==
NULL
)
{
ret
=
ERROR_RESPONSE_CODE
;
srs_error
(
"res code error, ret=%d"
,
ret
);
return
ret
;
}
if
((
res_code
->
to_integer
())
!=
ERROR_SUCCESS
)
{
ret
=
ERROR_RESPONSE_CODE
;
srs_error
(
"res code error, ret=%d, code=%d"
,
ret
,
code
);
return
ret
;
}
return
ret
;
}
...
...
trunk/src/kernel/srs_kernel_error.hpp
查看文件 @
19e1f61
...
...
@@ -223,6 +223,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define ERROR_HDS_OPEN_FRAGMENT_FAILED 3060
#define ERROR_HDS_WRITE_FRAGMENT_FAILED 3061
#define ERROR_HLS_NO_STREAM 3062
#define ERROR_JSON_LOADS 3063
#define ERROR_RESPONSE_CODE 3064
///////////////////////////////////////////////////////
// HTTP/StreamCaster protocol error.
...
...
@@ -262,6 +264,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// user-define error.
///////////////////////////////////////////////////////
#define ERROR_USER_START 9000
#define ERROR_USER_DISCONNECT 9001
#define ERROR_SOURCE_NOT_FOUND 9002
#define ERROR_USER_END 9999
/**
...
...
请
注册
或
登录
后发表评论