Merge "server status: bugfixes, and rid of version as a field."

This commit is contained in:
mpl 2013-06-09 17:12:11 +00:00 committed by Gerrit Code Review
commit 277795ad46
2 changed files with 5 additions and 7 deletions

View File

@ -27,7 +27,6 @@ import (
// StatusHandler publishes server status information.
type StatusHandler struct {
Version string
}
func init() {
@ -35,16 +34,14 @@ func init() {
}
func newStatusFromConfig(ld blobserver.Loader, conf jsonconfig.Obj) (h http.Handler, err error) {
sh := &StatusHandler{
Version: buildinfo.Version(),
}
return sh, nil
return &StatusHandler{}, nil
}
func (sh *StatusHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
suffix := req.Header.Get("X-PrefixHandler-PathSuffix")
if req.Method != "GET" {
http.Error(rw, "Illegal URL.", 404)
http.Error(rw, "Illegal URL.", http.StatusMethodNotAllowed)
return
}
if suffix == "status.json" {
sh.serveStatus(rw, req)
@ -59,7 +56,7 @@ type statusResponse struct {
func (sh *StatusHandler) serveStatus(rw http.ResponseWriter, req *http.Request) {
res := &statusResponse{
Version: sh.Version,
Version: buildinfo.Version(),
}
httputil.ReturnJSON(rw, res)

View File

@ -9,4 +9,5 @@
.cam-index-serverinfo {
display: inline;
float: right;
font-size: small;
}