URI Normalization
GCFPermission
URI strings are normalized per the rules of
RFC 3986 plus the
additional procedures described below.
Protocol Scheme
Note that, per RFC 3986,
the protocol scheme component of a URI is considered case-insensitive,
and is normalized to lower case.
Host Name
Note that, per RFC 3986,
any host name component of a URI is considered case-insensitive,
and is normalized to lower case.
IP Address
Note that, per RFC 3986,
any IP address component of a URI is considered case-insensitive,
and is normalized to lower case.
In addition, IPv6 addresses are normalized by removing leading zeros and
converting the address to uncompressed form.
Port Specification
The GCFPermission
extensions to the URI syntax of
RFC 3986 permit
the specification of a port range or single port number.
Port range
If a port range is stated or implied in the URI string, the URI is normalized
to explicitly state both the lower and upper bounds to the range, with leading
zeros removed, separated by the "-" character. (A port range
with identical upper and lower bounds is treated as a single port number;
see below.) For example:
"ssl://www.example.com:*" => "ssl://www.example.com:0-65535"
"socket://www.example.com:-1024" => "socket://www.example.com:0-1024"
"socket://www.example.com:08000-" => "socket://www.example.com:8000-65535"
"datagram//:" => "datagram://:1024-65535"
Port number
If a single port number is stated or implied in the port specification of the
URI string, the URI is normalized according to the following rules:
- If a protocol-specific default port is stated or implied : The port number is omitted.
- Otherwise : The port number is stated with leading zeros removed.
For example:
"http://www.example.com/" => "http://www.example.com/"
"http://www.example.com:80" => "http://www.example.com/"
"http://www.example.com:08080" => "http://www.example.com:8080/"
"http://www.example.com:8080-8080" => "http://www.example.com:8080/"
CommProtocolPermission URIs
CommProtocolPermission
URI strings are normalized according
to the following rules:
- If a parameter appears more than once in the options list,
the URI is normalized to include only the last occurrence of the parameter.
- Parameters in the options list are normalized to the following order:
baudrate, bitsperchar, stopbits, parity, blocking, autocts, autorts.
For example:
"comm:port1;baudrate=300;baudrate=600" => "comm:port1;baudrate=600"
"comm:port1;stopbits=1;baudrate=300" => "comm:port1;baudrate=300;stopbits=1"
FileProtocolPermission URIs
FileProtocolPermission
URI strings are all normalized to the form:
file://{pathname}
For example:
"file:/etc/hosts" => "file:///etc/hosts"
"file://localhost/etc/hosts" => "file:///etc/hosts"