Refactor to use httputil.ReverseProxy (#342)

* Refactor to use httputil.ReverseProxy

Refactor manual HTTP proxying logic in Process.ProxyRequest to use the standard
library's httputil.ReverseProxy.

* Refactor TestProcess_ForceStopWithKill test

Update to handle behavior with httputil.ReverseProxy.

* Fix gin interface conversion panic
This commit is contained in:
David Wen Riccardi-Zhu
2025-10-13 23:47:04 +00:00
committed by GitHub
parent caf9e98b1e
commit d58a8b85bf
4 changed files with 94 additions and 85 deletions

View File

@@ -3,6 +3,7 @@ package config
import (
"fmt"
"io"
"net/url"
"os"
"regexp"
"runtime"
@@ -342,6 +343,13 @@ func LoadConfigFromReader(r io.Reader) (Config, error) {
}
}
// Validate the proxy URL.
if _, err := url.Parse(modelConfig.Proxy); err != nil {
return Config{}, fmt.Errorf(
"model %s: invalid proxy URL: %w", modelId, err,
)
}
config.Models[modelId] = modelConfig
}