fix: set REMOTE_ADDR to 127.0.0.1 when binding to UNIX domain socket#2457
Closed
xxiaoxiong wants to merge 1 commit into
Closed
fix: set REMOTE_ADDR to 127.0.0.1 when binding to UNIX domain socket#2457xxiaoxiong wants to merge 1 commit into
xxiaoxiong wants to merge 1 commit into
Conversation
|
Please don't merge this. I created the issue to discuss the proper implementation to make and I'm willing to do it myself. This PR is clearly AI-generated. https://github.com/search?q=author%3Axxiaoxiong+is%3Apr&s=created&type=pullrequests |
Author
|
Closing this PR as discussed. The issue creator has indicated they are working on the implementation. Thanks for the report. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When using
bindto a UNIX domain socket,$_SERVER['REMOTE_ADDR']is@, which breaks many applications expecting an IP address in this field.Root Cause
Go's net/http sets
request.RemoteAddrto@for UNIX domain socket connections (see golang/go#49825). The CGI variable registration code inaddKnownVariablesToServerpasses this value directly to PHP asREMOTE_ADDR, resulting in@instead of a valid IP address.Changes
Added a check for the UNIX socket remote address (
@) inaddKnownVariablesToServer. WhenRemoteAddris@, we now fall back to127.0.0.1as the remote address, which matches the convention used by Apache httpd and other web servers when listening on UNIX domain sockets.Closes
Closes #2456