Take agent_tls.insecure as consent to an agent port without TLS too

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5.5 committed 2026-10-04 10:11:40 +02:00
1 parent 2b29016d5b
commit b201275fd9
2 files changed
+6 -1

No files matched your search

+2 -1
View File
@@ -792,7 +792,8 @@ func agentListenAddr(cfg config.Server) (string, error) {
if cfg.AgentTLS.Enabled() {
return cfg.AgentListen, nil
}
if !cfg.AgentInsecure {
// agent_tls.insecure says the same, in the older place.
if !cfg.AgentInsecure && !cfg.AgentTLS.Insecure {
return "", errAgentInsecure
}
if host, port, err := net.SplitHostPort(cfg.AgentListen); err == nil && host == "" {
+4
View File
@@ -22,6 +22,10 @@ func TestTheAgentPortOpensWithoutTLSOnlyWhenToldAndThenOnLoopback(t *testing.T)
}
cfg.AgentInsecure = false
cfg.AgentListen = ":7443"
cfg.AgentTLS = tlsconf.Config{Insecure: true}
if a, err := agentListenAddr(cfg); err != nil || a != "127.0.0.1:7443" {
t.Errorf("agent_tls.insecure: %s %v", a, err)
}
cfg.AgentTLS = tlsconf.Config{CA: "ca.pem", Cert: "s.pem", Key: "s-key.pem"}
if a, err := agentListenAddr(cfg); err != nil || a != ":7443" {
t.Errorf("with TLS: %s %v", a, err)