lox / httpcache

An RFC7234 compliant golang http.Handler for caching HTTP responses
MIT License
264 stars 28 forks source link

httpcache blocks until cacheable upstream responses are buffered into memory #20

Closed lox closed 8 years ago

lox commented 9 years ago

The handler.passUpstream method buffers the entire upstream response into memory and then returns it to the downstream client. This has two huge issues, firstly if the response is large, it can cause memory overruns, secondly the downstream client might timeout whilst waiting.

Ideally what should happen is just the upstream headers should be read, to determine storeability and then the body should be streamed to the downstream client and the cache in parallel.

lox commented 8 years ago

fscache (https://github.com/djherbis/fscache) would solve this nicely