|
@ -717,6 +717,10 @@ func (h adminHandler) handleError(w http.ResponseWriter, r *http.Request, err er |
|
|
if err == nil { |
|
|
if err == nil { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
if err == errInternalRedir { |
|
|
|
|
|
h.serveHTTP(w, r) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
apiErr, ok := err.(APIError) |
|
|
apiErr, ok := err.(APIError) |
|
|
if !ok { |
|
|
if !ok { |
|
@ -896,7 +900,7 @@ func handleConfigID(w http.ResponseWriter, r *http.Request) error { |
|
|
parts = append([]string{expanded}, parts[3:]...) |
|
|
parts = append([]string{expanded}, parts[3:]...) |
|
|
r.URL.Path = path.Join(parts...) |
|
|
r.URL.Path = path.Join(parts...) |
|
|
|
|
|
|
|
|
return nil |
|
|
return errInternalRedir |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func handleStop(w http.ResponseWriter, r *http.Request) error { |
|
|
func handleStop(w http.ResponseWriter, r *http.Request) error { |
|
@ -1199,6 +1203,13 @@ var idRegexp = regexp.MustCompile(`(?m),?\s*"` + idKey + `"\s*:\s*(-?[0-9]+(\.[0 |
|
|
// pidfile is the name of the pidfile, if any.
|
|
|
// pidfile is the name of the pidfile, if any.
|
|
|
var pidfile string |
|
|
var pidfile string |
|
|
|
|
|
|
|
|
|
|
|
// errInternalRedir indicates an internal redirect
|
|
|
|
|
|
// and is useful when admin API handlers rewrite
|
|
|
|
|
|
// the request; in that case, authentication and
|
|
|
|
|
|
// authorization needs to happen again for the
|
|
|
|
|
|
// rewritten request.
|
|
|
|
|
|
var errInternalRedir = fmt.Errorf("internal redirect; re-authorization required") |
|
|
|
|
|
|
|
|
const ( |
|
|
const ( |
|
|
rawConfigKey = "config" |
|
|
rawConfigKey = "config" |
|
|
idKey = "@id" |
|
|
idKey = "@id" |
|
|