mirror of
https://github.com/fosrl/newt.git
synced 2026-07-15 21:16:40 -05:00
[PR #345] [MERGED] fix(http): populate Request.TLS for private HTTPS via httpConnCtx #7794
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/fosrl/newt/pull/345
Author: @LaurenceJJones
Created: 5/8/2026
Status: ✅ Merged
Merged: 5/8/2026
Merged by: @oschwartz10612
Base:
dev← Head:investigate/https-permanent-redirect-loop📝 Commits (1)
146e783fix(http): populate Request.TLS for private HTTPS via httpConnCtx📊 Changes
2 files changed (+63 additions, -0 deletions)
View changed files
📝
netstack2/http_handler.go(+15 -0)➕
netstack2/http_handler_tls_test.go(+48 -0)📄 Description
Community Contribution License Agreement
By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.
Description
net/http only sets Request.TLS for *tls.Conn or conns implementing ConnectionState(). Our listener wrapped tls.Server in httpConnCtx with an embedded net.Conn, so TLS was never surfaced and r.TLS stayed nil. That triggered the HTTP→HTTPS permanent redirect on every request for HTTPS rules.
Add ConnectionState() on httpConnCtx delegating to the underlying TLS conn. Add tests for TLS forwarding and plain TCP.
How to test?
added golang tests for regression
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.