Browse Source

Merge pull request #3721 from mitake/servevars

etcdserver: don't allow methods other than GET in /debug/vars
Xiang Li 10 years ago
parent
commit
eb7bce893e
1 changed files with 4 additions and 0 deletions
  1. 4 0
      etcdserver/etcdhttp/client.go

+ 4 - 0
etcdserver/etcdhttp/client.go

@@ -324,6 +324,10 @@ func (h *statsHandler) serveLeader(w http.ResponseWriter, r *http.Request) {
 }
 }
 
 
 func serveVars(w http.ResponseWriter, r *http.Request) {
 func serveVars(w http.ResponseWriter, r *http.Request) {
+	if !allowMethod(w, r.Method, "GET") {
+		return
+	}
+
 	w.Header().Set("Content-Type", "application/json; charset=utf-8")
 	w.Header().Set("Content-Type", "application/json; charset=utf-8")
 	fmt.Fprintf(w, "{\n")
 	fmt.Fprintf(w, "{\n")
 	first := true
 	first := true