mirror of
https://github.com/bettercap/bettercap
synced 2025-07-11 07:37:00 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
7cf10ec0c7
commit
d7d85c588a
1 changed files with 4 additions and 5 deletions
|
@ -39,9 +39,6 @@ func (t *CookieTracker) keyOf(req *http.Request) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *CookieTracker) IsClean(req *http.Request) bool {
|
func (t *CookieTracker) IsClean(req *http.Request) bool {
|
||||||
// t.RLock()
|
|
||||||
// defer t.RUnlock()
|
|
||||||
|
|
||||||
// we only clean GET requests
|
// we only clean GET requests
|
||||||
if req.Method != "GET" {
|
if req.Method != "GET" {
|
||||||
return true
|
return true
|
||||||
|
@ -53,6 +50,9 @@ func (t *CookieTracker) IsClean(req *http.Request) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.RLock()
|
||||||
|
defer t.RUnlock()
|
||||||
|
|
||||||
// was it already processed?
|
// was it already processed?
|
||||||
if _, found := t.set[t.keyOf(req)]; found == true {
|
if _, found := t.set[t.keyOf(req)]; found == true {
|
||||||
return true
|
return true
|
||||||
|
@ -65,8 +65,7 @@ func (t *CookieTracker) IsClean(req *http.Request) bool {
|
||||||
func (t *CookieTracker) Track(req *http.Request) {
|
func (t *CookieTracker) Track(req *http.Request) {
|
||||||
t.Lock()
|
t.Lock()
|
||||||
defer t.Unlock()
|
defer t.Unlock()
|
||||||
reqKey := t.keyOf(req)
|
t.set[t.keyOf(req)] = true
|
||||||
t.set[reqKey] = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *CookieTracker) Expire(req *http.Request) *http.Response {
|
func (t *CookieTracker) Expire(req *http.Request) *http.Response {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue