8 Commits

Author SHA1 Message Date
Alex
50c29053dd Fix concurrent write bug in reader.Render
If a caller passed in a map retained within the callers 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)
}
2023-04-12 14:24:37 +02:00
thinkerou
4b68a5f12a
chore: update go.mod and remove space from copyright (#3158)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-28 10:42:28 +08:00
Dmitry Kutakov
b52a1a1588 allow empty headers on DataFromReader (#2121) 2019-11-25 10:45:53 +08:00
Segev Finer
20440b96b9 Support negative Content-Length in DataFromReader (#1981)
You can get an http.Response with ContentLength set to -1 (Chunked encoding), so
for DataFromReader to be useful for those we need to support that.
2019-08-05 09:42:59 +08:00
songjiayang
7b1081a73f issue_1721: fix render writeHeaders to make it the same as http.Header.Set (#1722) 2019-02-22 14:20:24 +08:00
田欧
d510595aa5 chore: add some annotations (#1544)
ref: #1075 
because I am not a native English, maybe have a bit problem.
2018-09-15 10:23:32 +08:00
田欧
b7bb9baa64
chore: add missing copyright and update if/else (#1497) 2018-08-19 22:52:43 +08:00
Jean-Christophe Lebreton
bf7803815b Serve easily dynamic files with DataFromReader context method (#1304)
* Add DataFromReader context method

* Replace fmt by strconv.FormatInt

* Add pull request link to README
2018-05-12 11:00:42 +08:00