diff --git a/modules/http_proxy_base_cookietracker.go b/modules/http_proxy_base_cookietracker.go index bd82a33b..34369ce4 100644 --- a/modules/http_proxy_base_cookietracker.go +++ b/modules/http_proxy_base_cookietracker.go @@ -39,9 +39,6 @@ func (t *CookieTracker) keyOf(req *http.Request) string { } func (t *CookieTracker) IsClean(req *http.Request) bool { - // t.RLock() - // defer t.RUnlock() - // we only clean GET requests if req.Method != "GET" { return true @@ -53,6 +50,9 @@ func (t *CookieTracker) IsClean(req *http.Request) bool { return true } + t.RLock() + defer t.RUnlock() + // was it already processed? if _, found := t.set[t.keyOf(req)]; found == true { return true @@ -65,8 +65,7 @@ func (t *CookieTracker) IsClean(req *http.Request) bool { func (t *CookieTracker) Track(req *http.Request) { t.Lock() defer t.Unlock() - reqKey := t.keyOf(req) - t.set[reqKey] = true + t.set[t.keyOf(req)] = true } func (t *CookieTracker) Expire(req *http.Request) *http.Response {