Merge pull request #873 from buffermet/master

revert changes from #723 that prevented HTTP response header spoofing
This commit is contained in:
☸️ 2021-05-02 01:00:41 +10:00 committed by GitHub
commit 831020983c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -116,13 +116,7 @@ func (p *HTTPProxy) onResponseFilter(res *http.Response, ctx *goproxy.ProxyCtx)
if jsres != nil { if jsres != nil {
// the response has been changed by the script // the response has been changed by the script
p.logResponseAction(res.Request, jsres) p.logResponseAction(res.Request, jsres)
raw, err := ioutil.ReadAll(jsres.ToResponse(res.Request).Body) return jsres.ToResponse(res.Request)
if err == nil {
html := string(raw)
res.Header.Set("Content-Length", strconv.Itoa(len(html)))
// reset the response body to the original unread state
res.Body = ioutil.NopCloser(strings.NewReader(html))
}
} }
} }