headers timeout with response is nil

This commit is contained in:
gospider
2023-12-24 22:39:51 +08:00
parent 942d54c39d
commit bcc14683c4
2 changed files with 4 additions and 1 deletions

View File

@@ -143,7 +143,7 @@ func (obj *connecotr) taskMain(task *reqTask, waitBody bool) (retry bool) {
return false
}
if task.res == nil {
task.err = errors.New("response is nil")
task.err = task.ctx.Err()
obj.Close()
return false
}

View File

@@ -213,6 +213,9 @@ func (obj *roundTripper) poolRoundTrip(ctxData *reqCtxData, task *reqTask, key s
case <-task.emptyPool:
return true
case <-task.ctx.Done():
if task.err==nil{
task.err=task.ctx.Err()
}
return false
}
default: