Prevent panic in influxdb_listener (#4997)
This commit is contained in:
parent
17079288af
commit
d8e3c1d434
|
@ -254,12 +254,12 @@ func (h *HTTPListener) serveWrite(res http.ResponseWriter, req *http.Request) {
|
||||||
if req.Header.Get("Content-Encoding") == "gzip" {
|
if req.Header.Get("Content-Encoding") == "gzip" {
|
||||||
var err error
|
var err error
|
||||||
body, err = gzip.NewReader(req.Body)
|
body, err = gzip.NewReader(req.Body)
|
||||||
defer body.Close()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("D! " + err.Error())
|
log.Println("D! " + err.Error())
|
||||||
badRequest(res, err.Error())
|
badRequest(res, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
defer body.Close()
|
||||||
}
|
}
|
||||||
body = http.MaxBytesReader(res, body, h.MaxBodySize.Size)
|
body = http.MaxBytesReader(res, body, h.MaxBodySize.Size)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue