misc: small fix or general refactoring i did not bother commenting

This commit is contained in:
evilsocket 2018-03-14 11:25:42 +01:00
parent 7cf10ec0c7
commit d7d85c588a
No known key found for this signature in database
GPG key ID: 1564D7F30393A456

View file

@ -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 {