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-09-27 14:18:02 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e0b1e044de0854deab0a655da8e601356c719a3d
e0b1e044
1 parent
63c9ad27
add stub code for bug #180, check complex handshake.
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
28 行增加
和
2 行删除
trunk/src/core/srs_core.hpp
trunk/src/rtmp/srs_protocol_handshake.cpp
trunk/src/core/srs_core.hpp
查看文件 @
e0b1e04
...
...
@@ -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 "21
7
"
#define VERSION_REVISION "21
8
"
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
...
...
trunk/src/rtmp/srs_protocol_handshake.cpp
查看文件 @
e0b1e04
...
...
@@ -1262,13 +1262,18 @@ int SrsComplexHandshake::handshake_with_server(SrsHandshakeBytes* /*hs_bytes*/,
int
SrsComplexHandshake
::
handshake_with_server
(
SrsHandshakeBytes
*
hs_bytes
,
ISrsProtocolReaderWriter
*
io
)
{
int
ret
=
ERROR_SUCCESS
;
// TODO: FIXME: check memory corrupt, for https://github.com/winlinvip/simple-rtmp-server/issues/180
SrsHandshakeBytes
*
ptr
=
hs_bytes
;
ssize_t
nsize
;
// complex handshake
if
((
ret
=
hs_bytes
->
create_c0c1
())
!=
ERROR_SUCCESS
)
{
return
ret
;
}
// TODO: FIXME: check memory corrupt, for https://github.com/winlinvip/simple-rtmp-server/issues/180
srs_assert
(
ptr
==
hs_bytes
);
// sign c1
c1s1
c1
;
...
...
@@ -1277,23 +1282,32 @@ int SrsComplexHandshake::handshake_with_server(SrsHandshakeBytes* hs_bytes, ISrs
return
ret
;
}
c1
.
dump
(
hs_bytes
->
c0c1
+
1
);
// TODO: FIXME: check memory corrupt, for https://github.com/winlinvip/simple-rtmp-server/issues/180
srs_assert
(
ptr
==
hs_bytes
);
// verify c1
bool
is_valid
;
if
((
ret
=
c1
.
c1_validate_digest
(
is_valid
))
!=
ERROR_SUCCESS
||
!
is_valid
)
{
ret
=
ERROR_RTMP_TRY_SIMPLE_HS
;
return
ret
;
}
// TODO: FIXME: check memory corrupt, for https://github.com/winlinvip/simple-rtmp-server/issues/180
srs_assert
(
ptr
==
hs_bytes
);
if
((
ret
=
io
->
write
(
hs_bytes
->
c0c1
,
1537
,
&
nsize
))
!=
ERROR_SUCCESS
)
{
srs_warn
(
"write c0c1 failed. ret=%d"
,
ret
);
return
ret
;
}
srs_verbose
(
"write c0c1 success."
);
// TODO: FIXME: check memory corrupt, for https://github.com/winlinvip/simple-rtmp-server/issues/180
srs_assert
(
ptr
==
hs_bytes
);
// s0s1s2
if
((
ret
=
hs_bytes
->
read_s0s1s2
(
io
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
// TODO: FIXME: check memory corrupt, for https://github.com/winlinvip/simple-rtmp-server/issues/180
srs_assert
(
ptr
==
hs_bytes
);
// plain text required.
if
(
hs_bytes
->
s0s1s2
[
0
]
!=
0x03
)
{
...
...
@@ -1301,12 +1315,16 @@ int SrsComplexHandshake::handshake_with_server(SrsHandshakeBytes* hs_bytes, ISrs
srs_warn
(
"handshake failed, plain text required. ret=%d"
,
ret
);
return
ret
;
}
// TODO: FIXME: check memory corrupt, for https://github.com/winlinvip/simple-rtmp-server/issues/180
srs_assert
(
ptr
==
hs_bytes
);
// verify s1s2
c1s1
s1
;
if
((
ret
=
s1
.
parse
(
hs_bytes
->
s0s1s2
+
1
,
c1
.
schema
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
// TODO: FIXME: check memory corrupt, for https://github.com/winlinvip/simple-rtmp-server/issues/180
srs_assert
(
ptr
==
hs_bytes
);
// never verify the s1,
// for if forward to nginx-rtmp, verify s1 will failed,
...
...
@@ -1316,16 +1334,24 @@ int SrsComplexHandshake::handshake_with_server(SrsHandshakeBytes* hs_bytes, ISrs
if
((
ret
=
hs_bytes
->
create_c2
())
!=
ERROR_SUCCESS
)
{
return
ret
;
}
// TODO: FIXME: check memory corrupt, for https://github.com/winlinvip/simple-rtmp-server/issues/180
srs_assert
(
ptr
==
hs_bytes
);
c2s2
c2
;
if
((
ret
=
c2
.
c2_create
(
&
s1
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
// TODO: FIXME: check memory corrupt, for https://github.com/winlinvip/simple-rtmp-server/issues/180
srs_assert
(
ptr
==
hs_bytes
);
c2
.
dump
(
hs_bytes
->
c2
);
if
((
ret
=
io
->
write
(
hs_bytes
->
c2
,
1536
,
&
nsize
))
!=
ERROR_SUCCESS
)
{
srs_warn
(
"complex handshake write c2 failed. ret=%d"
,
ret
);
return
ret
;
}
srs_verbose
(
"complex handshake write c2 success."
);
// TODO: FIXME: check memory corrupt, for https://github.com/winlinvip/simple-rtmp-server/issues/180
srs_assert
(
ptr
==
hs_bytes
);
srs_trace
(
"complex handshake success."
);
...
...
请
注册
或
登录
后发表评论