Skip to content

Commit

Permalink
Remove br encoding (#523)
Browse files Browse the repository at this point in the history
* remove br encoding

* minor
  • Loading branch information
dogancanbakir authored Apr 9, 2024
1 parent 338e39e commit 1a55878
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"github.com/projectdiscovery/tinydns"
errorutil "github.com/projectdiscovery/utils/errors"
readerUtil "github.com/projectdiscovery/utils/reader"
sliceutil "github.com/projectdiscovery/utils/slice"
stringsutil "github.com/projectdiscovery/utils/strings"
"golang.org/x/net/proxy"
)
Expand Down Expand Up @@ -239,10 +240,18 @@ func (p *Proxy) ModifyRequest(req *http.Request) error {
if len(p.options.RequestMatchReplaceDSL) != 0 {
_ = p.MatchReplaceRequest(req)
}
p.removeBrEncoding(req)
_ = p.logger.LogRequest(req, userData)
return nil
}

func (*Proxy) removeBrEncoding(req *http.Request) {
encodings := strings.Split(strings.ReplaceAll(req.Header.Get("Accept-Encoding"), " ", ""), ",")
encodings = sliceutil.PruneEqual(encodings, "br")
req.Header.Set("Accept-Encoding", strings.Join(encodings, ", "))

}

// ModifyResponse
func (p *Proxy) ModifyResponse(resp *http.Response) error {
ctx := martian.NewContext(resp.Request)
Expand Down

0 comments on commit 1a55878

Please sign in to comment.