Some content appears to cause panic
I've seen the following panic occur on retrieving context via the proxy, both in my own used of httpcache and via the cli sample (with modified listener port, e.g. 5000 instead of 80).
2016/08/11 14:16:55 [::1] "GET http://127.0.0.1:4000/notifications/recent HTTP/1.1" (OK) 32768 SKIP 131.157149ms >> GET /notifications/recent HTTP/1.1 >> Host: localhost:8080 >> Accept: */* >> User-Agent: curl/7.43.0 2016/08/11 14:16:56 GET /notifications/recent not in shared cache 2016/08/11 14:16:56 passing request upstream 2016/08/11 14:16:56 upstream responded headers in 129.992328ms 2016/08/11 14:16:56 resource is uncacheableI cannot pin down exactly what it is about the content that is causing the crash. The same server runs without error for a long time, but then certain pages being served through the cache cause it to panic almost everytime (sometimes the first fetch works).
Note the content causing the crash is not cacheable - the Cache-Control header is set to no-store.
I've attached a sample that crashes the proxy. Note that I can retrieve the content directly via curl or in a browser without error.
Environment information:
go version go version go1.6.2 darwin/amd64 go env GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="" GORACE="" GOROOT="/usr/local/go" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" GO15VENDOREXPERIMENT="1" CC="clang" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common" CXX="clang++" CGO_ENABLED="1"
As a general observation, this library (and any other solving this task) is a great fit for fuzzing with go-fuzz, it could find this issue and others like it.