885c0678 by astaxie

move filter wrong http method

1 parent d7a5281b
...@@ -578,6 +578,13 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) ...@@ -578,6 +578,13 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
578 return false 578 return false
579 } 579 }
580 580
581 // filter wrong httpmethod
582 if _, ok := HTTPMETHOD[r.Method]; !ok {
583 http.Error(w, "Method Not Allowed", 405)
584 goto Admin
585 }
586
587 // filter for static file
581 if do_filter(BeforeStatic) { 588 if do_filter(BeforeStatic) {
582 goto Admin 589 goto Admin
583 } 590 }
...@@ -595,11 +602,6 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) ...@@ -595,11 +602,6 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
595 }() 602 }()
596 } 603 }
597 604
598 if _, ok := HTTPMETHOD[r.Method]; !ok {
599 http.Error(w, "Method Not Allowed", 405)
600 goto Admin
601 }
602
603 if r.Method != "GET" && r.Method != "HEAD" { 605 if r.Method != "GET" && r.Method != "HEAD" {
604 if CopyRequestBody && !context.Input.IsUpload() { 606 if CopyRequestBody && !context.Input.IsUpload() {
605 context.Input.CopyBody() 607 context.Input.CopyBody()
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!