Closed chinajuanbob closed 4 years ago
Thanks for filling this issue. Currently, I mean to delete the content-length
field to avoid a certain situation to working with the distributed cache.
I will find out a solution to make it return with the content-length
field. BTW, may I know what error you encountered when the content-length
was not returned.
Hi @chinajuanbob,
I've made a fix for this issue. Would you like to test it? the latest release Is 0.3.3
Thanks for the quick update.
There is the Content-Length, however, I hit this stack print, and I'm not sure it is a bug or expected. In my opinion, a print error is enough.
{"level":"error","ts":1592821617.1456428,"logger":"http.handlers.http_cache","msg":"cache handler","error":"no precollect content"}
goroutine 311 [running]:
runtime/debug.Stack(0x212d112, 0x0, 0x0)
/usr/local/go/src/runtime/debug/stack.go:24 +0xab
runtime/debug.PrintStack()
/usr/local/go/src/runtime/debug/stack.go:16 +0x34
github.com/sillygod/cdp-cache.(*Handler).ServeHTTP(0xc0006a3040, 0x7f0c4591de50, 0xc0008a00a0, 0xc0004c9700, 0x3c2e920, 0xc00095a360, 0x0, 0x0)
/go/pkg/mod/github.com/sillygod/cdp-cache@v0.3.3/handler.go:328 +0x6f2
github.com/caddyserver/caddy/v2/modules/caddyhttp.wrapMiddleware.func1.1(0x7f0c4591de50, 0xc0008a00a0, 0xc0004c9700, 0xc00095a930, 0x3c2f8e0)
/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.0.0/modules/caddyhttp/routes.go:256 +0x7b
github.com/caddyserver/caddy/v2/modules/caddyhttp.HandlerFunc.ServeHTTP(0xc00095a390, 0x7f0c4591de50, 0xc0008a00a0, 0xc0004c9700, 0x0, 0x0)
/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.0.0/modules/caddyhttp/caddyhttp.go:58 +0x52
github.com/hairyhenderson/caddyprom.Metrics.ServeHTTP.func1(0x7f0c4591de50, 0xc0008a00a0, 0xc0004c9700)
/go/pkg/mod/github.com/hairyhenderson/caddyprom@v0.0.0-20200618131021-07fb0065894a/caddyprom.go:95 +0x72
net/http.HandlerFunc.ServeHTTP(0xc000520120, 0x7f0c4591de50, 0xc0008a00a0, 0xc0004c9700)
/usr/local/go/src/net/http/server.go:2012 +0x52
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerResponseSize.func1(0x7f0c4591de50, 0xc0008a0050, 0xc0004c9700)
/go/pkg/mod/github.com/prometheus/client_golang@v1.7.0/prometheus/promhttp/instrument_server.go:196 +0x105
net/http.HandlerFunc.ServeHTTP(0xc00095a5a0, 0x7f0c4591de50, 0xc0008a0050, 0xc0004c9700)
/usr/local/go/src/net/http/server.go:2012 +0x52
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func1(0x7f0c4591de50, 0xc0008a0000, 0xc0004c9700)
/go/pkg/mod/github.com/prometheus/client_golang@v1.7.0/prometheus/promhttp/instrument_server.go:68 +0x13d
net/http.HandlerFunc.ServeHTTP(0xc00095a750, 0x7f0c4591de50, 0xc0008a0000, 0xc0004c9700)
/usr/local/go/src/net/http/server.go:2012 +0x52
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1(0x3c4e040, 0xc0006f6380, 0xc0004c9700)
/go/pkg/mod/github.com/prometheus/client_golang@v1.7.0/prometheus/promhttp/instrument_server.go:100 +0xf9
net/http.HandlerFunc.ServeHTTP(...)
...
@chinajuanbob Yes, that's expected! I mean to do a trackback print here. In the future release, when this project is more concrete, I will make this to only print an error log with the stack.
Maybe, you can open another issue labeled as an enhancement to simply this error log.
config
output