Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
ZLMediaKit
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
张翔宇
ZLMediaKit
Commits
0bf75529
Commit
0bf75529
authored
Dec 24, 2021
by
ziyue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HTTP: 确保http请求结束后不再触发超时事件
parent
f89abfaf
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
14 行增加
和
2 行删除
+14
-2
3rdpart/ZLToolKit
+1
-1
src/Http/HttpClient.cpp
+7
-1
src/Http/HttpClient.h
+6
-0
没有找到文件。
ZLToolKit
@
88bc73aa
Subproject commit
be36a8637a53c707e8cc293b66e153edde55afa1
Subproject commit
88bc73aa6b7e04e04ca45f4fdbe36d4e359088bf
src/Http/HttpClient.cpp
查看文件 @
0bf75529
...
...
@@ -100,6 +100,7 @@ void HttpClient::clear() {
}
void
HttpClient
::
clearResponse
()
{
_complete
=
false
;
_recved_body_size
=
0
;
_total_body_size
=
0
;
_parser
.
Clear
();
...
...
@@ -283,16 +284,21 @@ void HttpClient::onManager() {
onResponseCompleted_l
();
}
if
(
_timeout_second
>
0
&&
_total_timeout_ticker
.
elapsedTime
()
>
_timeout_second
*
1000
)
{
if
(
waitResponse
()
&&
_timeout_second
>
0
&&
_total_timeout_ticker
.
elapsedTime
()
>
_timeout_second
*
1000
)
{
//超时
shutdown
(
SockException
(
Err_timeout
,
"http request timeout"
));
}
}
void
HttpClient
::
onResponseCompleted_l
()
{
_complete
=
true
;
onResponseCompleted
();
}
bool
HttpClient
::
waitResponse
()
const
{
return
!
_complete
&&
alive
();
}
void
HttpClient
::
checkCookie
(
HttpClient
::
HttpHeader
&
headers
)
{
//Set-Cookie: IPTV_SERVER=8E03927B-CC8C-4389-BC00-31DBA7EC7B49;expires=Sun, Sep 23 2018 15:07:31 GMT;path=/index/api/
for
(
auto
it_set_cookie
=
headers
.
find
(
"Set-Cookie"
);
it_set_cookie
!=
headers
.
end
();
++
it_set_cookie
)
{
...
...
src/Http/HttpClient.h
查看文件 @
0bf75529
...
...
@@ -106,6 +106,11 @@ public:
*/
const
string
&
getUrl
()
const
;
/**
* 判断是否正在等待响应
*/
bool
waitResponse
()
const
;
protected
:
/**
* 收到http回复头
...
...
@@ -173,6 +178,7 @@ protected:
bool
_is_https
;
private
:
bool
_complete
=
false
;
string
_url
;
HttpHeader
_header
;
HttpBody
::
Ptr
_body
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论