From 84d5c95f657f433e35eb297e4866b6682f2a75ad Mon Sep 17 00:00:00 2001 From: Simeng He Date: Mon, 10 May 2021 17:33:36 -0400 Subject: [PATCH] chunk encoding start --- ipn/ipnlocal/local.go | 2 ++ tsweb/jsonhandler.go | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index 6df575621..22792ee8b 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -10,6 +10,7 @@ "errors" "fmt" "io" + "log" "net" "net/http" "os" @@ -292,6 +293,7 @@ func (b *LocalBackend) Prefs() *ipn.Prefs { // Status returns the latest status of the backend and its // sub-components. func (b *LocalBackend) Status() *ipnstate.Status { + log.Println("Status ENDPOINT") sb := new(ipnstate.StatusBuilder) b.UpdateStatus(sb) return sb.Status() diff --git a/tsweb/jsonhandler.go b/tsweb/jsonhandler.go index 9b3a0378b..e3154cd5e 100644 --- a/tsweb/jsonhandler.go +++ b/tsweb/jsonhandler.go @@ -89,3 +89,11 @@ func (fn JSONHandlerFunc) ServeHTTPReturn(w http.ResponseWriter, r *http.Request w.Write(b) return err } + +// TODO() Set this function such that chunk encoding works +func (fn JSONHandlerFunc) ServeHTTPChunkEncodingReturn(w http.ResponseWriter, r *http.Request) error { + w.Header().Set("Connection", "Keep-Alive") + w.Header().Set("Transfer-Encoding", "chunked") + w.Header().Set("X-Content-Type-Options", "nosniff") + return nil +}