From ad65fc87fae2b14e454ec80d890aa174bf5edfbf Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Wed, 9 Sep 2020 23:25:12 +0000 Subject: [PATCH] fix copy out --- http.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/http.go b/http.go index bcddd6d..32dcbc0 100644 --- a/http.go +++ b/http.go @@ -2,11 +2,11 @@ package main import ( "context" - "io/ioutil" "log" "net/http" "github.com/docker/docker/api/types" + "github.com/docker/docker/pkg/stdcopy" ) func checkAccessKey(r *http.Request) bool { @@ -46,15 +46,9 @@ func supervisorLogs(w http.ResponseWriter, r *http.Request) { } defer reader.Close() - //read the first 8 bytes to ignore the HEADER part from docker container logs - p := make([]byte, 8) - reader.Read(p) - // Return the content - content, _ := ioutil.ReadAll(reader) - w.Header().Add("Content-Type", "text/plain") - w.Write(content) + stdcopy.StdCopy(w, w, reader) } func supervisorRestart(w http.ResponseWriter, r *http.Request) {