Skip to content

Commit

Permalink
fix checkAltSvc check condition logic error
Browse files Browse the repository at this point in the history
  • Loading branch information
naiba committed Oct 17, 2023
1 parent 2b565e8 commit b885bd8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ func checkHttpResp(taskUrl string, start time.Time, resp *http.Response, err err
}
altSvc := resp.Header.Get("Alt-Svc")
if altSvc != "" {
checkAltSvc(altSvc, taskUrl, result)
checkAltSvc(start, altSvc, taskUrl, result)
} else {
result.Successful = true
}
Expand All @@ -425,7 +425,7 @@ func checkHttpResp(taskUrl string, start time.Time, resp *http.Response, err err
}
}

func checkAltSvc(altSvcStr string, taskUrl string, result *pb.TaskResult) {
func checkAltSvc(start time.Time, altSvcStr string, taskUrl string, result *pb.TaskResult) {
altSvcList, err := altsvc.Parse(altSvcStr)
if err != nil {
result.Data = err.Error()
Expand Down Expand Up @@ -467,9 +467,9 @@ func checkAltSvc(altSvcStr string, taskUrl string, result *pb.TaskResult) {
req.Header.Add("Upgrade", originalHost)
req.Header.Add("Connection", "Upgrade")

start := time.Now()
resp, err := httpClient.Do(req)
checkHttpResp(taskUrl, start, resp, err, result)

checkHttpResp(altAuthorityUrl, start, resp, err, result)
}

func handleCommandTask(task *pb.Task, result *pb.TaskResult) {
Expand Down

0 comments on commit b885bd8

Please sign in to comment.