fix #390. multiple response.WriteHeader when querying as admin

pull/310/head
John Shahid 2014-04-04 16:43:39 -04:00
parent bf9975be66
commit 886a036330
2 changed files with 10 additions and 2 deletions

View File

@ -16,6 +16,7 @@
- [Issue #404](https://github.com/influxdb/influxdb/issues/404). Filtering with invalid condition shouldn't crash the server
- [Issue #405](https://github.com/influxdb/influxdb/issues/405). Percentile shouldn't crash for small number of values
- [Issue #408](https://github.com/influxdb/influxdb/issues/408). Make InfluxDB recover from internal bugs and panics
- [Issue #390](https://github.com/influxdb/influxdb/issues/390). Multiple response.WriteHeader when querying as admin
- Close leveldb databases properly if we couldn't create a new Shard. See leveldb\_shard\_datastore\_test:131
## v0.5.4 [2014-04-02]

View File

@ -511,6 +511,10 @@ func (self *HttpServer) tryAsClusterAdmin(w libhttp.ResponseWriter, r *libhttp.R
return
}
statusCode, contentType, body := yieldUser(user, yield)
if statusCode < 0 {
return
}
if statusCode == libhttp.StatusUnauthorized {
w.Header().Add("WWW-Authenticate", "Basic realm=\"influxdb\"")
}
@ -678,9 +682,12 @@ func (self *HttpServer) tryAsDbUserAndClusterAdmin(w libhttp.ResponseWriter, r *
return
}
if statusCode > 0 {
w.WriteHeader(statusCode)
if statusCode < 0 {
return
}
w.WriteHeader(statusCode)
if len(body) > 0 {
w.Write(body)
}