mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 21:43:18 -07:00
perf: precompiling proxy script callbacks
This commit is contained in:
parent
8f22e4a30c
commit
b0ee042229
3 changed files with 88 additions and 62 deletions
|
@ -18,6 +18,27 @@ type JSResponse struct {
|
|||
resp *http.Response
|
||||
}
|
||||
|
||||
func NewJSResponse(res *http.Response) *JSResponse {
|
||||
cType := ""
|
||||
headers := ""
|
||||
|
||||
for name, values := range res.Header {
|
||||
for _, value := range values {
|
||||
if name == "Content-Type" {
|
||||
cType = value
|
||||
}
|
||||
headers += name + ": " + value + "\r\n"
|
||||
}
|
||||
}
|
||||
|
||||
return &JSResponse{
|
||||
Status: res.StatusCode,
|
||||
ContentType: cType,
|
||||
Headers: headers,
|
||||
resp: res,
|
||||
}
|
||||
}
|
||||
|
||||
func (j *JSResponse) Updated() {
|
||||
j.wasUpdated = true
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue