Open jfesler opened 8 years ago
Thanks for the report, I'll investigate this. I've been trying to get a redesign of the internals of httpcache going, which should address some of these issues.
"On the bright side, the cache at least doesn't serve me the same chunk#1 as a cache hit; it instead calls it a miss and goes to the back end again on the subsequent query."
Ignore that bit; not relevant. Digging deeper into your code, my response is not giving enough of a reason to be isCacheable.
The chunking issue remains :-)
Narrowed down a bit more.
Chunked works fine if isCacheable(). Chunked fails if not isCacheable(); instead returns the first chunk, as a miss.
Thanks for your work with httpcache - no small effort!
I have found that the
Transfer-Encoding: chunked
behavior is broken. When sending a request throughhttpcache.NewHandler(httpcche.NewMemoryCache())
withhttputil.NewSingleHostReverseProxy
, that the cache returns only the first chunk.Without the cache, httputil.NewSingleHostReverseProxy properly fetches chunked content fine.
An example of chunked output from the web server I'm testing with:
And with curl, hitting that proxy directly, it works fine as well:
On the bright side, the cache at least doesn't serve me the same chunk#1 as a cache hit; it instead calls it a miss and goes to the back end again on the subsequent query.Unfortunately, I can't provide code samples, due to my current choice of employer. Which means I can't offer a PR either :-( For that I truly apologize.