summaryrefslogtreecommitdiffstats
path: root/tinyHTTP/abnf/uri.abnf
blob: 7e4a80d64d084c45a3e33ae551d72e1aba7c343e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
; FIXME:
DQUOTE= %x22 ; " (Double Quote)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; URI (2396) - ABNF
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; 1.6. Syntax Notation and Common Elements
alpha    = lowalpha / upalpha
lowalpha = "a" / "b" / "c" / "d" / "e" / "f" / "g" / "h" / "i" / "j" / "k" / "l" / "m" / "n" / "o" / "p" / "q" / "r" / "s" / "t" / "u" / "v" / "w" / "x" / "y" / "z"
upalpha  = "A" / "B" / "C" / "D" / "E" / "F" / "G" / "H" / "I" / "J" / "K" / "L" / "M" / "N" / "O" / "P" / "Q" / "R" / "S" / "T" / "U" / "V" / "W" / "X" / "Y" / "Z"
digit    = "0" / "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9"
alphanum = alpha / digit

;;;; 2. URI Characters and Escape Sequences
urlc     = reserved / unreserved / escaped

;;;; 2.2. Reserved Characters
reserved    = ";" / "/" / "?" / ":" / "@" / "&" / "=" / "+" / "$" / ","

;;;; 2.3. Unreserved Characters
unreserved  = alphanum / mark
mark        = "-" / "_" / "." / "!" / "~" / "*" / "'" / "(" / ")"

;;;; 2.4.1. Escaped Encoding
escaped    = "%" hex hex
hex         = digit / "A" / "B" / "C" / "D" / "E" / "F" / "a" / "b" / "c" / "d" / "e" / "f"


;;;; 2.4.3. Excluded US-ASCII Characters
control = %x00-1F / %x7F ;<US-ASCII coded characters 00-1F and 7F hexadecimal>
space   = %x20 ;<US-ASCII coded character 20 hexadecimal>
delims  = "<" / ">" / "#" / "%" / DQUOTE
unwise  = "{" / "}" / "/" / "\" / "^" / "[" / "]" / "`"


;;;; 3. URI Syntactic Components
absoluteURI   = scheme ":" ( hier-part / opaque-part )
hier-part     = ( net-path / abs-path ) [ "?" query ]
net-path      = "//" authority [ abs-path ]
abs-path      = "/"  path-segments
opaque-part   = urlc-no-slash *urlc
urlc-no-slash = unreserved / escaped / ";" / "?" / ":" / "@" / "&" / "=" / "+" / "$" / ","

;;;; 3.1. Scheme Component
scheme        = alpha *( alpha / digit / "+" / "-" / "." )

;;;; 3.2. Authority Component
authority     = server / reg-name

;;;; Registry-based Naming Authority
reg-name      = 1*( unreserved / escaped / "$" / "," / ";" / ":" / "@" / "&" / "=" / "+" )

;;;; 3.2.2. Server-based Naming Authority
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         = *urlc

;;;; 4. URI References
URI-reference = [ absoluteURI / relativeURI ] [ "#" fragment ]


;;;; 4.1. Fragment Identifier
fragment      = *urlc

;;;; 5. Relative URI References
relativeURI   = ( net-path / abs-path / rel-path ) [ "?" query ]
rel-path      = rel-segment [ abs-path ]
rel-segment   = 1*( unreserved / escaped / ";" / "@" / "&" / "=" / "+" / "$" / "," )
OpenPOWER on IntegriCloud