mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 21:43:18 -07:00
Merge pull request #700 from alnaeemi/master
Correcting content-length for stripped response body
This commit is contained in:
commit
8ae28f4b3d
1 changed files with 3 additions and 0 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"
|
||||||
|
@ -377,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