Skip to content

Commit

Permalink
Correcting content-length for stripped response body
Browse files Browse the repository at this point in the history
  • Loading branch information
alnaeemi committed Feb 14, 2020
1 parent bb1f6cd commit 58b31d3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/http_proxy/http_proxy_base_sslstriper.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"net/url"
"regexp"
"strings"
"strconv"

"github.com/bettercap/bettercap/log"
"github.com/bettercap/bettercap/packets"
Expand Down Expand Up @@ -377,6 +378,8 @@ func (s *SSLStripper) Process(res *http.Response, ctx *goproxy.ProxyCtx) {
s.hosts.Track(hostOriginal, hostStripped)
}

res.Header.Set("Content-Length", strconv.Itoa(len(body)))

// reset the response body to the original unread state
// but with just a string reader, this way further calls
// to ioutil.ReadAll(res.Body) will just return the content
Expand Down

0 comments on commit 58b31d3

Please sign in to comment.