mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-01 00:23:48 +03:00
fastcgi: Fix for handling errors that come from responder
This commit is contained in:
parent
27722463a7
commit
b51e8bc191
1 changed files with 4 additions and 1 deletions
|
@ -111,12 +111,15 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error)
|
|||
w.WriteHeader(resp.StatusCode)
|
||||
|
||||
// Write the response body
|
||||
// TODO: If this has an error, the response will already be
|
||||
// partly written. We should copy out of resp.Body into a buffer
|
||||
// first, then write it to the response...
|
||||
_, err = io.Copy(w, resp.Body)
|
||||
if err != nil {
|
||||
return http.StatusBadGateway, err
|
||||
}
|
||||
|
||||
return resp.StatusCode, nil
|
||||
return 0, nil
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue