Add default ports to PhutilURI to allow the getPort() method to return the default port is no port number is explicitly provided.
Details
Details
- Reviewers
epriestley - Group Reviewers
Blessed Reviewers - Commits
- rPHUd7e7df98d2ea: Add default ports to `PhutilURI`
Added test cases.
Diff Detail
Diff Detail
- Repository
- rPHU libphutil
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
I think this should be on a separate call, e.g. getPortWithProtocolDefault() or something less wordy.
As implemented, this discards information (whether the port was explicit or not). We have some cases (offhand, OAuth2 redirect URI verification and Conduit request signing) where there may be a difference between "no port specified" and "port 80, explicitly" in a URI.
Comment Actions
I like it as a separate method, I'd never guess what getPort(true) meant without knowing.