MCPcopy
hub / github.com/cloudflare/cloudflared / gzipUpdateHandler

Function gzipUpdateHandler

cmd/cloudflared/updater/workers_service_test.go:86–96  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

84}
85
86func gzipUpdateHandler(w http.ResponseWriter, r *http.Request) {
87 log.Println("got a request!")
88 version := "2020.09.02"
89 h := sha256.New()
90 fmt.Fprint(h, version)
91 checksum := fmt.Sprintf("%x", h.Sum(nil))
92
93 url := fmt.Sprintf("http://%s/gzip-download.tgz", r.Host)
94 v := VersionResponse{URL: url, Version: version, Checksum: checksum, ShouldUpdate: true}
95 respondWithJSON(w, v, http.StatusOK)
96}
97
98func compressedDownloadHandler(w http.ResponseWriter, r *http.Request) {
99 version := "2020.09.02"

Callers

nothing calls this directly

Calls 1

respondWithJSONFunction · 0.70

Tested by

no test coverage detected