Skip to content

[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

Merged
merged 2 commits into from
Jul 3, 2017
Merged

[WebServer] Allow * to bind all interfaces (as INADDR_ANY) #23320

merged 2 commits into from
Jul 3, 2017

Conversation

jpauli
Copy link

@jpauli jpauli commented Jun 28, 2017

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.

@@ -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 == '*') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'*' === $this->hostname instead?

Copy link
Member

@stof stof Jun 28, 2017

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.

Copy link
Member

@stof stof left a 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)
Copy link
Member

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 == '*') {
Copy link
Member

@stof stof Jun 28, 2017

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.

@fabpot fabpot changed the base branch from master to 3.4 July 3, 2017 06:52
@fabpot
Copy link
Member

fabpot commented Jul 3, 2017

Thank you @jpauli.

@fabpot fabpot merged commit 1880bcf into symfony:3.4 Jul 3, 2017
fabpot added a commit that referenced this pull request Jul 3, 2017
…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)
This was referenced Oct 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants