diff --git a/protocol/api/api.go b/protocol/api/api.go index 8e6f92b..a0ed15f 100755 --- a/protocol/api/api.go +++ b/protocol/api/api.go @@ -248,7 +248,6 @@ func (s *Server) handlePull(w http.ResponseWriter, req *http.Request) { delete(s.session, keyString) retString = fmt.Sprintf("

push url stop %s ok


", url) - res.Status = 400 res.Data = retString log.Debugf("pull stop return %s", retString) } else { @@ -257,11 +256,12 @@ func (s *Server) handlePull(w http.ResponseWriter, req *http.Request) { err = pullRtmprelay.Start() if err != nil { retString = fmt.Sprintf("push error=%v", err) + res.Status = 400 } else { s.session[keyString] = pullRtmprelay retString = fmt.Sprintf("

push url start %s ok


", url) } - res.Status = 400 + res.Data = retString log.Debugf("pull start return %s", retString) } @@ -292,6 +292,7 @@ func (s *Server) handlePush(w http.ResponseWriter, req *http.Request) { log.Debugf("control push: oper=%v, app=%v, name=%v, url=%v", oper, app, name, url) if (len(app) <= 0) || (len(name) <= 0) || (len(url) <= 0) { + res.Status = 400 res.Data = "control push parameter error, please check them." return } @@ -304,6 +305,7 @@ func (s *Server) handlePush(w http.ResponseWriter, req *http.Request) { pushRtmprelay, found := s.session[keyString] if !found { retString = fmt.Sprintf("

session key[%s] not exist, please check it again.

", keyString) + res.Status = 400 res.Data = retString return } @@ -320,6 +322,7 @@ func (s *Server) handlePush(w http.ResponseWriter, req *http.Request) { err = pushRtmprelay.Start() if err != nil { retString = fmt.Sprintf("push error=%v", err) + res.Status = 400 } else { retString = fmt.Sprintf("

push url start %s ok


", url) s.session[keyString] = pushRtmprelay