Page MenuHomePhabricator

Add default ports to `PhutilURI`
ClosedPublic

Authored by joshuaspence on Jan 12 2015, 2:37 AM.
Tags
None
Referenced Files
F13172583: D11338.id27269.diff
Tue, May 7, 4:30 PM
F13168687: D11338.diff
Tue, May 7, 7:53 AM
Unknown Object (File)
Fri, May 3, 7:34 AM
Unknown Object (File)
Fri, Apr 26, 10:49 AM
Unknown Object (File)
Thu, Apr 25, 1:37 AM
Unknown Object (File)
Thu, Apr 11, 2:24 PM
Unknown Object (File)
Thu, Apr 11, 9:19 AM
Unknown Object (File)
Feb 11 2024, 6:11 PM
Subscribers

Details

Summary

Add default ports to PhutilURI to allow the getPort() method to return the default port is no port number is explicitly provided.

Test Plan

Added test cases.

Diff Detail

Repository
rPHU libphutil
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

joshuaspence retitled this revision from to Add default ports to `PhutilURI`.
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.
epriestley edited edge metadata.

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.

This revision now requires changes to proceed.Jan 12 2015, 4:01 PM

What about function getPort($lookup_default = false)?

I like it as a separate method, I'd never guess what getPort(true) meant without knowing.

joshuaspence edited edge metadata.

Move to a new method

epriestley edited edge metadata.
This revision is now accepted and ready to land.Jan 12 2015, 7:52 PM

Yeah, I couldn't come up with a better name for this method.

This revision was automatically updated to reflect the committed changes.