mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -07:00
Update http_proxy_js_response.go
This commit is contained in:
parent
5e97fbb6eb
commit
25c6339275
1 changed files with 22 additions and 0 deletions
|
@ -76,6 +76,28 @@ func (j *JSResponse) WasModified() bool {
|
|||
return j.NewHash() != j.refHash
|
||||
}
|
||||
|
||||
func (j *JSResponse) CheckIfModifiedAndUpdateHash() bool {
|
||||
newHash := j.NewHash()
|
||||
// body was read
|
||||
if j.bodyRead {
|
||||
// body was read
|
||||
j.refHash = newHash
|
||||
return true
|
||||
} else if j.bodyClear {
|
||||
// body was cleared manually
|
||||
j.refHash = newHash
|
||||
return true
|
||||
} else if j.Body != "" {
|
||||
// body was not read but just set
|
||||
j.refHash = newHash
|
||||
return true
|
||||
}
|
||||
// check if res was changed and update its hash
|
||||
wasModified := j.refHash != newHash
|
||||
j.refHash = newHash
|
||||
return wasModified
|
||||
}
|
||||
|
||||
func (j *JSResponse) GetHeader(name, deflt string) string {
|
||||
headers := strings.Split(j.Headers, "\r\n")
|
||||
for i := 0; i < len(headers); i++ {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue