diff --git a/modules/http_proxy_base_cookietracker.go b/modules/http_proxy_base_cookietracker.go index 7bc00b7a..bd82a33b 100644 --- a/modules/http_proxy_base_cookietracker.go +++ b/modules/http_proxy_base_cookietracker.go @@ -39,8 +39,8 @@ func (t *CookieTracker) keyOf(req *http.Request) string { } func (t *CookieTracker) IsClean(req *http.Request) bool { - t.RLock() - defer t.RUnlock() + // t.RLock() + // defer t.RUnlock() // we only clean GET requests if req.Method != "GET" { @@ -65,7 +65,8 @@ func (t *CookieTracker) IsClean(req *http.Request) bool { func (t *CookieTracker) Track(req *http.Request) { t.Lock() defer t.Unlock() - t.set[t.keyOf(req)] = true + reqKey := t.keyOf(req) + t.set[reqKey] = true } func (t *CookieTracker) Expire(req *http.Request) *http.Response { @@ -77,7 +78,7 @@ func (t *CookieTracker) Expire(req *http.Request) *http.Response { redir.Header.Add("Set-Cookie", fmt.Sprintf("%s=EXPIRED; path=/; domain=%s; Expires=Mon, 01-Jan-1990 00:00:00 GMT", c.Name, c.Domain)) } - redir.Header.Add("Location", req.URL.String()) + redir.Header.Add("Location", fmt.Sprintf("http://%s/", req.Host)) redir.Header.Add("Connection", "close") return redir diff --git a/modules/http_proxy_base_sslstriper.go b/modules/http_proxy_base_sslstriper.go index ef45dc02..f33d5963 100644 --- a/modules/http_proxy_base_sslstriper.go +++ b/modules/http_proxy_base_sslstriper.go @@ -280,9 +280,9 @@ func (s *SSLStripper) Preprocess(req *http.Request, ctx *goproxy.ProxyCtx) (redi req.Header.Set("Host", original.Hostname) } - // check if we need to redirect the user in order - // to make unknown session cookies expire if s.cookies.IsClean(req) == false { + // check if we need to redirect the user in order + // to make unknown session cookies expire log.Info("[%s] Sending expired cookies for %s to %s", core.Green("sslstrip"), core.Yellow(req.Host), req.RemoteAddr) s.cookies.Track(req) redir = s.cookies.Expire(req)