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
2014-04-03 12:08:22 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5c019c7938df7ff8847c0f3509e1bd74f103fd54
5c019c79
1 parent
9c3ba680
implements api/v1/version, change to 0.9.43
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
92 行增加
和
4 行删除
trunk/src/app/srs_app_http_api.cpp
trunk/src/app/srs_app_http_api.hpp
trunk/src/core/srs_core.hpp
trunk/src/app/srs_app_http_api.cpp
查看文件 @
5c019c7
...
...
@@ -61,7 +61,7 @@ int SrsApiRoot::do_process_request(SrsSocket* skt, SrsHttpMessage* req)
ss
<<
JOBJECT_START
<<
JFIELD_ERROR
(
ERROR_SUCCESS
)
<<
JFIELD_CONT
<<
JFIELD_ORG
(
"urls"
,
JOBJECT_START
)
<<
JFIELD_STR
(
"
v1"
,
"the api version 1.0
"
)
<<
JFIELD_STR
(
"
api"
,
"the api root
"
)
<<
JOBJECT_END
<<
JOBJECT_END
;
...
...
@@ -70,6 +70,7 @@ int SrsApiRoot::do_process_request(SrsSocket* skt, SrsHttpMessage* req)
SrsApiApi
::
SrsApiApi
()
{
handlers
.
push_back
(
new
SrsApiV1
());
}
SrsApiApi
::~
SrsApiApi
()
...
...
@@ -83,8 +84,75 @@ bool SrsApiApi::can_handle(const char* path, int length, const char** /*pchild*/
int
SrsApiApi
::
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
)
{
std
::
string
body
=
"hello, api"
;
return
res_text
(
skt
,
body
);
std
::
stringstream
ss
;
ss
<<
JOBJECT_START
<<
JFIELD_ERROR
(
ERROR_SUCCESS
)
<<
JFIELD_CONT
<<
JFIELD_ORG
(
"urls"
,
JOBJECT_START
)
<<
JFIELD_STR
(
"v1"
,
"the api version 1.0"
)
<<
JOBJECT_END
<<
JOBJECT_END
;
return
res_json
(
skt
,
ss
.
str
());
}
SrsApiV1
::
SrsApiV1
()
{
handlers
.
push_back
(
new
SrsApiVersion
());
}
SrsApiV1
::~
SrsApiV1
()
{
}
bool
SrsApiV1
::
can_handle
(
const
char
*
path
,
int
length
,
const
char
**
/*pchild*/
)
{
return
srs_path_equals
(
"/v1"
,
path
,
length
);
}
int
SrsApiV1
::
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
)
{
std
::
stringstream
ss
;
ss
<<
JOBJECT_START
<<
JFIELD_ERROR
(
ERROR_SUCCESS
)
<<
JFIELD_CONT
<<
JFIELD_ORG
(
"urls"
,
JOBJECT_START
)
<<
JFIELD_STR
(
"version"
,
"the version of SRS"
)
<<
JOBJECT_END
<<
JOBJECT_END
;
return
res_json
(
skt
,
ss
.
str
());
}
SrsApiVersion
::
SrsApiVersion
()
{
}
SrsApiVersion
::~
SrsApiVersion
()
{
}
bool
SrsApiVersion
::
can_handle
(
const
char
*
path
,
int
length
,
const
char
**
/*pchild*/
)
{
return
srs_path_equals
(
"/version"
,
path
,
length
);
}
int
SrsApiVersion
::
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
)
{
std
::
stringstream
ss
;
ss
<<
JOBJECT_START
<<
JFIELD_ERROR
(
ERROR_SUCCESS
)
<<
JFIELD_CONT
<<
JFIELD_ORG
(
"data"
,
JOBJECT_START
)
<<
JFIELD_ORG
(
"major"
,
VERSION_MAJOR
)
<<
JFIELD_CONT
<<
JFIELD_ORG
(
"minor"
,
VERSION_MINOR
)
<<
JFIELD_CONT
<<
JFIELD_ORG
(
"revision"
,
VERSION_REVISION
)
<<
JFIELD_CONT
<<
JFIELD_STR
(
"version"
,
RTMP_SIG_SRS_VERSION
)
<<
JFIELD_CONT
<<
JFIELD_STR
(
"primary_authors"
,
RTMP_SIG_SRS_PRIMARY_AUTHROS
)
<<
JOBJECT_END
<<
JOBJECT_END
;
return
res_json
(
skt
,
ss
.
str
());
}
SrsHttpApi
::
SrsHttpApi
(
SrsServer
*
srs_server
,
st_netfd_t
client_stfd
,
SrsHttpHandler
*
_handler
)
...
...
trunk/src/app/srs_app_http_api.hpp
查看文件 @
5c019c7
...
...
@@ -62,6 +62,26 @@ public:
virtual
int
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
);
};
class
SrsApiV1
:
public
SrsHttpHandler
{
public
:
SrsApiV1
();
virtual
~
SrsApiV1
();
public
:
virtual
bool
can_handle
(
const
char
*
path
,
int
length
,
const
char
**
pchild
);
virtual
int
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
);
};
class
SrsApiVersion
:
public
SrsHttpHandler
{
public
:
SrsApiVersion
();
virtual
~
SrsApiVersion
();
public
:
virtual
bool
can_handle
(
const
char
*
path
,
int
length
,
const
char
**
pchild
);
virtual
int
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
);
};
class
SrsHttpApi
:
public
SrsConnection
{
private
:
...
...
trunk/src/core/srs_core.hpp
查看文件 @
5c019c7
...
...
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR "0"
#define VERSION_MINOR "9"
#define VERSION_REVISION "4
2
"
#define VERSION_REVISION "4
3
"
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
// server info.
#define RTMP_SIG_SRS_KEY "srs"
...
...
请
注册
或
登录
后发表评论