2. URI Characters and Escape Sequences
uric = reserved | unreserved | escaped
2.1 URI and non-ASCII characters
2.2. Reserved Characters
reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
"$" | ","
unreserved = alphanum | mark
mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")"
2.4. Escape Sequences
2.4.1. Escaped Encoding
escaped = "%" hex hex
hex = digit | "A" | "B" | "C" | "D" | "E" | "F" |
"a" | "b" | "c" | "d" | "e" | "f"
2.4.2. When to Escape and Unescape
2.4.3. Excluded US-ASCII Characters
control = <US-ASCII coded characters 00-1F and 7F hexadecimal>
space = <US-ASCII coded character 20 hexadecimal>
delims = "<" | ">" | "#" | "%" | <">
unwise = "{" | "}" | "|" | "\" | "^" | "[" | "]" | "`"
3. URI Syntactic Components
<scheme>://<authority><path>?<query>
absoluteURI = scheme ":" ( hier_part | opaque_part )
hier_part = ( net_path | abs_path ) [ "?" query ]
net_path = "//" authority [ abs_path ]
abs_path = "/" path_segments
opaque_part = uric_no_slash *uric
uric_no_slash = unreserved | escaped | ";" | "?" | ":" | "@" |
"&" | "=" | "+" | "$" | ","
3.1. Scheme Component
scheme = alpha *( alpha | digit | "+" | "-" | "." )
3.2. Authority Component
authority = server | reg_name
3.2.1. Registry-based Naming Authority
reg_name = 1*( unreserved | escaped | "$" | "," |
";" | ":" | "@" | "&" | "=" | "+" )
3.2.2. Server-based Naming Authority
<userinfo>@<host>:<port>
server = [ [ userinfo "@" ] hostport ]
userinfo = *( unreserved | escaped |
";" | ":" | "&" | "=" | "+" | "$" | "," )
hostport = host [ ":" port ]
host = hostname | IPv4address
hostname = *( domainlabel "." ) toplabel [ "." ]
domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum
toplabel = alpha | alpha *( alphanum | "-" ) alphanum
IPv4address = 1*digit "." 1*digit "." 1*digit "." 1*digit
port = *digit
3.3. Path Component
path = [ abs_path | opaque_part ]
path_segments = segment *( "/" segment )
segment = *pchar *( ";" param )
param = *pchar
pchar = unreserved | escaped |
":" | "@" | "&" | "=" | "+" | "$" | ","
3.4. Query Component
query = *uric
4. URI References
URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
4.1. Fragment Identifier
fragment = *uric
4.2. Same-document References
4.3. Parsing a URI Reference
5. Relative URI References
relativeURI = ( net_path | abs_path | rel_path ) [ "?" query ]
rel_path = rel_segment [ abs_path ]
rel_segment = 1*( unreserved | escaped |
";" | "@" | "&" | "=" | "+" | "$" | "," )
5.1. Establishing a Base URI
.--------------------------------------------------------------.
| .----------------------------------------------------------. |
| | .------------------------------------------------------. | |
| | | .--------------------------------------------------. | | |
| | | | .----------------------------------------------. | | | |
| | | | | <relative_reference> | | | | |
| | | | `----------------------------------------------' | | | |
| | | | (5.1.1) Base URI embedded in the | | | |
| | | | document's content | | | |
| | | `--------------------------------------------------' | | |
| | | (5.1.2) Base URI of the encapsulating entity | | |
| | | (message, document, or none). | | |
| | `------------------------------------------------------' | |
| | (5.1.3) URI used to retrieve the entity | |
| `----------------------------------------------------------' |
| (5.1.4) Default Base URI is application-dependent |
`--------------------------------------------------------------'
5.1.1. Base URI within Document Content
5.1.2. Base URI from the Encapsulating Entity
5.1.3. Base URI from the Retrieval URI
5.1.4. Default Base URI
5.2. Resolving Relative References to Absolute Form
result = ""
append path to result
return result
Tidak ada komentar:
Posting Komentar