Skip to content

Main content

URI Authority Empty Port Marker Tool

Compute uri authority empty port marker from explicit bounded inputs.

Loading tool…

Description

Return host, literal port or empty string, and explicitEmpty only when a colon was present with no digits.

URI text contains components and percent-encoded octets. A percent sign plus two hex digits describes one octet, while UTF-8 decoding and component-specific validity are additional questions. Host and port notation also needs to distinguish an absent field from an explicitly empty one.

Return host, literal port or empty string, and explicitEmpty only when a colon was present with no digits.

When to use this tool

Use URI Authority Empty Port Marker when you need this local percent-encoding or host/port-notation check on supplied text.

How to use the tool and how it works

  1. Enter authority. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read host, port, explicitEmpty. Inspect explicitEmpty before interpreting the associated values.

Match a bracketed host-like token or a noncolon/nonwhitespace token, optionally followed by : and zero or more decimal digits. Return host, literal port or empty string, and explicitEmpty only when a colon was present with no digits.1

Input fieldMeaning and unitsAccepted input
authorityAuthorityRequired. Text; maximum UTF-16 length 8192.
Output fieldInterpretationReturned shape
hostHostRequired. Text; maximum UTF-16 length 8192.
portPortRequired. Text; maximum UTF-16 length 8192.
explicitEmptyTrue for a supplied colon followed by no port digits; false when the port is absent.Required. Boolean.
json
{
  "input": {
    "authority": "example.com:"
  },
  "output": {
    "host": "example.com",
    "port": "",
    "explicitEmpty": true
  }
}

Limitations and assumptions

  • A missing port and an explicit empty port have the same port string but different flags. IP syntax, port range, userinfo, component delimiters, and an actual URI authority are not fully validated.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.

Alternative or Complementary methods

Use a URI parser and component-appropriate decoding when a full address is needed. Verify octet encoding, UTF-8 interpretation, component boundaries, and endpoint constraints separately.

References

  1. Calculation and input contract: parse/uri-authority-empty-port-marker — tool.io

Similar or alternative tools