Transfer-encoding question

38 views
Skip to first unread message

Alexander Yukhanov

unread,
Dec 10, 2022, 9:13:13 PM12/10/22
to goproxy-dev
Hello,

There is a logic in golang/goproxy/https.go which enforces the chunked transfer-encoding:

0274         if resp.Request.Method == "HEAD" {
0275           // don't change Content-Length for HEAD request
0276         } else {
0277           // Since we don't know the length of resp, return chunked encoded response
0278           // TODO: use a more reasonable scheme
0279           resp.Header.Del("Content-Length")
0280           resp.Header.Set("Transfer-Encoding", "chunked")
0281         }

Would it be a good idea to respect Content-Length in AlwaysMitm and fallback to chunked encoding only if the content length is not provided? Reasoning - I encountered a software which explicitly checks for the  content-length to be provided and to be non-zero, so it fails to work with goproxy mitm.

Thank you,
Alex
Reply all
Reply to author
Forward
0 new messages