move session init before static
Showing
1 changed file
with
6 additions
and
6 deletions
| ... | @@ -459,6 +459,12 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) | ... | @@ -459,6 +459,12 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) |
| 459 | context.Output = beecontext.NewOutput(rw) | 459 | context.Output = beecontext.NewOutput(rw) |
| 460 | } | 460 | } |
| 461 | 461 | ||
| 462 | // session init | ||
| 463 | if SessionOn { | ||
| 464 | context.Input.CruSession = GlobalSessions.SessionStart(w, r) | ||
| 465 | defer context.Input.CruSession.SessionRelease() | ||
| 466 | } | ||
| 467 | |||
| 462 | if !utils.InSlice(strings.ToLower(r.Method), HTTPMETHOD) { | 468 | if !utils.InSlice(strings.ToLower(r.Method), HTTPMETHOD) { |
| 463 | http.Error(w, "Method Not Allowed", 405) | 469 | http.Error(w, "Method Not Allowed", 405) |
| 464 | goto Admin | 470 | goto Admin |
| ... | @@ -529,12 +535,6 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) | ... | @@ -529,12 +535,6 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) |
| 529 | } | 535 | } |
| 530 | } | 536 | } |
| 531 | 537 | ||
| 532 | // session init after static file | ||
| 533 | if SessionOn { | ||
| 534 | context.Input.CruSession = GlobalSessions.SessionStart(w, r) | ||
| 535 | defer context.Input.CruSession.SessionRelease() | ||
| 536 | } | ||
| 537 | |||
| 538 | if do_filter(AfterStatic) { | 538 | if do_filter(AfterStatic) { |
| 539 | goto Admin | 539 | goto Admin |
| 540 | } | 540 | } | ... | ... |
-
Please register or sign in to post a comment