gin
gin copied to clipboard
Fix concurrent write bug in reader.Render
If a caller passed in a map retained within the caller's context as extraHeaders to gin.Context.DataFromReader() then a race to write the "Content-Lenght" header would occur.
// globalHeader is passed to gin.Context.DataFromReader var globalHeaders = map[string]string{ "cache-control": "public, max-age=3600", }
func (c *gin.Context) { //...
// DataFromReader must not write to globalHeaders
c.DataFromReader(code, contentLength, contentType, reader,
globalHeaders)
}
- With pull requests:
- Open your pull request against
master - Your pull request should have no more than two commits, if not you should squash them.
- It should pass all tests in the available continuous integration systems such as GitHub Actions.
- You should add/modify tests to cover your proposed code changes.
- If your pull request contains a new feature, please document it on the README.
- Open your pull request against