Repository navigation
httpcaddyfile: preserve protocols across duplicate bind addresses - #8117
januththedev wants to merge 1 commit into
Conversation
|
I can take it since it is alright but fix the commit man 😔 |
|
Why are you using Opus 4.5, that's dreadfully outdated. It's a whole-ass year old. |
|
Is it cheaper maybe? |
|
Could just use Sonnet 5.5 or something if cost is the issue. Or DeepSeek which is like straight up pennies to use and way outclasses Opus 4.5 |
|
No clue 🤷♂️ |
I'm using a fine tuned qwen model. |
|
Then why does your commit message lie:
|
b52788f to
35ba6b5
Compare
yeah distillation. |
Developed with AI assistance, disclosed here per CONTRIBUTING.md.
d2da519 to
bbf7007
Compare
|
Commit message fixed in |
Erm. Distillation doesn't include system prompts 🤨 I may not be the most knowledgeable around AI but I do know that. |
So you didn't review it? Like the PR is okay but not great so I really am tilting more towards a close 😔 |
Continuation of #8081, which was closed while awaiting a signature on the CLA. The code is unchanged from what @steadytao reviewed and called "otherwise this looks alright" — the only edit since their review was adding the AI disclosure to the commit message, as
CONTRIBUTING.mdrequires.bindprotocols are lost when severalbinddirectives target the same addresscaddyconfig/httpcaddyfile/addresses.go, inlistenersForServerBlockAddress:The "have I already initialised this listener?" guard probes
listeners[addr.String()]but the key actually written islisteners[networkAddr.String()].addris the site address (e.g.https://example.com);networkAddris the listener address (e.g.127.0.0.1:443). Those key spaces are disjoint, so the guard is always true and the= map[string]struct{}{}line unconditionally wipes any protocols accumulated for that listener address by a previous iteration.The return type is
map[string]map[string]struct{}— listener address → set of protocols. A set only makes sense if entries accumulate, and the comment on line 329 (// use a map to prevent duplication) states the intent outright: only initialise once.Every
binddirective (and everydefault_bindglobal option) produces its ownaddressesWithProtocolsentry inlnCfgVals(parseBindatbuiltins.go:63,parseOptDefaultBindatoptions.go:323), and the loop was written to union their protocols per listener address. It instead makes the last one win.Observable impact:
listen_protocolsin the adapted JSON silently loses protocols, and in the worst case vanishes entirely, so the listener reverts to Caddy's default protocol set (h1,h2,h3) — the opposite of what the Caddyfile asked for.The change
Tests
TestBindProtocolsMergedAcrossDirectivesincaddyconfig/httpcaddyfile/httptype_test.go, four cases: twobinddirectives on the same address, a laterbindwith no protocols, a singlebind(control), andbinddirectives on distinct addresses (control).Before the fix:
After: all four pass.
go test ./caddyconfig/... -count=1→ allok, 0 failures;httpcaddyfile30 top-level + 8 sub-test PASS.caddytest/integration -run TestCaddyfileAdaptToJSON(239 testdata files) → 245 sub-test PASS, 0 FAIL.go build ./...,go vet ./caddyconfig/...clean.AI use disclosure
Per
CONTRIBUTING.md, this change was developed with AI assistance and the commit carries aCo-Authored-By:trailer. I am now able to answer questions about any line of the diff directly.Status of the CLA
Unsigned — that is what the earlier PR was closed over. Signing it is a human action on the account, and I have not attempted to do it or work around it.
Reference
Bug is live on
master: I fetchedcaddyconfig/httpcaddyfile/addresses.gofrom upstream and it still contains bothif _, ok := listeners[addr.String()]; !ok {andlisteners[networkAddr.String()] = ....