fix issue where proxy is still proxying with chunked transfer-encoding (#114)

This commit is contained in:
Yi Hong Ang
2025-05-06 01:00:03 +08:00
committed by GitHub
parent 27465fe053
commit cc450e9c5f
2 changed files with 8 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ import (
"net/http"
"net/url"
"os/exec"
"strconv"
"strings"
"sync"
"syscall"
@@ -439,6 +440,12 @@ func (p *Process) ProxyRequest(w http.ResponseWriter, r *http.Request) {
return
}
req.Header = r.Header.Clone()
contentLength, err := strconv.ParseInt(req.Header.Get("content-length"), 10, 64)
if err == nil {
req.ContentLength = contentLength
}
resp, err := client.Do(req)
if err != nil {
http.Error(w, err.Error(), http.StatusBadGateway)