Skip to content

Commit

Permalink
fix: allow eof in checkConnectMode
Browse files Browse the repository at this point in the history
  • Loading branch information
zema1 committed Jun 13, 2023
1 parent 690aeb4 commit 9877222
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ctrl/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (s *Suo5Config) parseHeader() error {
if len(parts) != 2 {
return fmt.Errorf("invalid header value %s", value)
}
s.Header.Set(parts[0], parts[1])
s.Header.Set(strings.TrimSpace(parts[0]), strings.TrimSpace(parts[1]))
}
return nil
}
Expand Down
3 changes: 2 additions & 1 deletion ctrl/ctrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ func checkConnectMode(method string, target string, baseHeader http.Header, prox
// 如果独到响应的时间在3s内,说明请求没有被缓存, 那么就可以变成全双工的
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return Undefined, 0, err
// 这里不要直接返回,有时虽然 eof 了但是数据是对的,可以使用
log.Warnf("got error %s", err)
}
duration := time.Since(now).Milliseconds()

Expand Down

0 comments on commit 9877222

Please sign in to comment.