chore: commit workspace updates

This commit is contained in:
ddCat committed 2026-09-14 01:11:56 +08:00
1 parent 01a2d171f5
commit 9727656b2b
491 files changed
+12826 -72249

No files matched your search

+1 -32
View File
@@ -213,28 +213,6 @@ func doJSON(req *http.Request, target interface{}) error {
return nil
}
func withProviderOutboundPolicy(ctx context.Context, config providerConfig) context.Context {
if !config.AllowLocalChannel {
return ctx
}
parsed, err := url.Parse(strings.TrimSpace(config.BaseURL))
if err != nil || !isExactDesktopLoopbackHost(parsed.Hostname()) {
return ctx
}
return context.WithValue(ctx, providerOutboundPolicyKey{}, providerOutboundPolicyContext{scheme: strings.ToLower(parsed.Scheme), host: strings.ToLower(parsed.Host)})
}
func providerLoopbackPolicyForRequest(req *http.Request) (OutboundPolicy, bool) {
policyContext, ok := req.Context().Value(providerOutboundPolicyKey{}).(providerOutboundPolicyContext)
if !ok || policyContext.scheme == "" || policyContext.host == "" {
return OutboundPolicy{}, false
}
if strings.ToLower(req.URL.Scheme) != policyContext.scheme || strings.ToLower(req.URL.Host) != policyContext.host {
return OutboundPolicy{}, false
}
return desktopLoopbackOutboundPolicy(nil), true
}
func doBinary(req *http.Request) ([]byte, string, error) {
return doBinaryWithConsumer(req, nil)
}
@@ -285,21 +263,12 @@ func doBinaryWithConsumer(req *http.Request, onChunk func(string, []byte)) ([]by
}
defer release()
}
policy, loopback := providerLoopbackPolicyForRequest(req)
if loopback {
if _, err := validateOutboundURLWithPolicy(req.URL.String(), policy); err != nil {
recordProviderRequest(req, startedAt, 0, nil, err)
return nil, "", err
}
} else if _, err := ValidateOutboundURL(req.URL.String()); err != nil {
if _, err := ValidateOutboundURL(req.URL.String()); err != nil {
recordProviderRequest(req, startedAt, 0, nil, err)
return nil, "", err
}
ApplyDefaultOutboundHeaders(req)
client := OutboundHTTPClient(requestTimeout)
if loopback {
client = outboundHTTPClientWithPolicy(requestTimeout, policy)
}
resp, err := client.Do(req)
if err != nil {
if runtimeService != nil {