Skip to content

TAP5-2832: LocalhostOnly detect IPv6 correctly#64

Open
benweidig wants to merge 1 commit into
masterfrom
TAP5-2832
Open

TAP5-2832: LocalhostOnly detect IPv6 correctly#64
benweidig wants to merge 1 commit into
masterfrom
TAP5-2832

Conversation

@benweidig

Copy link
Copy Markdown
Contributor

LocalhostOnly didn't detect a few of the IPv6 variants.
Furthermore, it might trigger a DNS lookup, which could impact performance.
Therefore, it now relies on HttpServletRequest.getRemoteAddr (via Request).

I've decided to extend the Request interfrace with getRemoteAddr instead of trying to provide LocalhostOnly with the HttpServletRequest somehow.

My reasoning is that Request is already a more high-level/convenient wrapper for HttpServletRequest, delegating multiple methods already to the underlying HttpServletRequest.
Adding another one makes sense, as anything relying on LocalhostOnly would need to provide the full/correct environment. This was an issue during initial testing with using RequestGlobalsinLocalhostOnly`, as it became an invisible dependency.

By extending Request and the related TestableRequest and DelegatingRequest, the Request-based code will behave correctly, regardless of how it's used.

@benweidig benweidig added this to the v5.10.0 milestone Jun 28, 2026
@benweidig benweidig requested a review from thiagohp June 28, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant