mirror of
https://github.com/bettercap/bettercap
synced 2025-08-22 06:23:18 -07:00
Correct Content-Length header
This commit is contained in:
parent
29656cdf25
commit
6c252d621d
1 changed files with 5 additions and 3 deletions
|
@ -8,6 +8,7 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/bettercap/bettercap/log"
|
"github.com/bettercap/bettercap/log"
|
||||||
"github.com/bettercap/bettercap/packets"
|
"github.com/bettercap/bettercap/packets"
|
||||||
|
@ -296,7 +297,6 @@ func (s *SSLStripper) fixResponseHeaders(res *http.Response) {
|
||||||
res.Header.Del("X-Download-Options")
|
res.Header.Del("X-Download-Options")
|
||||||
res.Header.Del("X-Permitted-Cross-Domain-Policies")
|
res.Header.Del("X-Permitted-Cross-Domain-Policies")
|
||||||
res.Header.Del("X-Xss-Protection")
|
res.Header.Del("X-Xss-Protection")
|
||||||
res.Header.Del("Content-Length")
|
|
||||||
res.Header.Set("Allow-Access-From-Same-Origin", "*")
|
res.Header.Set("Allow-Access-From-Same-Origin", "*")
|
||||||
res.Header.Set("Access-Control-Allow-Origin", "*")
|
res.Header.Set("Access-Control-Allow-Origin", "*")
|
||||||
res.Header.Set("Access-Control-Allow-Methods", "*")
|
res.Header.Set("Access-Control-Allow-Methods", "*")
|
||||||
|
@ -378,6 +378,8 @@ func (s *SSLStripper) Process(res *http.Response, ctx *goproxy.ProxyCtx) {
|
||||||
s.hosts.Track(hostOriginal, hostStripped)
|
s.hosts.Track(hostOriginal, hostStripped)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
res.Header.Set("Content-Length", strconv.Itoa(len(body)))
|
||||||
|
|
||||||
// reset the response body to the original unread state
|
// reset the response body to the original unread state
|
||||||
// but with just a string reader, this way further calls
|
// but with just a string reader, this way further calls
|
||||||
// to ioutil.ReadAll(res.Body) will just return the content
|
// to ioutil.ReadAll(res.Body) will just return the content
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue