identifier-js 0.0.13 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +24 -5
- package/normalization.md +299 -0
- package/package.json +41 -41
- package/readme.md +433 -64
- package/docs/rfc3986-rfc3987-abnf.yaml +0 -295
- package/docs/rfc9110-rfc9112-abnf.yaml +0 -267
- package/tests/normalize.test-off.js +0 -21
- package/tests/parse.test.js +0 -472
- package/tests/performance.js +0 -46
- package/tests/resolve.rfc.test.js +0 -63
- package/tests/resolve.test.js +0 -16
- package/tests/to-absolute.test.js +0 -28
- package/tests/to-relative.test.js +0 -50
- package/tests/validation-ip-port.test.js +0 -278
- package/tests/validation-scheme-specific.test.js +0 -604
- package/tests/validation.test.js +0 -278
- package/tests/vitest-setup.js +0 -19
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
URI-reference:
|
|
2
|
-
syntax: |
|
|
3
|
-
URI / relative-ref
|
|
4
|
-
description: URI reference (full or relative).
|
|
5
|
-
URI:
|
|
6
|
-
syntax: |
|
|
7
|
-
scheme ":" hier-part [ "?" query ] [ "#" fragment ]
|
|
8
|
-
description: Full URI (RFC3986).
|
|
9
|
-
absolute-URI:
|
|
10
|
-
syntax: |
|
|
11
|
-
scheme ":" hier-part [ "?" query ]
|
|
12
|
-
description: Absolute URI (Full URI without fragment).
|
|
13
|
-
relative-ref:
|
|
14
|
-
syntax: |
|
|
15
|
-
relative-part [ "?" query ] [ "#" fragment ]
|
|
16
|
-
description: Relative reference (RFC3986).
|
|
17
|
-
hier-part:
|
|
18
|
-
syntax: |
|
|
19
|
-
"//" authority path-abempty
|
|
20
|
-
/ path-absolute
|
|
21
|
-
/ path-rootless
|
|
22
|
-
/ path-empty
|
|
23
|
-
description: Hierarchical part of URI.
|
|
24
|
-
relative-part:
|
|
25
|
-
syntax: |
|
|
26
|
-
"//" authority path-abempty
|
|
27
|
-
/ path-absolute
|
|
28
|
-
/ path-noscheme
|
|
29
|
-
/ path-empty
|
|
30
|
-
description: Relative hierarchical part.
|
|
31
|
-
authority:
|
|
32
|
-
syntax: |
|
|
33
|
-
[ userinfo "@" ] host [ ":" port ]
|
|
34
|
-
description: Authority component.
|
|
35
|
-
userinfo:
|
|
36
|
-
syntax: |
|
|
37
|
-
*( unreserved / pct-encoded / sub-delims / ":" )
|
|
38
|
-
description: User information.
|
|
39
|
-
host:
|
|
40
|
-
syntax: |
|
|
41
|
-
IP-literal / IPv4address / reg-name
|
|
42
|
-
description: Host component.
|
|
43
|
-
reg-name:
|
|
44
|
-
syntax: |
|
|
45
|
-
*( unreserved / pct-encoded / sub-delims )
|
|
46
|
-
description: Registered name.
|
|
47
|
-
path:
|
|
48
|
-
syntax: |
|
|
49
|
-
path-abempty
|
|
50
|
-
/ path-absolute
|
|
51
|
-
/ path-noscheme
|
|
52
|
-
/ path-rootless
|
|
53
|
-
/ path-empty
|
|
54
|
-
description: Path component.
|
|
55
|
-
path-abempty:
|
|
56
|
-
syntax: |
|
|
57
|
-
*( "/" segment )
|
|
58
|
-
description: Zero or more "/" segment.
|
|
59
|
-
path-absolute:
|
|
60
|
-
syntax: |
|
|
61
|
-
"/" [ segment-nz *( "/" segment ) ]
|
|
62
|
-
description: Absolute path.
|
|
63
|
-
path-noscheme:
|
|
64
|
-
syntax: |
|
|
65
|
-
segment-nz-nc *( "/" segment )
|
|
66
|
-
description: Path without scheme.
|
|
67
|
-
path-rootless:
|
|
68
|
-
syntax: |
|
|
69
|
-
segment-nz *( "/" segment )
|
|
70
|
-
description: Rootless path.
|
|
71
|
-
path-empty:
|
|
72
|
-
syntax: |
|
|
73
|
-
0<pchar>
|
|
74
|
-
description: Empty path.
|
|
75
|
-
segment:
|
|
76
|
-
syntax: |
|
|
77
|
-
*pchar
|
|
78
|
-
description: Path segment.
|
|
79
|
-
segment-nz:
|
|
80
|
-
syntax: |
|
|
81
|
-
1*pchar
|
|
82
|
-
description: Non-zero-length segment.
|
|
83
|
-
segment-nz-nc:
|
|
84
|
-
syntax: |
|
|
85
|
-
1*( unreserved / pct-encoded / sub-delims / "@" )
|
|
86
|
-
description: Non-zero-length segment without colon.
|
|
87
|
-
pchar:
|
|
88
|
-
syntax: |
|
|
89
|
-
unreserved / pct-encoded / sub-delims / ":" / "@"
|
|
90
|
-
description: Path character.
|
|
91
|
-
query:
|
|
92
|
-
syntax: |
|
|
93
|
-
*( pchar / "/" / "?" )
|
|
94
|
-
description: Query component.
|
|
95
|
-
fragment:
|
|
96
|
-
syntax: |
|
|
97
|
-
*( pchar / "/" / "?" )
|
|
98
|
-
description: Fragment component.
|
|
99
|
-
IRI-reference:
|
|
100
|
-
syntax: |
|
|
101
|
-
IRI / irelative-ref
|
|
102
|
-
description: IRI reference (full or relative).
|
|
103
|
-
IRI:
|
|
104
|
-
syntax: |
|
|
105
|
-
scheme ":" ihier-part [ "?" iquery ] [ "#" ifragment ]
|
|
106
|
-
description: Top-level IRI per RFC3987.
|
|
107
|
-
ihier-part:
|
|
108
|
-
syntax: |
|
|
109
|
-
"//" iauthority ipath-abempty
|
|
110
|
-
/ ipath-absolute
|
|
111
|
-
/ ipath-rootless
|
|
112
|
-
/ ipath-empty
|
|
113
|
-
description: Hierarchical part (authority and path) of the IRI.
|
|
114
|
-
absolute-IRI:
|
|
115
|
-
syntax: |
|
|
116
|
-
scheme ":" ihier-part [ "?" iquery ]
|
|
117
|
-
description: Absolute IRI (Full IRI without fragment).
|
|
118
|
-
irelative-ref:
|
|
119
|
-
syntax: |
|
|
120
|
-
irelative-part [ "?" iquery ] [ "#" ifragment ]
|
|
121
|
-
description: Relative reference (with optional query and fragment).
|
|
122
|
-
irelative-part:
|
|
123
|
-
syntax: |
|
|
124
|
-
"//" iauthority ipath-abempty
|
|
125
|
-
/ ipath-absolute
|
|
126
|
-
/ ipath-noscheme
|
|
127
|
-
/ ipath-empty
|
|
128
|
-
description: The part of a relative reference without query or fragment.
|
|
129
|
-
iauthority:
|
|
130
|
-
syntax: |
|
|
131
|
-
[ iuserinfo "@" ] ihost [ ":" port ]
|
|
132
|
-
description: 'Authority: optional userinfo, host, and optional port.'
|
|
133
|
-
iuserinfo:
|
|
134
|
-
syntax: |
|
|
135
|
-
*( iunreserved / pct-encoded / sub-delims / ":" )
|
|
136
|
-
description: User info (iauthority before '@', may include percent-encoding and colon).
|
|
137
|
-
ihost:
|
|
138
|
-
syntax: |
|
|
139
|
-
IP-literal / IPv4address / ireg-name
|
|
140
|
-
description: 'Host: IP-literal (IPv6/IPvFuture), IPv4 address, or internationalized name.'
|
|
141
|
-
ireg-name:
|
|
142
|
-
syntax: |
|
|
143
|
-
*( iunreserved / pct-encoded / sub-delims )
|
|
144
|
-
description: Internationalized host name (allows Unicode via ucschar in iunreserved).
|
|
145
|
-
ipath:
|
|
146
|
-
syntax: |
|
|
147
|
-
ipath-abempty
|
|
148
|
-
/ ipath-absolute
|
|
149
|
-
/ ipath-noscheme
|
|
150
|
-
/ ipath-rootless
|
|
151
|
-
/ ipath-empty
|
|
152
|
-
description: Path component of IRI (hierarchical).
|
|
153
|
-
ipath-abempty:
|
|
154
|
-
syntax: |
|
|
155
|
-
*( "/" isegment )
|
|
156
|
-
description: Zero or more '/'-prefixed segments.
|
|
157
|
-
ipath-absolute:
|
|
158
|
-
syntax: |
|
|
159
|
-
"/" [ isegment-nz *( "/" isegment ) ]
|
|
160
|
-
description: Path starting with '/', not '//' (absolute path).
|
|
161
|
-
ipath-noscheme:
|
|
162
|
-
syntax: |
|
|
163
|
-
isegment-nz-nc *( "/" isegment )
|
|
164
|
-
description: Path with no scheme (first segment not empty, no colon ':').
|
|
165
|
-
ipath-rootless:
|
|
166
|
-
syntax: |
|
|
167
|
-
isegment-nz *( "/" isegment )
|
|
168
|
-
description: Path beginning with a non-zero-length segment.
|
|
169
|
-
ipath-empty:
|
|
170
|
-
syntax: |
|
|
171
|
-
0<ipchar>
|
|
172
|
-
description: Empty path (no characters).
|
|
173
|
-
isegment:
|
|
174
|
-
syntax: |
|
|
175
|
-
*ipchar
|
|
176
|
-
description: Segment (zero or more ipchar characters).
|
|
177
|
-
isegment-nz:
|
|
178
|
-
syntax: |
|
|
179
|
-
1*ipchar
|
|
180
|
-
description: Non-zero-length segment.
|
|
181
|
-
isegment-nz-nc:
|
|
182
|
-
syntax: |
|
|
183
|
-
1*( iunreserved / pct-encoded / sub-delims / "@" )
|
|
184
|
-
description: Non-zero-length segment with no colon.
|
|
185
|
-
ipchar:
|
|
186
|
-
syntax: |
|
|
187
|
-
iunreserved / pct-encoded / sub-delims / ":" / "@"
|
|
188
|
-
description: Character in a path segment (unreserved, pct-encoded, or delimiter).
|
|
189
|
-
iquery:
|
|
190
|
-
syntax: |
|
|
191
|
-
*( ipchar / iprivate / "/" / "?" )
|
|
192
|
-
description: Query component (allows private-use characters).
|
|
193
|
-
ifragment:
|
|
194
|
-
syntax: |
|
|
195
|
-
*( ipchar / "/" / "?" )
|
|
196
|
-
description: Fragment identifier component.
|
|
197
|
-
iunreserved:
|
|
198
|
-
syntax: |
|
|
199
|
-
ALPHA / DIGIT / "-" / "." / "_" / "~" / ucschar
|
|
200
|
-
description: Unreserved characters (including Unicode ucschar).
|
|
201
|
-
ucschar:
|
|
202
|
-
syntax: |
|
|
203
|
-
%xA0-D7FF / %xF900-FDCF / %xFDF0-FFEF
|
|
204
|
-
/ %x10000-1FFFD / %x20000-2FFFD / %x30000-3FFFD
|
|
205
|
-
/ %x40000-4FFFD / %x50000-5FFFD / %x60000-6FFFD
|
|
206
|
-
/ %x70000-7FFFD / %x80000-8FFFD / %x90000-9FFFD
|
|
207
|
-
/ %xA0000-AFFFD / %xB0000-BFFFD / %xC0000-CFFFD
|
|
208
|
-
/ %xD0000-DFFFD / %xE1000-EFFFD
|
|
209
|
-
description: Unicode code point ranges allowed in IRIs (excludes private-use).
|
|
210
|
-
iprivate:
|
|
211
|
-
syntax: |
|
|
212
|
-
%xE000-F8FF / %xF0000-FFFFD / %x100000-10FFFD
|
|
213
|
-
description: Private-use Unicode ranges (allowed in IRI but not URI).
|
|
214
|
-
scheme:
|
|
215
|
-
syntax: |
|
|
216
|
-
ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
|
|
217
|
-
description: Scheme (ASCII letters/digits) from RFC3986.
|
|
218
|
-
port:
|
|
219
|
-
syntax: |
|
|
220
|
-
*DIGIT
|
|
221
|
-
description: Port number (ASCII digits).
|
|
222
|
-
IP-literal:
|
|
223
|
-
syntax: |
|
|
224
|
-
"[" ( IPv6address / IPvFuture ) "]"
|
|
225
|
-
description: IP literal (IPv6 or IPvFuture) in brackets (RFC3986).
|
|
226
|
-
IPvFuture:
|
|
227
|
-
syntax: |
|
|
228
|
-
"v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
|
|
229
|
-
description: IPvFuture address (versioned IPv6 form, per RFC3986).
|
|
230
|
-
IPv6address:
|
|
231
|
-
syntax: |
|
|
232
|
-
''
|
|
233
|
-
6( h16 ":" ) ls32
|
|
234
|
-
/ "::" 5( h16 ":" ) ls32
|
|
235
|
-
/ [ h16 ] "::" 4( h16 ":" ) ls32
|
|
236
|
-
/ [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32
|
|
237
|
-
/ [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32
|
|
238
|
-
/ [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32
|
|
239
|
-
/ [ *4( h16 ":" ) h16 ] "::" ls32
|
|
240
|
-
/ [ *5( h16 ":" ) h16 ] "::" h16
|
|
241
|
-
/ [ *6( h16 ":" ) h16 ] "::"
|
|
242
|
-
description: IPv6 address (full forms from RFC3986).
|
|
243
|
-
h16:
|
|
244
|
-
syntax: |
|
|
245
|
-
1*4HEXDIG
|
|
246
|
-
description: 1 to 4 hexadecimal digits (16-bit part).
|
|
247
|
-
ls32:
|
|
248
|
-
syntax: |
|
|
249
|
-
( h16 ":" h16 ) / IPv4address
|
|
250
|
-
description: Least-significant 32 bits of IPv6 (two h16 or an IPv4).
|
|
251
|
-
IPv4address:
|
|
252
|
-
syntax: |
|
|
253
|
-
dec-octet "." dec-octet "." dec-octet "." dec-octet
|
|
254
|
-
description: IPv4 address (decimal dotted-quad).
|
|
255
|
-
dec-octet:
|
|
256
|
-
syntax: |
|
|
257
|
-
DIGIT
|
|
258
|
-
/ %x31-39 DIGIT
|
|
259
|
-
/ "1" 2DIGIT
|
|
260
|
-
/ "2" %x30-34 DIGIT
|
|
261
|
-
/ "25" %x30-35
|
|
262
|
-
description: Decimal octet (0-255) for IPv4 (from RFC3986).
|
|
263
|
-
pct-encoded:
|
|
264
|
-
syntax: |
|
|
265
|
-
"%" HEXDIG HEXDIG
|
|
266
|
-
description: Percent-encoded octet (hexadecimal encoding).
|
|
267
|
-
unreserved:
|
|
268
|
-
syntax: |
|
|
269
|
-
ALPHA / DIGIT / "-" / "." / "_" / "~"
|
|
270
|
-
description: Unreserved ASCII characters (RFC3986).
|
|
271
|
-
reserved:
|
|
272
|
-
syntax: |
|
|
273
|
-
gen-delims / sub-delims
|
|
274
|
-
description: Reserved characters (RFC3986).
|
|
275
|
-
gen-delims:
|
|
276
|
-
syntax: |
|
|
277
|
-
":" / "/" / "?" / "#" / "[" / "]" / "@"
|
|
278
|
-
description: General delimiters (RFC3986).
|
|
279
|
-
sub-delims:
|
|
280
|
-
syntax: |
|
|
281
|
-
"!" / "&" / "$" / "'" / "(" / ")"
|
|
282
|
-
/ "*" / "+" / "," / ";" / "="
|
|
283
|
-
description: Subcomponent delimiters (RFC3986).
|
|
284
|
-
ALPHA:
|
|
285
|
-
syntax: |
|
|
286
|
-
%x41-5A / %x61-7A
|
|
287
|
-
description: ASCII letters A-Z / a-z (RFC5234).
|
|
288
|
-
DIGIT:
|
|
289
|
-
syntax: |
|
|
290
|
-
%x30-39
|
|
291
|
-
description: ASCII digits 0-9 (RFC5234).
|
|
292
|
-
HEXDIG:
|
|
293
|
-
syntax: |
|
|
294
|
-
DIGIT / %x41-46 / %x61-66
|
|
295
|
-
description: Hexadecimal digits (0-9, A-F, a-f) (RFC5234).
|
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
Accept: |
|
|
2
|
-
[ ( media-range [ weight ] ) *( OWS "," OWS ( media-range [ weight ] ) ) ]
|
|
3
|
-
Accept-Charset: >
|
|
4
|
-
[ ( ( token / "*" ) [ weight ] ) *( OWS "," OWS ( ( token / "*" ) [ weight ] ) ) ]
|
|
5
|
-
Accept-Encoding: |
|
|
6
|
-
[ ( codings [ weight ] ) *( OWS "," OWS ( codings [ weight ] ) ) ]
|
|
7
|
-
Accept-Language: >
|
|
8
|
-
[ ( language-range [ weight ] ) *( OWS "," OWS ( language-range [ weight ] ) ) ]
|
|
9
|
-
Accept-Ranges: acceptable-ranges
|
|
10
|
-
Allow: |
|
|
11
|
-
[ method *( OWS "," OWS method ) ]
|
|
12
|
-
Authentication-Info: |
|
|
13
|
-
[ auth-param *( OWS "," OWS auth-param ) ]
|
|
14
|
-
Authorization: credentials
|
|
15
|
-
BWS: OWS
|
|
16
|
-
Connection: |
|
|
17
|
-
[ connection-option *( OWS "," OWS connection-option ) ]
|
|
18
|
-
Content-Encoding: |
|
|
19
|
-
[ content-coding *( OWS "," OWS content-coding ) ]
|
|
20
|
-
Content-Language: |
|
|
21
|
-
[ language-tag *( OWS "," OWS language-tag ) ]
|
|
22
|
-
Content-Length: 1*DIGIT
|
|
23
|
-
Content-Location: absolute-URI / partial-URI
|
|
24
|
-
Content-Range: |
|
|
25
|
-
range-unit SP ( range-resp / unsatisfied-range )
|
|
26
|
-
Content-Type: media-type
|
|
27
|
-
Date: HTTP-date
|
|
28
|
-
ETag: entity-tag
|
|
29
|
-
Expect: |
|
|
30
|
-
[ expectation *( OWS "," OWS expectation ) ]
|
|
31
|
-
From: mailbox
|
|
32
|
-
GMT: '%x47.4D.54'
|
|
33
|
-
HTTP-date: IMF-fixdate / obs-date
|
|
34
|
-
Host: uri-host [ ":" port ]
|
|
35
|
-
IMF-fixdate: |
|
|
36
|
-
day-name "," SP date1 SP time-of-day SP GMT
|
|
37
|
-
If-Match: |
|
|
38
|
-
"*" / [ entity-tag *( OWS "," OWS entity-tag ) ]
|
|
39
|
-
If-Modified-Since: HTTP-date
|
|
40
|
-
If-None-Match: |
|
|
41
|
-
"*" / [ entity-tag *( OWS "," OWS entity-tag ) ]
|
|
42
|
-
If-Range: entity-tag / HTTP-date
|
|
43
|
-
If-Unmodified-Since: HTTP-date
|
|
44
|
-
Last-Modified: HTTP-date
|
|
45
|
-
Location: URI-reference
|
|
46
|
-
Max-Forwards: 1*DIGIT
|
|
47
|
-
OWS: |
|
|
48
|
-
*( SP / HTAB )
|
|
49
|
-
Proxy-Authenticate: |
|
|
50
|
-
[ challenge *( OWS "," OWS challenge ) ]
|
|
51
|
-
Proxy-Authentication-Info: |
|
|
52
|
-
[ auth-param *( OWS "," OWS auth-param ) ]
|
|
53
|
-
Proxy-Authorization: credentials
|
|
54
|
-
RWS: |
|
|
55
|
-
1*( SP / HTAB )
|
|
56
|
-
Range: ranges-specifier
|
|
57
|
-
Referer: absolute-URI / partial-URI
|
|
58
|
-
Retry-After: HTTP-date / delay-seconds
|
|
59
|
-
Server: |
|
|
60
|
-
product *( RWS ( product / comment ) )
|
|
61
|
-
TE: |
|
|
62
|
-
[ t-codings *( OWS "," OWS t-codings ) ]
|
|
63
|
-
Trailer: |
|
|
64
|
-
[ field-name *( OWS "," OWS field-name ) ]
|
|
65
|
-
Upgrade: |
|
|
66
|
-
[ protocol *( OWS "," OWS protocol ) ]
|
|
67
|
-
User-Agent: |
|
|
68
|
-
product *( RWS ( product / comment ) )
|
|
69
|
-
Vary: |
|
|
70
|
-
[ ( "*" / field-name ) *( OWS "," OWS ( "*" / field-name ) ) ]
|
|
71
|
-
Via: |
|
|
72
|
-
[ ( received-protocol RWS received-by [ RWS comment ] )
|
|
73
|
-
*( OWS "," OWS ( received-protocol RWS received-by [ RWS comment ] ) ) ]
|
|
74
|
-
WWW-Authenticate: |
|
|
75
|
-
[ challenge *( OWS "," OWS challenge ) ]
|
|
76
|
-
absolute-path: |
|
|
77
|
-
1*( "/" segment )
|
|
78
|
-
acceptable-ranges: |
|
|
79
|
-
range-unit *( OWS "," OWS range-unit )
|
|
80
|
-
asctime-date: |
|
|
81
|
-
day-name SP date3 SP time-of-day SP year
|
|
82
|
-
auth-param: |
|
|
83
|
-
token BWS "=" BWS ( token / quoted-string )
|
|
84
|
-
auth-scheme: token
|
|
85
|
-
challenge: |
|
|
86
|
-
auth-scheme [ 1*SP ( token68 / [ auth-param *( OWS "," OWS auth-param ) ] ) ]
|
|
87
|
-
codings: |
|
|
88
|
-
content-coding / "identity" / "*"
|
|
89
|
-
comment: |
|
|
90
|
-
"(" *( ctext / quoted-pair / comment ) ")"
|
|
91
|
-
complete-length: 1*DIGIT
|
|
92
|
-
connection-option: token
|
|
93
|
-
content-coding: token
|
|
94
|
-
credentials: |
|
|
95
|
-
auth-scheme [ 1*SP ( token68 / [ auth-param *( OWS "," OWS auth-param ) ] ) ]
|
|
96
|
-
ctext: |
|
|
97
|
-
HTAB / SP / %x21-27 / %x2A-5B / %x5D-7E / obs-text
|
|
98
|
-
date1: day SP month SP year
|
|
99
|
-
date2: day "-" month "-" 2DIGIT
|
|
100
|
-
date3: |
|
|
101
|
-
month SP ( 2DIGIT / ( SP DIGIT ) )
|
|
102
|
-
day: 2DIGIT
|
|
103
|
-
day-name: >
|
|
104
|
-
%x4D.6F.6E / %x54.75.65 / %x57.65.64 / %x54.68.75 / %x46.72.69 / %x53.61.74 /
|
|
105
|
-
%x53.75.6E
|
|
106
|
-
day-name-l: >
|
|
107
|
-
%x4D.6F.6E.64.61.79 / %x54.75.65.73.64.61.79 / %x57.65.64.6E.65.73.64.61.79 /
|
|
108
|
-
%x54.68.75.72.73.64.61.79 / %x46.72.69.64.61.79 / %x53.61.74.75.72.64.61.79 /
|
|
109
|
-
%x53.75.6E.64.61.79
|
|
110
|
-
delay-seconds: 1*DIGIT
|
|
111
|
-
entity-tag: |
|
|
112
|
-
[ weak ] opaque-tag
|
|
113
|
-
etagc: |
|
|
114
|
-
"!" / %x23-7E / obs-text
|
|
115
|
-
expectation: |
|
|
116
|
-
token [ "=" ( token / quoted-string ) parameters ]
|
|
117
|
-
field-content: |
|
|
118
|
-
field-vchar [ 1*( SP / HTAB / field-vchar ) field-vchar ]
|
|
119
|
-
field-name: token
|
|
120
|
-
field-value: '*field-content'
|
|
121
|
-
field-vchar: VCHAR / obs-text
|
|
122
|
-
first-pos: 1*DIGIT
|
|
123
|
-
hour: 2DIGIT
|
|
124
|
-
http-URI: |
|
|
125
|
-
"http://" authority path-abempty [ "?" query ]
|
|
126
|
-
https-URI: |
|
|
127
|
-
"https://" authority path-abempty [ "?" query ]
|
|
128
|
-
incl-range: |
|
|
129
|
-
first-pos "-" last-pos
|
|
130
|
-
int-range: |
|
|
131
|
-
first-pos "-" [ last-pos ]
|
|
132
|
-
language-range: <language-range, see [RFC4647], Section 2.1>
|
|
133
|
-
language-tag: <Language-Tag, see [RFC5646], Section 2.1>
|
|
134
|
-
last-pos: 1*DIGIT
|
|
135
|
-
mailbox: <mailbox, see [RFC5322], Section 3.4>
|
|
136
|
-
media-range: |
|
|
137
|
-
( "*/*" / ( type "/*" ) / ( type "/" subtype ) ) parameters
|
|
138
|
-
media-type: |
|
|
139
|
-
type "/" subtype parameters
|
|
140
|
-
method: token
|
|
141
|
-
minute: 2DIGIT
|
|
142
|
-
month: >
|
|
143
|
-
%x4A.61.6E / %x46.65.62 / %x4D.61.72 / %x41.70.72 / %x4D.61.79 / %x4A.75.6E /
|
|
144
|
-
%x4A.75.6C / %x41.75.67 / %x53.65.70 / %x4F.63.74 / %x4E.6F.76 / %x44.65.63
|
|
145
|
-
obs-date: |
|
|
146
|
-
rfc850-date / asctime-date
|
|
147
|
-
obs-text: '%x80-FF'
|
|
148
|
-
opaque-tag: |
|
|
149
|
-
DQUOTE *etagc DQUOTE
|
|
150
|
-
other-range: |
|
|
151
|
-
1*( %x21-2B / %x2D-7E )
|
|
152
|
-
parameter: |
|
|
153
|
-
parameter-name "=" parameter-value
|
|
154
|
-
parameter-name: token
|
|
155
|
-
parameter-value: |
|
|
156
|
-
( token / quoted-string )
|
|
157
|
-
parameters: |
|
|
158
|
-
*( OWS ";" OWS [ parameter ] )
|
|
159
|
-
partial-URI: |
|
|
160
|
-
relative-part [ "?" query ]
|
|
161
|
-
product: |
|
|
162
|
-
token [ "/" product-version ]
|
|
163
|
-
product-version: token
|
|
164
|
-
protocol: |
|
|
165
|
-
protocol-name [ "/" protocol-version ]
|
|
166
|
-
protocol-name: token
|
|
167
|
-
protocol-version: token
|
|
168
|
-
pseudonym: token
|
|
169
|
-
qdtext: |
|
|
170
|
-
HTAB / SP / "!" / %x23-5B / %x5D-7E / obs-text
|
|
171
|
-
quoted-pair: |
|
|
172
|
-
"\" ( HTAB / SP / VCHAR / obs-text )
|
|
173
|
-
quoted-string: |
|
|
174
|
-
DQUOTE *( qdtext / quoted-pair ) DQUOTE
|
|
175
|
-
qvalue: |
|
|
176
|
-
( "0" [ "." *3DIGIT ] ) / ( "1" [ "." *3"0" ] )
|
|
177
|
-
range-resp: |
|
|
178
|
-
incl-range "/" ( complete-length / "*" )
|
|
179
|
-
range-set: |
|
|
180
|
-
range-spec *( OWS "," OWS range-spec )
|
|
181
|
-
range-spec: |
|
|
182
|
-
int-range / suffix-range / other-range
|
|
183
|
-
range-unit: token
|
|
184
|
-
ranges-specifier: |
|
|
185
|
-
range-unit "=" range-set
|
|
186
|
-
received-by: |
|
|
187
|
-
pseudonym [ ":" port ]
|
|
188
|
-
received-protocol: |
|
|
189
|
-
[ protocol-name "/" ] protocol-version
|
|
190
|
-
rfc850-date: |
|
|
191
|
-
day-name-l "," SP date2 SP time-of-day SP GMT
|
|
192
|
-
second: 2DIGIT
|
|
193
|
-
subtype: token
|
|
194
|
-
suffix-length: 1*DIGIT
|
|
195
|
-
suffix-range: |
|
|
196
|
-
"-" suffix-length
|
|
197
|
-
t-codings: |
|
|
198
|
-
"trailers" / ( transfer-coding [ weight ] )
|
|
199
|
-
tchar: >
|
|
200
|
-
"!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." / "^" / "_" / "`" /
|
|
201
|
-
"|" / "~" / DIGIT / ALPHA
|
|
202
|
-
time-of-day: |
|
|
203
|
-
hour ":" minute ":" second
|
|
204
|
-
token: 1*tchar
|
|
205
|
-
token68: |
|
|
206
|
-
1*( ALPHA / DIGIT / "-" / "." / "_" / "~" / "+" / "/" ) *"="
|
|
207
|
-
transfer-coding: |
|
|
208
|
-
token *( OWS ";" OWS transfer-parameter )
|
|
209
|
-
transfer-parameter: |
|
|
210
|
-
token BWS "=" BWS ( token / quoted-string )
|
|
211
|
-
type: token
|
|
212
|
-
unsatisfied-range: |
|
|
213
|
-
"*/" complete-length
|
|
214
|
-
uri-host: |
|
|
215
|
-
host
|
|
216
|
-
weak: '%x57.2F'
|
|
217
|
-
weight: |
|
|
218
|
-
OWS ";" OWS "q=" qvalue
|
|
219
|
-
year: 4DIGIT
|
|
220
|
-
# RFC 9112
|
|
221
|
-
HTTP-message: |
|
|
222
|
-
start-line CRLF *( field-line CRLF ) CRLF [ message-body ]
|
|
223
|
-
HTTP-name: '%x48.54.54.50'
|
|
224
|
-
HTTP-version: |
|
|
225
|
-
HTTP-name "/" DIGIT "." DIGIT
|
|
226
|
-
Transfer-Encoding: |
|
|
227
|
-
[ transfer-coding *( OWS "," OWS transfer-coding ) ]
|
|
228
|
-
absolute-form: absolute-URI
|
|
229
|
-
asterisk-form: '*'
|
|
230
|
-
authority-form: |
|
|
231
|
-
uri-host ":" port
|
|
232
|
-
chunk: |
|
|
233
|
-
chunk-size [ chunk-ext ] CRLF chunk-data CRLF
|
|
234
|
-
chunk-data: |
|
|
235
|
-
1*OCTET
|
|
236
|
-
chunk-ext: |
|
|
237
|
-
*( BWS ";" BWS chunk-ext-name [ BWS "=" BWS chunk-ext-val ] )
|
|
238
|
-
chunk-ext-name: token
|
|
239
|
-
chunk-ext-val: |
|
|
240
|
-
token / quoted-string
|
|
241
|
-
chunk-size: |
|
|
242
|
-
1*HEXDIG
|
|
243
|
-
chunked-body: |
|
|
244
|
-
*chunk last-chunk trailer-section CRLF
|
|
245
|
-
field-line: |
|
|
246
|
-
field-name ":" OWS field-value OWS
|
|
247
|
-
last-chunk: |
|
|
248
|
-
1*"0" [ chunk-ext ] CRLF
|
|
249
|
-
message-body: |
|
|
250
|
-
*OCTET
|
|
251
|
-
obs-fold: |
|
|
252
|
-
OWS CRLF RWS
|
|
253
|
-
origin-form: |
|
|
254
|
-
absolute-path [ "?" query ]
|
|
255
|
-
reason-phrase: |
|
|
256
|
-
1*( HTAB / SP / VCHAR / obs-text )
|
|
257
|
-
request-line: |
|
|
258
|
-
method SP request-target SP HTTP-version
|
|
259
|
-
request-target: |
|
|
260
|
-
origin-form / absolute-form / authority-form / asterisk-form
|
|
261
|
-
start-line: |
|
|
262
|
-
request-line / status-line
|
|
263
|
-
status-code: 3DIGIT
|
|
264
|
-
status-line: |
|
|
265
|
-
HTTP-version SP status-code SP [ reason-phrase ]
|
|
266
|
-
trailer-section: |
|
|
267
|
-
*( field-line CRLF )
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'vitest';
|
|
2
|
-
import id from '../index.js';
|
|
3
|
-
// not yet done
|
|
4
|
-
const resolveTests = [
|
|
5
|
-
['', 'hTTp://example.com/b/c/d/e', 'http://example.com/b/c/d/e'], // scheme to lowercase
|
|
6
|
-
['', 'http://eXaMpLe.com/b/c/d/e', 'http://example.com/b/c/d/e'], // authority to lowercase
|
|
7
|
-
['', 'http://example.com/b%2Ec/d/e', 'http://example.com/b.c/d/e'], // Unnecessary encoding segment
|
|
8
|
-
['', 'http://example.com/b%2Fc/d/e', 'http://example.com/b%2Fc/d/e'], // Necessary encoding segment
|
|
9
|
-
['', 'http://example.com/b%2fc/d/e', 'http://example.com/b%2Fc/d/e'], // Case normalization of encoding segment
|
|
10
|
-
['', 'http://example.com/b?c%2Fd%3Fe', 'http://example.com/b?c/d?e'], // Unnecessary encoding query
|
|
11
|
-
['#c%2Fd%3Fe', 'http://example.com/b', 'http://example.com/b#c/d?e'], // Unnecessary encoding fragment
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
describe('resolveReference', () => {
|
|
15
|
-
resolveTests.forEach(([reference, base, expected]) => {
|
|
16
|
-
test(`resolveReference('${reference}', '${base}') === '${expected}'`, () => {
|
|
17
|
-
const subject = id.normalizeReference(reference, base);
|
|
18
|
-
expect(subject).to.equal(expected);
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
});
|