Skip to content
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

Replace getPort() with getAddress() #67

Merged
merged 1 commit into from
Feb 5, 2017
Merged

Conversation

clue
Copy link
Member

@clue clue commented Feb 5, 2017

The getPort() currently only returns the "port" part and explicitly omits the listening IP. This has been documented as of v0.4.4 and has in fact been like this ever since this method has been added.

This PR replaced this method with a getAddress() method that it returns the full remote address, i.e. IP and port.

- echo $server->getPort();
- 8000
+ echo $server->getAddress();
+ 192.168.0.12:8000

This is obviously a BC break, so I've made sure to add documentation on how to get only the port from the full address with a one-liner.

Empirical evidence seems to suggest the old getPort() method isn't used that much and is mostly used in a context where the full URI likely makes more sense anyway. For TCP/IP based servers, the full URI contains the port and with the above one-liner this switch should be easy.

There are plenty of reasons, let me try to list a few here:

@clue clue added this to the v0.5.0 milestone Feb 5, 2017
@clue clue merged commit 2d5a2e5 into reactphp:master Feb 5, 2017
@clue clue deleted the getaddress branch February 5, 2017 15:49
@clue clue mentioned this pull request Feb 5, 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.

3 participants