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-04 23:06:27 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ef26e7756032f78acb7c3a9c9c5add339daa8be9
ef26e775
1 parent
00eda0d7
implements the http stream module.
显示空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
6 行增加
和
38 行删除
trunk/src/app/srs_app_http_conn.cpp
trunk/src/app/srs_app_http_conn.cpp
100644 → 100755
查看文件 @
ef26e77
...
...
@@ -85,53 +85,21 @@ bool SrsHttpRoot::can_handle(const char* path, int length, const char** pchild)
// for child to reparse the path.
*
pchild
=
path
;
// only compare the first char.
return
srs_path_equals
(
"/"
,
path
,
1
);
// never handle request for root.
return
false
;
}
bool
SrsHttpRoot
::
is_handler_valid
(
SrsHttpMessage
*
req
,
int
&
status_code
,
std
::
string
&
reason_phrase
)
{
if
(
!
SrsHttpHandler
::
is_handler_valid
(
req
,
status_code
,
reason_phrase
))
{
return
false
;
}
if
(
req
->
match
()
->
matched_url
.
length
()
!=
1
)
{
status_code
=
HTTP_NotFound
;
reason_phrase
=
HTTP_NotFound_str
;
status_code
=
HTTP_InternalServerError
;
reason_phrase
=
HTTP_InternalServerError_str
;
return
false
;
}
return
true
;
}
int
SrsHttpRoot
::
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
)
{
std
::
stringstream
ss
;
ss
<<
JOBJECT_START
<<
JFIELD_ERROR
(
ERROR_SUCCESS
)
<<
JFIELD_CONT
<<
JFIELD_ORG
(
"urls"
,
JOBJECT_START
);
vector
<
SrsHttpHandler
*>::
iterator
it
;
for
(
it
=
handlers
.
begin
();
it
!=
handlers
.
end
();
++
it
)
{
SrsHttpVhost
*
handler
=
dynamic_cast
<
SrsHttpVhost
*>
(
*
it
);
srs_assert
(
handler
);
ss
<<
JFIELD_ORG
(
handler
->
mount
(),
JOBJECT_START
)
<<
JFIELD_STR
(
"mount"
,
handler
->
mount
())
<<
JFIELD_CONT
<<
JFIELD_STR
(
"vhost"
,
handler
->
vhost
())
<<
JFIELD_CONT
<<
JFIELD_STR
(
"dir"
,
handler
->
dir
())
<<
JOBJECT_END
;
if
(
it
+
1
!=
handlers
.
end
())
{
ss
<<
JFIELD_CONT
;
}
}
ss
<<
JOBJECT_END
<<
JOBJECT_END
;
return
res_json
(
skt
,
req
,
ss
.
str
());
int
ret
=
ERROR_SUCCESS
;
return
ret
;
}
SrsHttpVhost
::
SrsHttpVhost
(
std
::
string
vhost
,
std
::
string
mount
,
std
::
string
dir
)
...
...
请
注册
或
登录
后发表评论