Page MenuHomePhabricator

Add default ports to `PhutilURI`
ClosedPublic

Authored by joshuaspence on Jan 12 2015, 2:37 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 23, 3:57 PM
Unknown Object (File)
Oct 28 2024, 10:04 AM
Unknown Object (File)
Oct 20 2024, 7:50 PM
Unknown Object (File)
Oct 16 2024, 8:16 PM
Unknown Object (File)
Oct 15 2024, 9:11 AM
Unknown Object (File)
Oct 15 2024, 9:08 AM
Unknown Object (File)
Oct 15 2024, 9:07 AM
Unknown Object (File)
Oct 15 2024, 9:05 AM
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
Branch
master
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 3790
Build 3802: [Placeholder Plan] Wait for 30 Seconds

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.