()
| 511 | } |
| 512 | |
| 513 | func (s *Session) delSession() { |
| 514 | if s.ctx == nil { |
| 515 | return |
| 516 | } |
| 517 | |
| 518 | // Get all relevant extractors |
| 519 | relevantExtractors := s.getExtractorInfo() |
| 520 | |
| 521 | // Delete session ID for each extractor type |
| 522 | for _, ext := range relevantExtractors { |
| 523 | switch ext.Source { |
| 524 | case extractors.SourceHeader: |
| 525 | s.ctx.Request().Header.Del(ext.Key) |
| 526 | s.ctx.Response().Header.Del(ext.Key) |
| 527 | case extractors.SourceCookie: |
| 528 | s.ctx.Request().Header.DelCookie(ext.Key) |
| 529 | s.ctx.Response().Header.DelCookie(ext.Key) |
| 530 | |
| 531 | fcookie := fasthttp.AcquireCookie() |
| 532 | |
| 533 | fcookie.SetKey(ext.Key) |
| 534 | fcookie.SetPath(s.config.CookiePath) |
| 535 | fcookie.SetDomain(s.config.CookieDomain) |
| 536 | fcookie.SetMaxAge(-1) |
| 537 | fcookie.SetExpire(time.Now().Add(-1 * time.Minute)) |
| 538 | |
| 539 | s.setCookieAttributes(fcookie) |
| 540 | s.ctx.Response().Header.SetCookie(fcookie) |
| 541 | fasthttp.ReleaseCookie(fcookie) |
| 542 | default: |
| 543 | // For non-cookie/header sources, do nothing (read-only) |
| 544 | } |
| 545 | } |
| 546 | } |
| 547 | |
| 548 | // setCookieAttributes sets the cookie attributes based on the session config. |
| 549 | func (s *Session) setCookieAttributes(fcookie *fasthttp.Cookie) { |
no test coverage detected