mirror of
https://github.com/caddyserver/caddy.git
synced 2026-08-27 04:07:28 +00:00
Replace strings.Index usages with strings.Cut (#4930)
This commit is contained in:
parent
17ae5acaba
commit
2642bd72b7
8 changed files with 32 additions and 33 deletions
|
|
@ -424,13 +424,13 @@ func (c *FCGIClient) Request(p map[string]string, req io.Reader) (resp *http.Res
|
|||
resp.Header = http.Header(mimeHeader)
|
||||
|
||||
if resp.Header.Get("Status") != "" {
|
||||
statusParts := strings.SplitN(resp.Header.Get("Status"), " ", 2)
|
||||
resp.StatusCode, err = strconv.Atoi(statusParts[0])
|
||||
statusNumber, statusInfo, statusIsCut := strings.Cut(resp.Header.Get("Status"), " ")
|
||||
resp.StatusCode, err = strconv.Atoi(statusNumber)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if len(statusParts) > 1 {
|
||||
resp.Status = statusParts[1]
|
||||
if statusIsCut {
|
||||
resp.Status = statusInfo
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue