diff --git a/middleware/fastcgi/fcgiclient.go b/middleware/fastcgi/fcgiclient.go index b2d6ee8e9..8e6b780ab 100644 --- a/middleware/fastcgi/fcgiclient.go +++ b/middleware/fastcgi/fcgiclient.go @@ -375,21 +375,15 @@ func (c *FCGIClient) Request(p map[string]string, req io.Reader) (resp *http.Res resp.Header = http.Header(mimeHeader) if resp.Header.Get("Status") != "" { - - // check if Status is long enought to split - if strings.Count(resp.Header.Get("Status"), " ") > 0 { - statusParts := strings.SplitN(resp.Header.Get("Status"), " ", 2) - resp.StatusCode, err = strconv.Atoi(statusParts[0]) - resp.Status = statusParts[1] - resp.Status = statusParts[1] - } else { - resp.StatusCode, err = strconv.Atoi(resp.Header.Get("Status")) - } - + statusParts := strings.SplitN(resp.Header.Get("Status"), " ", 2) + resp.StatusCode, err = strconv.Atoi(statusParts[0]) if err != nil { return } - + if (len(statusParts) > 0) { + resp.Status = statusParts[1] + } + } else { resp.StatusCode = http.StatusOK } @@ -521,4 +515,4 @@ func (c *FCGIClient) PostFile(p map[string]string, data url.Values, file map[str } // Checks whether chunked is part of the encodings stack -func chunked(te []string) bool { return len(te) > 0 && te[0] == "chunked" } +func chunked(te []string) bool { return len(te) > 0 && te[0] == "chunked" } \ No newline at end of file