-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[WebServer] Allow * to bind all interfaces (as INADDR_ANY) #23320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -54,6 +54,9 @@ public function __construct($documentRoot, $env, $address = null, $router = null | |||
$this->port = $this->findBestPort(); | |||
} elseif (false !== $pos = strrpos($address, ':')) { | |||
$this->hostname = substr($address, 0, $pos); | |||
if ($this->hostname == '*') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'*' === $this->hostname
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comparison must be strict indeed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You also need to support *
in the else
clause when the port is not specified
3.4.0 | ||
----- | ||
|
||
* 'WebServer can now use '*' as a wildcard to bind to 0.0.0.0 (INADDR_ANY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you have an extra quote at the beginning. and the value should use backticks to make it a Markdown code span (especially given that *
is a special char otherwise)
@@ -54,6 +54,9 @@ public function __construct($documentRoot, $env, $address = null, $router = null | |||
$this->port = $this->findBestPort(); | |||
} elseif (false !== $pos = strrpos($address, ':')) { | |||
$this->hostname = substr($address, 0, $pos); | |||
if ($this->hostname == '*') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comparison must be strict indeed.
Thank you @jpauli. |
…ANY) (jpauli, fabpot) This PR was merged into the 3.4 branch. Discussion ---------- [WebServer] Allow * to bind all interfaces (as INADDR_ANY) | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | no-tests | Fixed tickets | ~ | License | MIT | Doc PR | In Python and elsewhere, binding to '*' means '0.0.0.0' (INADDR_ANY). I just added that to WebServer command. Commits ------- 1880bcf fixed CS b31ebae Allow * to bind all interfaces (as INADDR_ANY)
In Python and elsewhere, binding to '*' means '0.0.0.0' (INADDR_ANY). I just added that to WebServer command.