Closed rvagg closed 1 year ago
I'm going to think on this, I might restructure it - currently the log middleware sits outside of HttpIpfsHandler, and this option applies to LogMiddleware, so maybe I should pull LogMiddleware inside of the HttpIpfsHandler. Or maybe it's better separated.
Will experiment next week in Boost. https://github.com/filecoin-project/boost/pull/1676/files#diff-97c1ef9ff5563153b5a77ec4f7ef6a2cff095580298bc9c1c7cad80ea778d01dR112
This ended up working on in https://github.com/filecoin-project/boost/pull/1737, it needed a couple of tweaks but I was able to reuse the LogMiddleware
and detect an underlying LoggingResponseWriter
response object and update its "wrote" bytes so we could even capture compression ratio in an entirely unrelated handler to the frisbii one. So it's turned out to be generically useful, outside of /ipfs
handling.
And it's fine as a separate middleware for now I think, no good reason to jumble things up here too much.
BREAKING CHANGE because the signatures of NewFrisbiiServer() and NewLogMiddleware() and NewLoggingResponseWriter() have changed.