Skip to content

reverseproxy: close upstream body when handle_response status is invalid - #8318

Merged
steadytao merged 2 commits into
caddyserver:masterfrom
BenMacha:fix-replace-status-close-body
Nov 3, 2026
Merged

steadytao merged 2 commits into
caddyserver:masterfrom
BenMacha:fix-replace-status-close-body

Conversation

@BenMacha

@BenMacha BenMacha commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

When a handle_response status code did not evaluate to an integer, the
handler returned a 500 without closing the upstream response body,
leaking the connection.

Assistance Disclosure

The bug was found during a code review done with Claude Code (Anthropic), which also drafted the fix and the test. I reviewed the change, can explain every line, and ran go test -race -short on the affected package before opening this PR.

When a handle_response status code did not evaluate to an integer, the
handler returned a 500 without closing the upstream response body,
leaking the connection.
@caddy-cla

caddy-cla Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

✅ Contributor License Agreement

All identified contributors have signed the CLA. Thank you!

@steadytao
steadytao enabled auto-merge (squash) November 3, 2026 06:50
@steadytao steadytao added the bug 🐞 Something isn't working label Nov 3, 2026
@steadytao steadytao added this to the v2.12.0 milestone Nov 3, 2026
@steadytao
steadytao merged commit dccce45 into caddyserver:master Nov 3, 2026
27 checks passed
This was referenced Nov 3, 2026
NickCao pushed a commit to NickCao/caddy that referenced this pull request Nov 4, 2026
…lid (caddyserver#8318)

When a handle_response status code did not evaluate to an integer, the
handler returned a 500 without closing the upstream response body,
leaking the connection.

(cherry picked from commit dccce45)
@francislavoie francislavoie modified the milestones: v2.12.0, v2.11.8 Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🐞 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants