@ -434,7 +434,16 @@ func (h *Handler) serveDebug(w http.ResponseWriter, r *http.Request) {
http . Error ( w , "POST required" , http . StatusMethodNotAllowed )
http . Error ( w , "POST required" , http . StatusMethodNotAllowed )
return
return
}
}
action := r . FormValue ( "action" )
// The action is normally in a POST form parameter, but
// some actions (like "notify") want a full JSON body, so
// permit some to have their action in a header.
var action string
switch v := r . Header . Get ( "Debug-Action" ) ; v {
case "notify" :
action = v
default :
action = r . FormValue ( "action" )
}
var err error
var err error
switch action {
switch action {
case "rebind" :
case "rebind" :
@ -455,6 +464,14 @@ func (h *Handler) serveDebug(w http.ResponseWriter, r *http.Request) {
// client already did. A future change will remove this, so don't depend
// client already did. A future change will remove this, so don't depend
// on it.
// on it.
h . b . RequestEngineStatus ( )
h . b . RequestEngineStatus ( )
case "notify" :
var n ipn . Notify
err = json . NewDecoder ( r . Body ) . Decode ( & n )
if err != nil {
break
}
h . b . DebugNotify ( n )
case "" :
case "" :
err = fmt . Errorf ( "missing parameter 'action'" )
err = fmt . Errorf ( "missing parameter 'action'" )
default :
default :