mirror of
https://github.com/containers/podman.git
synced 2025-06-29 15:08:09 +08:00
system service: do not close Body
The standard lib states that server handlers don't need to close the body, so let's not do that to avoid any unforeseen side effect. [NO TESTS NEEDED] - existing tests should suffice. Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
@ -895,7 +895,6 @@ func extractTarFile(r *http.Request) (string, error) {
|
|||||||
|
|
||||||
// Content-Length not used as too many existing API clients didn't honor it
|
// Content-Length not used as too many existing API clients didn't honor it
|
||||||
_, err = io.Copy(tarBall, r.Body)
|
_, err = io.Copy(tarBall, r.Body)
|
||||||
r.Body.Close()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("failed Request: Unable to copy tar file from request body %s", r.RequestURI)
|
return "", fmt.Errorf("failed Request: Unable to copy tar file from request body %s", r.RequestURI)
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,6 @@ func KubePlay(w http.ResponseWriter, r *http.Request) {
|
|||||||
options.Start = types.NewOptionalBool(query.Start)
|
options.Start = types.NewOptionalBool(query.Start)
|
||||||
}
|
}
|
||||||
report, err := containerEngine.PlayKube(r.Context(), r.Body, options)
|
report, err := containerEngine.PlayKube(r.Context(), r.Body, options)
|
||||||
_ = r.Body.Close()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utils.Error(w, http.StatusInternalServerError, fmt.Errorf("playing YAML file: %w", err))
|
utils.Error(w, http.StatusInternalServerError, fmt.Errorf("playing YAML file: %w", err))
|
||||||
return
|
return
|
||||||
@ -132,7 +131,6 @@ func KubePlayDown(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
containerEngine := abi.ContainerEngine{Libpod: runtime}
|
containerEngine := abi.ContainerEngine{Libpod: runtime}
|
||||||
report, err := containerEngine.PlayKubeDown(r.Context(), r.Body, entities.PlayKubeDownOptions{Force: query.Force})
|
report, err := containerEngine.PlayKubeDown(r.Context(), r.Body, entities.PlayKubeDownOptions{Force: query.Force})
|
||||||
_ = r.Body.Close()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utils.Error(w, http.StatusInternalServerError, fmt.Errorf("tearing down YAML file: %w", err))
|
utils.Error(w, http.StatusInternalServerError, fmt.Errorf("tearing down YAML file: %w", err))
|
||||||
return
|
return
|
||||||
|
Reference in New Issue
Block a user