mirror of
https://github.com/caddyserver/caddy.git
synced 2025-05-22 01:29:59 +08:00
fastcgi: Fix for handling errors that come from responder
This commit is contained in:
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user