Skip to content

Commit

Permalink
feature #23320 [WebServer] Allow * to bind all interfaces (as INADDR_…
Browse files Browse the repository at this point in the history
…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)
  • Loading branch information
fabpot committed Jul 3, 2017
2 parents 98be08b + 1880bcf commit 9bcb852
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Symfony/Bundle/WebServerBundle/CHANGELOG.md
@@ -1,6 +1,11 @@
CHANGELOG
=========

3.4.0
-----

* WebServer can now use '*' as a wildcard to bind to 0.0.0.0 (INADDR_ANY)

3.3.0
-----

Expand Down
3 changes: 3 additions & 0 deletions src/Symfony/Bundle/WebServerBundle/WebServerConfig.php
Expand Up @@ -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) {
$this->hostname = '0.0.0.0';
}
$this->port = substr($address, $pos + 1);
} elseif (ctype_digit($address)) {
$this->hostname = '127.0.0.1';
Expand Down

0 comments on commit 9bcb852

Please sign in to comment.