April 25, 2020

Careful with io.TeeReader and json.Decoder

Some time ago, I was investigating very strange bug in our codebase: PROXY: ERROR: http: ContentLength=513 with Body length 512 It was inside our Go reverse proxy, and what was very suspicious was the exact 1 byte discrepancy. My suspicion was on gzip middleware, which is often the cause when you forget to set request.ContentLength after compressing the payload. However it turns out it was not the case. Do you see anything problematic here? Read more

Powered by Hugo & Kiss.