mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 04:31:37 +08:00
修复http拆包bug
This commit is contained in:
parent
40c1ea9b4c
commit
5aa64c3651
@ -75,7 +75,8 @@ splitPacket:
|
||||
|
||||
if(_content_len == 0){
|
||||
//尚未找到http头,缓存定位到剩余数据部分
|
||||
_remain_data.assign(ptr,remain);
|
||||
string str(ptr,remain);
|
||||
_remain_data = str;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -84,7 +85,8 @@ splitPacket:
|
||||
//数据按照固定长度content处理
|
||||
if(remain < _content_len){
|
||||
//数据不够,缓存定位到剩余数据部分
|
||||
_remain_data.assign(ptr,remain);
|
||||
string str(ptr,remain);
|
||||
_remain_data = str;
|
||||
return;
|
||||
}
|
||||
//收到content数据,并且接受content完毕
|
||||
@ -97,12 +99,14 @@ splitPacket:
|
||||
|
||||
if(remain > 0){
|
||||
//还有数据没有处理完毕
|
||||
_remain_data.assign(ptr,remain);
|
||||
string str(ptr,remain);
|
||||
_remain_data = str;
|
||||
|
||||
data = ptr = (char *)_remain_data.data();
|
||||
len = _remain_data.size();
|
||||
goto splitPacket;
|
||||
}
|
||||
_remain_data.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user