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-01-18 17:01:39 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
398b212bfa7a94917c0bd3bdf01bb49ee0d60efe
398b212b
1 parent
2742c0d3
for bug #277, refine code, support default http vhost.
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
12 行增加
和
5 行删除
trunk/src/app/srs_app_http.cpp
trunk/src/app/srs_app_http.hpp
trunk/src/app/srs_app_http.cpp
查看文件 @
398b212
...
...
@@ -286,6 +286,7 @@ int SrsGoHttpFileServer::serve_http(ISrsGoHttpResponseWriter* w, SrsHttpMessage*
string
fullpath
=
dir
+
"/"
;
// remove the virtual directory.
srs_assert
(
entry
);
size_t
pos
=
entry
->
pattern
.
find
(
"/"
);
if
(
upath
.
length
()
>
entry
->
pattern
.
length
()
&&
pos
!=
string
::
npos
)
{
...
...
@@ -296,6 +297,7 @@ int SrsGoHttpFileServer::serve_http(ISrsGoHttpResponseWriter* w, SrsHttpMessage*
srs_trace
(
"http match file=%s, pattern=%s, upath=%s"
,
fullpath
.
c_str
(),
entry
->
pattern
.
c_str
(),
upath
.
c_str
());
// handle file extension.
if
(
srs_string_ends_with
(
fullpath
,
".flv"
)
||
srs_string_ends_with
(
fullpath
,
".fhv"
))
{
std
::
string
start
=
r
->
query_get
(
"start"
);
if
(
start
.
empty
())
{
...
...
@@ -403,7 +405,6 @@ SrsGoHttpMuxEntry::~SrsGoHttpMuxEntry()
SrsGoHttpServeMux
::
SrsGoHttpServeMux
()
{
hosts
=
false
;
}
SrsGoHttpServeMux
::~
SrsGoHttpServeMux
()
...
...
@@ -414,6 +415,8 @@ SrsGoHttpServeMux::~SrsGoHttpServeMux()
srs_freep
(
entry
);
}
entries
.
clear
();
vhosts
.
clear
();
}
int
SrsGoHttpServeMux
::
initialize
()
...
...
@@ -444,8 +447,12 @@ int SrsGoHttpServeMux::handle(std::string pattern, ISrsGoHttpHandler* handler)
}
}
std
::
string
vhost
=
pattern
;
if
(
pattern
.
at
(
0
)
!=
'/'
)
{
hosts
=
true
;
if
(
pattern
.
find
(
"/"
)
!=
string
::
npos
)
{
vhost
=
pattern
.
substr
(
0
,
pattern
.
find
(
"/"
));
}
vhosts
[
vhost
]
=
handler
;
}
if
(
true
)
{
...
...
@@ -545,7 +552,7 @@ int SrsGoHttpServeMux::match(SrsHttpMessage* r, ISrsGoHttpHandler** ph)
std
::
string
path
=
r
->
path
();
// Host-specific pattern takes precedence over generic ones
if
(
hosts
)
{
if
(
!
vhosts
.
empty
()
&&
vhosts
.
find
(
r
->
host
())
!=
vhosts
.
end
()
)
{
path
=
r
->
host
()
+
path
;
}
...
...
trunk/src/app/srs_app_http.hpp
查看文件 @
398b212
...
...
@@ -266,8 +266,8 @@ class SrsGoHttpServeMux
{
private
:
std
::
map
<
std
::
string
,
SrsGoHttpMuxEntry
*>
entries
;
// whether any patterns contain hostnames
bool
hosts
;
// the vhost handler.
std
::
map
<
std
::
string
,
ISrsGoHttpHandler
*>
vhosts
;
public
:
SrsGoHttpServeMux
();
virtual
~
SrsGoHttpServeMux
();
...
...
请
注册
或
登录
后发表评论