From a59bdd08ca0b89b40cd542234fdbb688763df284 Mon Sep 17 00:00:00 2001 From: Fiisio Date: Wed, 6 Sep 2017 20:33:48 +0800 Subject: [PATCH] fastcgi: use bytes.Contains and strconv.Itoa (#1857) --- caddyhttp/fastcgi/fcgiclient_test.go | 2 +- caddyhttp/templates/templates.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/caddyhttp/fastcgi/fcgiclient_test.go b/caddyhttp/fastcgi/fcgiclient_test.go index ce897b10a..73cc0a2b7 100644 --- a/caddyhttp/fastcgi/fcgiclient_test.go +++ b/caddyhttp/fastcgi/fcgiclient_test.go @@ -155,7 +155,7 @@ func sendFcgi(reqType int, fcgiParams map[string]string, data []byte, posts map[ fcgi.Close() time.Sleep(1 * time.Second) - if bytes.Index(content, []byte("FAILED")) >= 0 { + if bytes.Contains(content, []byte("FAILED")) { globalt.Error("Server return failed message") } diff --git a/caddyhttp/templates/templates.go b/caddyhttp/templates/templates.go index 75e7ef852..53ead8f39 100644 --- a/caddyhttp/templates/templates.go +++ b/caddyhttp/templates/templates.go @@ -94,7 +94,7 @@ func (t Templates) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error rb.CopyHeader() // set the actual content length now that the template was executed - w.Header().Set("Content-Length", strconv.FormatInt(int64(buf.Len()), 10)) + w.Header().Set("Content-Length", strconv.Itoa(buf.Len())) // get the modification time in preparation to ServeContent modTime, _ := time.Parse(http.TimeFormat, w.Header().Get("Last-Modified"))