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-05-22 16:27:48 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c17a1198cb9992198422e63c1c1eadc3b5e235d8
c17a1198
1 parent
46a81372
fix #399, disconnect when not keep alive.
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
30 行增加
和
0 行删除
trunk/src/app/srs_app_http.cpp
trunk/src/app/srs_app_http.hpp
trunk/src/app/srs_app_http_api.cpp
trunk/src/app/srs_app_http_conn.cpp
trunk/src/app/srs_app_http.cpp
查看文件 @
c17a119
...
...
@@ -1082,6 +1082,7 @@ SrsHttpMessage::SrsHttpMessage(SrsStSocket* io, SrsConnection* c)
{
conn
=
c
;
chunked
=
false
;
keep_alive
=
true
;
_uri
=
new
SrsHttpUri
();
_body
=
new
SrsHttpResponseReader
(
this
,
io
);
_http_ts_send_buffer
=
new
char
[
SRS_HTTP_TS_SEND_BUFFER_SIZE
];
...
...
@@ -1106,6 +1107,9 @@ int SrsHttpMessage::update(string url, http_parser* header, SrsFastBuffer* body,
std
::
string
transfer_encoding
=
get_request_header
(
"Transfer-Encoding"
);
chunked
=
(
transfer_encoding
==
"chunked"
);
// whether keep alive.
keep_alive
=
http_should_keep_alive
(
header
);
// set the buffer.
if
((
ret
=
_body
->
initialize
(
body
))
!=
ERROR_SUCCESS
)
{
return
ret
;
...
...
@@ -1232,6 +1236,11 @@ bool SrsHttpMessage::is_chunked()
return
chunked
;
}
bool
SrsHttpMessage
::
is_keep_alive
()
{
return
keep_alive
;
}
string
SrsHttpMessage
::
uri
()
{
std
::
string
uri
=
_uri
->
get_schema
();
...
...
trunk/src/app/srs_app_http.hpp
查看文件 @
c17a119
...
...
@@ -495,6 +495,11 @@ private:
*/
bool
chunked
;
/**
* whether the request indicates should keep alive
* for the http connection.
*/
bool
keep_alive
;
/**
* uri parser
*/
SrsHttpUri
*
_uri
;
...
...
@@ -539,6 +544,10 @@ public:
*/
virtual
bool
is_chunked
();
/**
* whether should keep the connection alive.
*/
virtual
bool
is_keep_alive
();
/**
* the uri contains the host and path.
*/
virtual
std
::
string
uri
();
...
...
trunk/src/app/srs_app_http_api.cpp
查看文件 @
c17a119
...
...
@@ -555,6 +555,12 @@ int SrsHttpApi::do_cycle()
if
((
ret
=
process_request
(
&
writer
,
req
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
// donot keep alive, disconnect it.
// @see https://github.com/simple-rtmp-server/srs/issues/399
if
(
!
req
->
is_keep_alive
())
{
break
;
}
}
return
ret
;
...
...
trunk/src/app/srs_app_http_conn.cpp
查看文件 @
c17a119
...
...
@@ -1412,6 +1412,12 @@ int SrsHttpConn::do_cycle()
if
((
ret
=
process_request
(
&
writer
,
req
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
// donot keep alive, disconnect it.
// @see https://github.com/simple-rtmp-server/srs/issues/399
if
(
!
req
->
is_keep_alive
())
{
break
;
}
}
return
ret
;
...
...
请
注册
或
登录
后发表评论