mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-23 03:10:04 +08:00
优化代码
This commit is contained in:
parent
e99effc1d0
commit
3579a931a4
@ -141,18 +141,19 @@ int64_t HttpClient::onRecvHeader(const char *data, uint64_t len) {
|
|||||||
|
|
||||||
if(_parser["Content-Length"].empty()){
|
if(_parser["Content-Length"].empty()){
|
||||||
//没有Content-Length字段
|
//没有Content-Length字段
|
||||||
if(!_parser.Content().empty()){
|
if(_parser.Content().empty()){
|
||||||
//如果http回复未声明Content-Length字段,但是却有content内容,那说明可能是个不限长度的content
|
//content长度为0,本次http请求结束
|
||||||
_totalBodySize = INT64_MAX;
|
onResponseCompleted_l();
|
||||||
_recvedBodySize = 0;
|
return 0;
|
||||||
//返回-1代表不限制content回复大小
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
//content长度为0,本次http请求结束
|
//如果http回复未声明Content-Length字段,但是却有content内容,那说明可能是个不限长度的content
|
||||||
onResponseCompleted_l();
|
_totalBodySize = INT64_MAX;
|
||||||
return 0;
|
_recvedBodySize = 0;
|
||||||
|
//返回-1代表不限制content回复大小
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//有Content-Length字段
|
||||||
_recvedBodySize = 0;
|
_recvedBodySize = 0;
|
||||||
_totalBodySize = atoll(_parser["Content-Length"].data());
|
_totalBodySize = atoll(_parser["Content-Length"].data());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user