1# -*- tcl -*- 2# ------------------------------------------------------------------------------ 3 4source [file join \ 5 [file dirname [file dirname [file join [pwd] [info script]]]] \ 6 devtools testutilities.tcl] 7 8testsNeedTcl 8.2 9testsNeedTcltest 1.0 10 11testing { 12 useLocal uri.tcl uri 13} 14 15# ------------------------------------------------------------------------------ 16# 2016-12-16 to 2017-01-09 revisions (KJN) 17# ------------------------------------------------------------------------------ 18# (1) Test results corrected to match RFC 3986 Sec. 5.4.1 for tests: 19# uri-rfc2396-1.7 uri-rfc2396-1.9 uri-rfc2396-2.7 uri-rfc2396-2.9 20# (2) Add tests uri-rfc2396-1.14a uri-rfc2396-2.14a from the list in RFC 3986. 21# (3) All tests now pass: existing "knownBug" constraints removed. 22# (4) Add tests uri-rfc2396-3.*, uri-rfc2396-4.* for different cases of query 23# and fragment. 24# (5) Add tests uri-rfc2396-5.*, uri-rfc2396-8.* for uri::resolve without 25# explicit call to uri::canonicalize. 26# (6) Add tests uri-rfc2396-11.*, uri-rfc2396-12.* from RFC 3986 Sec. 5.4.2 27# "Abnormal Examples". 28# (7) Tests uri-rfc2396-11.19, uri-rfc2396-12.19 fail - new "knownBug" 29# constraints and explanation added. 30# ------------------------------------------------------------------------------ 31 32# Test the "Normal Examples" from RFC 3986 Sec. 5.4.1. 33 34test uri-rfc2396-1.1 {uri::resolve} { 35 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q g:h] 36} g:h 37 38test uri-rfc2396-1.2 {uri::resolve} { 39 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q g] 40} http://a/b/c/g 41 42test uri-rfc2396-1.3 {uri::resolve} { 43 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q ./g] 44} http://a/b/c/g 45 46test uri-rfc2396-1.4 {uri::resolve} { 47 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q g/] 48} http://a/b/c/g/ 49 50test uri-rfc2396-1.5 {uri::resolve} { 51 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q /g] 52} http://a/g 53 54test uri-rfc2396-1.6 {uri::resolve} {} { 55 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q //g] 56} http://g 57 58test uri-rfc2396-1.7 {uri::resolve} { 59 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q ?y] 60} {http://a/b/c/d;p?y} 61 62test uri-rfc2396-1.8 {uri::resolve} { 63 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q g?y] 64} http://a/b/c/g?y 65 66test uri-rfc2396-1.9 {uri::resolve} { 67 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q \#s] 68} {http://a/b/c/d;p?q#s} 69 70test uri-rfc2396-1.10 {uri::resolve} { 71 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q g\#s] 72} http://a/b/c/g#s 73 74test uri-rfc2396-1.11 {uri::resolve} { 75 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q g?y\#s] 76} http://a/b/c/g?y#s 77 78test uri-rfc2396-1.12 {uri::resolve} { 79 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q \;x] 80} {http://a/b/c/;x} 81 82test uri-rfc2396-1.13 {uri::resolve} { 83 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q g\;x] 84} {http://a/b/c/g;x} 85 86test uri-rfc2396-1.14 {uri::resolve} { 87 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q g\;x?y#s] 88} {http://a/b/c/g;x?y#s} 89 90test uri-rfc2396-1.14a {uri::resolve} { 91 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q {}] 92} {http://a/b/c/d;p?q} 93 94test uri-rfc2396-1.15 {uri::resolve} { 95 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q .] 96} http://a/b/c/ 97 98test uri-rfc2396-1.16 {uri::resolve} { 99 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q ./] 100} http://a/b/c/ 101 102test uri-rfc2396-1.17 {uri::resolve} { 103 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q ..] 104} http://a/b/ 105 106test uri-rfc2396-1.18 {uri::resolve} { 107 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q ../] 108} http://a/b/ 109 110test uri-rfc2396-1.19 {uri::resolve} { 111 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q ../g] 112} http://a/b/g 113 114test uri-rfc2396-1.20 {uri::resolve} { 115 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q ../..] 116} http://a/ 117 118test uri-rfc2396-1.21 {uri::resolve} { 119 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q ../../] 120} http://a/ 121 122test uri-rfc2396-1.22 {uri::resolve} { 123 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q ../../g] 124} http://a/g 125 126 127# Cf. the "Normal Examples" from RFC 3986 Sec. 5.4.1. 128# The tests below are similar, but the base URL omits the query-string "?q". 129 130test uri-rfc2396-2.1 {uri::resolve} { 131 uri::canonicalize [uri::resolve http://a/b/c/d\;p g:h] 132} g:h 133 134test uri-rfc2396-2.2 {uri::resolve} { 135 uri::canonicalize [uri::resolve http://a/b/c/d\;p g] 136} http://a/b/c/g 137 138test uri-rfc2396-2.3 {uri::resolve} { 139 uri::canonicalize [uri::resolve http://a/b/c/d\;p ./g] 140} http://a/b/c/g 141 142test uri-rfc2396-2.4 {uri::resolve} { 143 uri::canonicalize [uri::resolve http://a/b/c/d\;p g/] 144} http://a/b/c/g/ 145 146test uri-rfc2396-2.5 {uri::resolve} { 147 uri::canonicalize [uri::resolve http://a/b/c/d\;p /g] 148} http://a/g 149 150test uri-rfc2396-2.6 {uri::resolve} {} { 151 uri::canonicalize [uri::resolve http://a/b/c/d\;p //g] 152} http://g 153 154test uri-rfc2396-2.7 {uri::resolve} { 155 uri::canonicalize [uri::resolve http://a/b/c/d\;p ?y] 156} {http://a/b/c/d;p?y} 157 158test uri-rfc2396-2.8 {uri::resolve} { 159 uri::canonicalize [uri::resolve http://a/b/c/d\;p g?y] 160} http://a/b/c/g?y 161 162test uri-rfc2396-2.9 {uri::resolve} { 163 uri::canonicalize [uri::resolve http://a/b/c/d\;p \#s] 164} {http://a/b/c/d;p#s} 165 166test uri-rfc2396-2.10 {uri::resolve} { 167 uri::canonicalize [uri::resolve http://a/b/c/d\;p g\#s] 168} http://a/b/c/g#s 169 170test uri-rfc2396-2.11 {uri::resolve} { 171 uri::canonicalize [uri::resolve http://a/b/c/d\;p g?y\#s] 172} http://a/b/c/g?y#s 173 174test uri-rfc2396-2.12 {uri::resolve} { 175 uri::canonicalize [uri::resolve http://a/b/c/d\;p \;x] 176} {http://a/b/c/;x} 177 178test uri-rfc2396-2.13 {uri::resolve} { 179 uri::canonicalize [uri::resolve http://a/b/c/d\;p g\;x] 180} {http://a/b/c/g;x} 181 182test uri-rfc2396-2.14 {uri::resolve} { 183 uri::canonicalize [uri::resolve http://a/b/c/d\;p g\;x?y#s] 184} {http://a/b/c/g;x?y#s} 185 186test uri-rfc2396-2.14a {uri::resolve} { 187 uri::canonicalize [uri::resolve http://a/b/c/d\;p {}] 188} {http://a/b/c/d;p} 189 190test uri-rfc2396-2.15 {uri::resolve} { 191 uri::canonicalize [uri::resolve http://a/b/c/d\;p .] 192} http://a/b/c/ 193 194test uri-rfc2396-2.16 {uri::resolve} { 195 uri::canonicalize [uri::resolve http://a/b/c/d\;p ./] 196} http://a/b/c/ 197 198test uri-rfc2396-2.17 {uri::resolve} { 199 uri::canonicalize [uri::resolve http://a/b/c/d\;p ..] 200} http://a/b/ 201 202test uri-rfc2396-2.18 {uri::resolve} { 203 uri::canonicalize [uri::resolve http://a/b/c/d\;p ../] 204} http://a/b/ 205 206test uri-rfc2396-2.19 {uri::resolve} { 207 uri::canonicalize [uri::resolve http://a/b/c/d\;p ../g] 208} http://a/b/g 209 210test uri-rfc2396-2.20 {uri::resolve} { 211 uri::canonicalize [uri::resolve http://a/b/c/d\;p ../..] 212} http://a/ 213 214test uri-rfc2396-2.21 {uri::resolve} { 215 uri::canonicalize [uri::resolve http://a/b/c/d\;p ../../] 216} http://a/ 217 218test uri-rfc2396-2.22 {uri::resolve} { 219 uri::canonicalize [uri::resolve http://a/b/c/d\;p ../../g] 220} http://a/g 221 222# Cf. the "Normal Examples" from RFC 3986 Sec. 5.4.1. 223# The tests below are similar, but the base URL has a fragment #f 224 225test uri-rfc2396-3.1 {uri::resolve} { 226 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q#f g:h] 227} g:h 228 229test uri-rfc2396-3.2 {uri::resolve} { 230 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q#f g] 231} http://a/b/c/g 232 233test uri-rfc2396-3.3 {uri::resolve} { 234 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q#f ./g] 235} http://a/b/c/g 236 237test uri-rfc2396-3.4 {uri::resolve} { 238 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q#f g/] 239} http://a/b/c/g/ 240 241test uri-rfc2396-3.5 {uri::resolve} { 242 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q#f /g] 243} http://a/g 244 245test uri-rfc2396-3.6 {uri::resolve} {} { 246 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q#f //g] 247} http://g 248 249test uri-rfc2396-3.7 {uri::resolve} { 250 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q#f ?y] 251} {http://a/b/c/d;p?y} 252 253test uri-rfc2396-3.8 {uri::resolve} { 254 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q#f g?y] 255} http://a/b/c/g?y 256 257test uri-rfc2396-3.9 {uri::resolve} { 258 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q#f \#s] 259} {http://a/b/c/d;p?q#s} 260 261test uri-rfc2396-3.10 {uri::resolve} { 262 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q#f g\#s] 263} http://a/b/c/g#s 264 265test uri-rfc2396-3.11 {uri::resolve} { 266 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q#f g?y\#s] 267} http://a/b/c/g?y#s 268 269test uri-rfc2396-3.12 {uri::resolve} { 270 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q#f \;x] 271} {http://a/b/c/;x} 272 273test uri-rfc2396-3.13 {uri::resolve} { 274 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q#f g\;x] 275} {http://a/b/c/g;x} 276 277test uri-rfc2396-3.14 {uri::resolve} { 278 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q#f g\;x?y#s] 279} {http://a/b/c/g;x?y#s} 280 281test uri-rfc2396-3.14a {uri::resolve} { 282 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q#f {}] 283} {http://a/b/c/d;p?q} 284 285test uri-rfc2396-3.15 {uri::resolve} { 286 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q#f .] 287} http://a/b/c/ 288 289test uri-rfc2396-3.16 {uri::resolve} { 290 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q#f ./] 291} http://a/b/c/ 292 293test uri-rfc2396-3.17 {uri::resolve} { 294 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q#f ..] 295} http://a/b/ 296 297test uri-rfc2396-3.18 {uri::resolve} { 298 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q#f ../] 299} http://a/b/ 300 301test uri-rfc2396-3.19 {uri::resolve} { 302 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q#f ../g] 303} http://a/b/g 304 305test uri-rfc2396-3.20 {uri::resolve} { 306 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q#f ../..] 307} http://a/ 308 309test uri-rfc2396-3.21 {uri::resolve} { 310 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q#f ../../] 311} http://a/ 312 313test uri-rfc2396-3.22 {uri::resolve} { 314 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q#f ../../g] 315} http://a/g 316 317 318# Cf. the "Normal Examples" from RFC 3986 Sec. 5.4.1. 319# The tests below are similar, but the base URL omits the query-string "?q" and has a fragment #f. 320 321test uri-rfc2396-4.1 {uri::resolve} { 322 uri::canonicalize [uri::resolve http://a/b/c/d\;p#f g:h] 323} g:h 324 325test uri-rfc2396-4.2 {uri::resolve} { 326 uri::canonicalize [uri::resolve http://a/b/c/d\;p#f g] 327} http://a/b/c/g 328 329test uri-rfc2396-4.3 {uri::resolve} { 330 uri::canonicalize [uri::resolve http://a/b/c/d\;p#f ./g] 331} http://a/b/c/g 332 333test uri-rfc2396-4.4 {uri::resolve} { 334 uri::canonicalize [uri::resolve http://a/b/c/d\;p#f g/] 335} http://a/b/c/g/ 336 337test uri-rfc2396-4.5 {uri::resolve} { 338 uri::canonicalize [uri::resolve http://a/b/c/d\;p#f /g] 339} http://a/g 340 341test uri-rfc2396-4.6 {uri::resolve} {} { 342 uri::canonicalize [uri::resolve http://a/b/c/d\;p#f //g] 343} http://g 344 345test uri-rfc2396-4.7 {uri::resolve} { 346 uri::canonicalize [uri::resolve http://a/b/c/d\;p#f ?y] 347} {http://a/b/c/d;p?y} 348 349test uri-rfc2396-4.8 {uri::resolve} { 350 uri::canonicalize [uri::resolve http://a/b/c/d\;p#f g?y] 351} http://a/b/c/g?y 352 353test uri-rfc2396-4.9 {uri::resolve} { 354 uri::canonicalize [uri::resolve http://a/b/c/d\;p#f \#s] 355} {http://a/b/c/d;p#s} 356 357test uri-rfc2396-4.10 {uri::resolve} { 358 uri::canonicalize [uri::resolve http://a/b/c/d\;p#f g\#s] 359} http://a/b/c/g#s 360 361test uri-rfc2396-4.11 {uri::resolve} { 362 uri::canonicalize [uri::resolve http://a/b/c/d\;p#f g?y\#s] 363} http://a/b/c/g?y#s 364 365test uri-rfc2396-4.12 {uri::resolve} { 366 uri::canonicalize [uri::resolve http://a/b/c/d\;p#f \;x] 367} {http://a/b/c/;x} 368 369test uri-rfc2396-4.13 {uri::resolve} { 370 uri::canonicalize [uri::resolve http://a/b/c/d\;p#f g\;x] 371} {http://a/b/c/g;x} 372 373test uri-rfc2396-4.14 {uri::resolve} { 374 uri::canonicalize [uri::resolve http://a/b/c/d\;p#f g\;x?y#s] 375} {http://a/b/c/g;x?y#s} 376 377test uri-rfc2396-4.14a {uri::resolve} { 378 uri::canonicalize [uri::resolve http://a/b/c/d\;p#f {}] 379} {http://a/b/c/d;p} 380 381test uri-rfc2396-4.15 {uri::resolve} { 382 uri::canonicalize [uri::resolve http://a/b/c/d\;p#f .] 383} http://a/b/c/ 384 385test uri-rfc2396-4.16 {uri::resolve} { 386 uri::canonicalize [uri::resolve http://a/b/c/d\;p#f ./] 387} http://a/b/c/ 388 389test uri-rfc2396-4.17 {uri::resolve} { 390 uri::canonicalize [uri::resolve http://a/b/c/d\;p#f ..] 391} http://a/b/ 392 393test uri-rfc2396-4.18 {uri::resolve} { 394 uri::canonicalize [uri::resolve http://a/b/c/d\;p#f ../] 395} http://a/b/ 396 397test uri-rfc2396-4.19 {uri::resolve} { 398 uri::canonicalize [uri::resolve http://a/b/c/d\;p#f ../g] 399} http://a/b/g 400 401test uri-rfc2396-4.20 {uri::resolve} { 402 uri::canonicalize [uri::resolve http://a/b/c/d\;p#f ../..] 403} http://a/ 404 405test uri-rfc2396-4.21 {uri::resolve} { 406 uri::canonicalize [uri::resolve http://a/b/c/d\;p#f ../../] 407} http://a/ 408 409test uri-rfc2396-4.22 {uri::resolve} { 410 uri::canonicalize [uri::resolve http://a/b/c/d\;p#f ../../g] 411} http://a/g 412 413# Test the "Normal Examples" from RFC 3986 Sec. 5.4.1. 414# Without explicit canonicalization. 415 416test uri-rfc2396-5.1 {uri::resolve} { 417 uri::resolve http://a/b/c/d\;p?q g:h 418} g:h 419 420test uri-rfc2396-5.2 {uri::resolve} { 421 uri::resolve http://a/b/c/d\;p?q g 422} http://a/b/c/g 423 424test uri-rfc2396-5.3 {uri::resolve} { 425 uri::resolve http://a/b/c/d\;p?q ./g 426} http://a/b/c/g 427 428test uri-rfc2396-5.4 {uri::resolve} { 429 uri::resolve http://a/b/c/d\;p?q g/ 430} http://a/b/c/g/ 431 432test uri-rfc2396-5.5 {uri::resolve} { 433 uri::resolve http://a/b/c/d\;p?q /g 434} http://a/g 435 436test uri-rfc2396-5.6 {uri::resolve} {} { 437 uri::resolve http://a/b/c/d\;p?q //g 438} http://g 439 440test uri-rfc2396-5.7 {uri::resolve} { 441 uri::resolve http://a/b/c/d\;p?q ?y 442} {http://a/b/c/d;p?y} 443 444test uri-rfc2396-5.8 {uri::resolve} { 445 uri::resolve http://a/b/c/d\;p?q g?y 446} http://a/b/c/g?y 447 448test uri-rfc2396-5.9 {uri::resolve} { 449 uri::resolve http://a/b/c/d\;p?q \#s 450} {http://a/b/c/d;p?q#s} 451 452test uri-rfc2396-5.10 {uri::resolve} { 453 uri::resolve http://a/b/c/d\;p?q g\#s 454} http://a/b/c/g#s 455 456test uri-rfc2396-5.11 {uri::resolve} { 457 uri::resolve http://a/b/c/d\;p?q g?y\#s 458} http://a/b/c/g?y#s 459 460test uri-rfc2396-5.12 {uri::resolve} { 461 uri::resolve http://a/b/c/d\;p?q \;x 462} {http://a/b/c/;x} 463 464test uri-rfc2396-5.13 {uri::resolve} { 465 uri::resolve http://a/b/c/d\;p?q g\;x 466} {http://a/b/c/g;x} 467 468test uri-rfc2396-5.14 {uri::resolve} { 469 uri::resolve http://a/b/c/d\;p?q g\;x?y#s 470} {http://a/b/c/g;x?y#s} 471 472test uri-rfc2396-5.14a {uri::resolve} { 473 uri::resolve http://a/b/c/d\;p?q {} 474} {http://a/b/c/d;p?q} 475 476test uri-rfc2396-5.15 {uri::resolve} { 477 uri::resolve http://a/b/c/d\;p?q . 478} http://a/b/c/ 479 480test uri-rfc2396-5.16 {uri::resolve} { 481 uri::resolve http://a/b/c/d\;p?q ./ 482} http://a/b/c/ 483 484test uri-rfc2396-5.17 {uri::resolve} { 485 uri::resolve http://a/b/c/d\;p?q .. 486} http://a/b/ 487 488test uri-rfc2396-5.18 {uri::resolve} { 489 uri::resolve http://a/b/c/d\;p?q ../ 490} http://a/b/ 491 492test uri-rfc2396-5.19 {uri::resolve} { 493 uri::resolve http://a/b/c/d\;p?q ../g 494} http://a/b/g 495 496test uri-rfc2396-5.20 {uri::resolve} { 497 uri::resolve http://a/b/c/d\;p?q ../.. 498} http://a/ 499 500test uri-rfc2396-5.21 {uri::resolve} { 501 uri::resolve http://a/b/c/d\;p?q ../../ 502} http://a/ 503 504test uri-rfc2396-5.22 {uri::resolve} { 505 uri::resolve http://a/b/c/d\;p?q ../../g 506} http://a/g 507 508 509# Cf. the "Normal Examples" from RFC 3986 Sec. 5.4.1. 510# The tests below are similar, but the base URL omits the query-string "?q". 511# Without explicit canonicalization. 512 513test uri-rfc2396-6.1 {uri::resolve} { 514 uri::resolve http://a/b/c/d\;p g:h 515} g:h 516 517test uri-rfc2396-6.2 {uri::resolve} { 518 uri::resolve http://a/b/c/d\;p g 519} http://a/b/c/g 520 521test uri-rfc2396-6.3 {uri::resolve} { 522 uri::resolve http://a/b/c/d\;p ./g 523} http://a/b/c/g 524 525test uri-rfc2396-6.4 {uri::resolve} { 526 uri::resolve http://a/b/c/d\;p g/ 527} http://a/b/c/g/ 528 529test uri-rfc2396-6.5 {uri::resolve} { 530 uri::resolve http://a/b/c/d\;p /g 531} http://a/g 532 533test uri-rfc2396-6.6 {uri::resolve} {} { 534 uri::resolve http://a/b/c/d\;p //g 535} http://g 536 537test uri-rfc2396-6.7 {uri::resolve} { 538 uri::resolve http://a/b/c/d\;p ?y 539} {http://a/b/c/d;p?y} 540 541test uri-rfc2396-6.8 {uri::resolve} { 542 uri::resolve http://a/b/c/d\;p g?y 543} http://a/b/c/g?y 544 545test uri-rfc2396-6.9 {uri::resolve} { 546 uri::resolve http://a/b/c/d\;p \#s 547} {http://a/b/c/d;p#s} 548 549test uri-rfc2396-6.10 {uri::resolve} { 550 uri::resolve http://a/b/c/d\;p g\#s 551} http://a/b/c/g#s 552 553test uri-rfc2396-6.11 {uri::resolve} { 554 uri::resolve http://a/b/c/d\;p g?y\#s 555} http://a/b/c/g?y#s 556 557test uri-rfc2396-6.12 {uri::resolve} { 558 uri::resolve http://a/b/c/d\;p \;x 559} {http://a/b/c/;x} 560 561test uri-rfc2396-6.13 {uri::resolve} { 562 uri::resolve http://a/b/c/d\;p g\;x 563} {http://a/b/c/g;x} 564 565test uri-rfc2396-6.14 {uri::resolve} { 566 uri::resolve http://a/b/c/d\;p g\;x?y#s 567} {http://a/b/c/g;x?y#s} 568 569test uri-rfc2396-6.14a {uri::resolve} { 570 uri::resolve http://a/b/c/d\;p {} 571} {http://a/b/c/d;p} 572 573test uri-rfc2396-6.15 {uri::resolve} { 574 uri::resolve http://a/b/c/d\;p . 575} http://a/b/c/ 576 577test uri-rfc2396-6.16 {uri::resolve} { 578 uri::resolve http://a/b/c/d\;p ./ 579} http://a/b/c/ 580 581test uri-rfc2396-6.17 {uri::resolve} { 582 uri::resolve http://a/b/c/d\;p .. 583} http://a/b/ 584 585test uri-rfc2396-6.18 {uri::resolve} { 586 uri::resolve http://a/b/c/d\;p ../ 587} http://a/b/ 588 589test uri-rfc2396-6.19 {uri::resolve} { 590 uri::resolve http://a/b/c/d\;p ../g 591} http://a/b/g 592 593test uri-rfc2396-6.20 {uri::resolve} { 594 uri::resolve http://a/b/c/d\;p ../.. 595} http://a/ 596 597test uri-rfc2396-6.21 {uri::resolve} { 598 uri::resolve http://a/b/c/d\;p ../../ 599} http://a/ 600 601test uri-rfc2396-6.22 {uri::resolve} { 602 uri::resolve http://a/b/c/d\;p ../../g 603} http://a/g 604 605# Cf. the "Normal Examples" from RFC 3986 Sec. 5.4.1. 606# The tests below are similar, but the base URL has a fragment #f 607# Without explicit canonicalization. 608 609test uri-rfc2396-7.1 {uri::resolve} { 610 uri::resolve http://a/b/c/d\;p?q#f g:h 611} g:h 612 613test uri-rfc2396-7.2 {uri::resolve} { 614 uri::resolve http://a/b/c/d\;p?q#f g 615} http://a/b/c/g 616 617test uri-rfc2396-7.3 {uri::resolve} { 618 uri::resolve http://a/b/c/d\;p?q#f ./g 619} http://a/b/c/g 620 621test uri-rfc2396-7.4 {uri::resolve} { 622 uri::resolve http://a/b/c/d\;p?q#f g/ 623} http://a/b/c/g/ 624 625test uri-rfc2396-7.5 {uri::resolve} { 626 uri::resolve http://a/b/c/d\;p?q#f /g 627} http://a/g 628 629test uri-rfc2396-7.6 {uri::resolve} {} { 630 uri::resolve http://a/b/c/d\;p?q#f //g 631} http://g 632 633test uri-rfc2396-7.7 {uri::resolve} { 634 uri::resolve http://a/b/c/d\;p?q#f ?y 635} {http://a/b/c/d;p?y} 636 637test uri-rfc2396-7.8 {uri::resolve} { 638 uri::resolve http://a/b/c/d\;p?q#f g?y 639} http://a/b/c/g?y 640 641test uri-rfc2396-7.9 {uri::resolve} { 642 uri::resolve http://a/b/c/d\;p?q#f \#s 643} {http://a/b/c/d;p?q#s} 644 645test uri-rfc2396-7.10 {uri::resolve} { 646 uri::resolve http://a/b/c/d\;p?q#f g\#s 647} http://a/b/c/g#s 648 649test uri-rfc2396-7.11 {uri::resolve} { 650 uri::resolve http://a/b/c/d\;p?q#f g?y\#s 651} http://a/b/c/g?y#s 652 653test uri-rfc2396-7.12 {uri::resolve} { 654 uri::resolve http://a/b/c/d\;p?q#f \;x 655} {http://a/b/c/;x} 656 657test uri-rfc2396-7.13 {uri::resolve} { 658 uri::resolve http://a/b/c/d\;p?q#f g\;x 659} {http://a/b/c/g;x} 660 661test uri-rfc2396-7.14 {uri::resolve} { 662 uri::resolve http://a/b/c/d\;p?q#f g\;x?y#s 663} {http://a/b/c/g;x?y#s} 664 665test uri-rfc2396-7.14a {uri::resolve} { 666 uri::resolve http://a/b/c/d\;p?q#f {} 667} {http://a/b/c/d;p?q} 668 669test uri-rfc2396-7.15 {uri::resolve} { 670 uri::resolve http://a/b/c/d\;p?q#f . 671} http://a/b/c/ 672 673test uri-rfc2396-7.16 {uri::resolve} { 674 uri::resolve http://a/b/c/d\;p?q#f ./ 675} http://a/b/c/ 676 677test uri-rfc2396-7.17 {uri::resolve} { 678 uri::resolve http://a/b/c/d\;p?q#f .. 679} http://a/b/ 680 681test uri-rfc2396-7.18 {uri::resolve} { 682 uri::resolve http://a/b/c/d\;p?q#f ../ 683} http://a/b/ 684 685test uri-rfc2396-7.19 {uri::resolve} { 686 uri::resolve http://a/b/c/d\;p?q#f ../g 687} http://a/b/g 688 689test uri-rfc2396-7.20 {uri::resolve} { 690 uri::resolve http://a/b/c/d\;p?q#f ../.. 691} http://a/ 692 693test uri-rfc2396-7.21 {uri::resolve} { 694 uri::resolve http://a/b/c/d\;p?q#f ../../ 695} http://a/ 696 697test uri-rfc2396-7.22 {uri::resolve} { 698 uri::resolve http://a/b/c/d\;p?q#f ../../g 699} http://a/g 700 701# Cf. the "Normal Examples" from RFC 3986 Sec. 5.4.1. 702# The tests below are similar, but the base URL omits the query-string "?q" and has a fragment #f. 703# Without explicit canonicalization. 704 705test uri-rfc2396-8.1 {uri::resolve} { 706 uri::resolve http://a/b/c/d\;p#f g:h 707} g:h 708 709test uri-rfc2396-8.2 {uri::resolve} { 710 uri::resolve http://a/b/c/d\;p#f g 711} http://a/b/c/g 712 713test uri-rfc2396-8.3 {uri::resolve} { 714 uri::resolve http://a/b/c/d\;p#f ./g 715} http://a/b/c/g 716 717test uri-rfc2396-8.4 {uri::resolve} { 718 uri::resolve http://a/b/c/d\;p#f g/ 719} http://a/b/c/g/ 720 721test uri-rfc2396-8.5 {uri::resolve} { 722 uri::resolve http://a/b/c/d\;p#f /g 723} http://a/g 724 725test uri-rfc2396-8.6 {uri::resolve} {} { 726 uri::resolve http://a/b/c/d\;p#f //g 727} http://g 728 729test uri-rfc2396-8.7 {uri::resolve} { 730 uri::resolve http://a/b/c/d\;p#f ?y 731} {http://a/b/c/d;p?y} 732 733test uri-rfc2396-8.8 {uri::resolve} { 734 uri::resolve http://a/b/c/d\;p#f g?y 735} http://a/b/c/g?y 736 737test uri-rfc2396-8.9 {uri::resolve} { 738 uri::resolve http://a/b/c/d\;p#f \#s 739} {http://a/b/c/d;p#s} 740 741test uri-rfc2396-8.10 {uri::resolve} { 742 uri::resolve http://a/b/c/d\;p#f g\#s 743} http://a/b/c/g#s 744 745test uri-rfc2396-8.11 {uri::resolve} { 746 uri::resolve http://a/b/c/d\;p#f g?y\#s 747} http://a/b/c/g?y#s 748 749test uri-rfc2396-8.12 {uri::resolve} { 750 uri::resolve http://a/b/c/d\;p#f \;x 751} {http://a/b/c/;x} 752 753test uri-rfc2396-8.13 {uri::resolve} { 754 uri::resolve http://a/b/c/d\;p#f g\;x 755} {http://a/b/c/g;x} 756 757test uri-rfc2396-8.14 {uri::resolve} { 758 uri::resolve http://a/b/c/d\;p#f g\;x?y#s 759} {http://a/b/c/g;x?y#s} 760 761test uri-rfc2396-8.14a {uri::resolve} { 762 uri::resolve http://a/b/c/d\;p#f {} 763} {http://a/b/c/d;p} 764 765test uri-rfc2396-8.15 {uri::resolve} { 766 uri::resolve http://a/b/c/d\;p#f . 767} http://a/b/c/ 768 769test uri-rfc2396-8.16 {uri::resolve} { 770 uri::resolve http://a/b/c/d\;p#f ./ 771} http://a/b/c/ 772 773test uri-rfc2396-8.17 {uri::resolve} { 774 uri::resolve http://a/b/c/d\;p#f .. 775} http://a/b/ 776 777test uri-rfc2396-8.18 {uri::resolve} { 778 uri::resolve http://a/b/c/d\;p#f ../ 779} http://a/b/ 780 781test uri-rfc2396-8.19 {uri::resolve} { 782 uri::resolve http://a/b/c/d\;p#f ../g 783} http://a/b/g 784 785test uri-rfc2396-8.20 {uri::resolve} { 786 uri::resolve http://a/b/c/d\;p#f ../.. 787} http://a/ 788 789test uri-rfc2396-8.21 {uri::resolve} { 790 uri::resolve http://a/b/c/d\;p#f ../../ 791} http://a/ 792 793test uri-rfc2396-8.22 {uri::resolve} { 794 uri::resolve http://a/b/c/d\;p#f ../../g 795} http://a/g 796 797 798# Now tests from RFC 3986 Sec. 5.4.2. "Abnormal Examples". 799 800test uri-rfc2396-11.1 {uri::resolve abnormal examples} { 801 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q ../../../g] 802} http://a/g 803 804test uri-rfc2396-11.2 {uri::resolve abnormal examples} { 805 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q ../../../../g] 806} http://a/g 807 808test uri-rfc2396-11.3 {uri::resolve abnormal examples} { 809 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q /./g] 810} http://a/g 811 812test uri-rfc2396-11.4 {uri::resolve abnormal examples} { 813 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q /../g] 814} http://a/g 815 816test uri-rfc2396-11.5 {uri::resolve abnormal examples} { 817 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q g.] 818} http://a/b/c/g. 819 820test uri-rfc2396-11.6 {uri::resolve abnormal examples} { 821 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q .g] 822} http://a/b/c/.g 823 824test uri-rfc2396-11.7 {uri::resolve abnormal examples} { 825 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q g..] 826} http://a/b/c/g.. 827 828test uri-rfc2396-11.8 {uri::resolve abnormal examples} { 829 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q ..g] 830} http://a/b/c/..g 831 832test uri-rfc2396-11.9 {uri::resolve abnormal examples} { 833 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q ./../g] 834} http://a/b/g 835 836test uri-rfc2396-11.10 {uri::resolve abnormal examples} { 837 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q ./g/.] 838} http://a/b/c/g/ 839 840test uri-rfc2396-11.11 {uri::resolve abnormal examples} { 841 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q g/./h] 842} http://a/b/c/g/h 843 844test uri-rfc2396-11.12 {uri::resolve abnormal examples} { 845 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q g/../h] 846} http://a/b/c/h 847 848test uri-rfc2396-11.13 {uri::resolve abnormal examples} { 849 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q g\;x=1/./y] 850} {http://a/b/c/g;x=1/y} 851 852test uri-rfc2396-11.14 {uri::resolve abnormal examples} { 853 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q g\;x=1/../y] 854} http://a/b/c/y 855 856test uri-rfc2396-11.15 {uri::resolve abnormal examples} { 857 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q g?y/./x] 858} http://a/b/c/g?y/./x 859 860test uri-rfc2396-11.16 {uri::resolve abnormal examples} { 861 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q g?y/../x] 862} http://a/b/c/g?y/../x 863 864test uri-rfc2396-11.17 {uri::resolve abnormal examples} { 865 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q g#s/./x] 866} http://a/b/c/g#s/./x 867 868test uri-rfc2396-11.18 {uri::resolve abnormal examples} { 869 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q g#s/../x] 870} http://a/b/c/g#s/../x 871 872test uri-rfc2396-11.19 {uri::resolve abnormal examples 873 RFC 3986 Sec. 5.4.2 advises avoiding this usage which is a loophole 874 in RFC 1630, which allows a relative URI to specify the scheme if it 875 is the same as the scheme of the base URI. 876 uri::resolve is a "strict parser" in the sense of RFC 3986 Sec. 5.2.2: 877 however, it does not handle the loophole correctly and fails this test. 878} {knownBug rfc1630-loophole-avoid-use} { 879 uri::canonicalize [uri::resolve http://a/b/c/d\;p?q http:g] 880} http:g 881 882# Cf. tests from RFC 3986 Sec. 5.4.2. "Abnormal Examples". 883# Without explicit canonicalization. 884 885test uri-rfc2396-12.1 {uri::resolve abnormal examples} { 886 uri::resolve http://a/b/c/d\;p?q ../../../g 887} http://a/g 888 889test uri-rfc2396-12.2 {uri::resolve abnormal examples} { 890 uri::resolve http://a/b/c/d\;p?q ../../../../g 891} http://a/g 892 893test uri-rfc2396-12.3 {uri::resolve abnormal examples} { 894 uri::resolve http://a/b/c/d\;p?q /./g 895} http://a/g 896 897test uri-rfc2396-12.4 {uri::resolve abnormal examples} { 898 uri::resolve http://a/b/c/d\;p?q /../g 899} http://a/g 900 901test uri-rfc2396-12.5 {uri::resolve abnormal examples} { 902 uri::resolve http://a/b/c/d\;p?q g. 903} http://a/b/c/g. 904 905test uri-rfc2396-12.6 {uri::resolve abnormal examples} { 906 uri::resolve http://a/b/c/d\;p?q .g 907} http://a/b/c/.g 908 909test uri-rfc2396-12.7 {uri::resolve abnormal examples} { 910 uri::resolve http://a/b/c/d\;p?q g.. 911} http://a/b/c/g.. 912 913test uri-rfc2396-12.8 {uri::resolve abnormal examples} { 914 uri::resolve http://a/b/c/d\;p?q ..g 915} http://a/b/c/..g 916 917test uri-rfc2396-12.9 {uri::resolve abnormal examples} { 918 uri::resolve http://a/b/c/d\;p?q ./../g 919} http://a/b/g 920 921test uri-rfc2396-12.10 {uri::resolve abnormal examples} { 922 uri::resolve http://a/b/c/d\;p?q ./g/. 923} http://a/b/c/g/ 924 925test uri-rfc2396-12.11 {uri::resolve abnormal examples} { 926 uri::resolve http://a/b/c/d\;p?q g/./h 927} http://a/b/c/g/h 928 929test uri-rfc2396-12.12 {uri::resolve abnormal examples} { 930 uri::resolve http://a/b/c/d\;p?q g/../h 931} http://a/b/c/h 932 933test uri-rfc2396-12.13 {uri::resolve abnormal examples} { 934 uri::resolve http://a/b/c/d\;p?q g\;x=1/./y 935} {http://a/b/c/g;x=1/y} 936 937test uri-rfc2396-12.14 {uri::resolve abnormal examples} { 938 uri::resolve http://a/b/c/d\;p?q g\;x=1/../y 939} http://a/b/c/y 940 941test uri-rfc2396-12.15 {uri::resolve abnormal examples} { 942 uri::resolve http://a/b/c/d\;p?q g?y/./x 943} http://a/b/c/g?y/./x 944 945test uri-rfc2396-12.16 {uri::resolve abnormal examples} { 946 uri::resolve http://a/b/c/d\;p?q g?y/../x 947} http://a/b/c/g?y/../x 948 949test uri-rfc2396-12.17 {uri::resolve abnormal examples} { 950 uri::resolve http://a/b/c/d\;p?q g#s/./x 951} http://a/b/c/g#s/./x 952 953test uri-rfc2396-12.18 {uri::resolve abnormal examples} { 954 uri::resolve http://a/b/c/d\;p?q g#s/../x 955} http://a/b/c/g#s/../x 956 957test uri-rfc2396-12.19 {uri::resolve abnormal examples 958 RFC 3986 Sec. 5.4.2 advises avoiding this usage which is a loophole 959 in RFC 1630, which allows a relative URI to specify the scheme if it 960 is the same as the scheme of the base URI. 961 uri::resolve is a "strict parser" in the sense of RFC 3986 Sec. 5.2.2: 962 however, it does not handle the loophole correctly and fails this test. 963} {knownBug rfc1630-loophole-avoid-use} { 964 uri::resolve http://a/b/c/d\;p?q http:g 965} http:g 966 967 968 969# ------------------------------------------------------------------------------ 970 971testsuiteCleanup 972return 973 974# ------------------------------------------------------------------------------ 975# Local Variables: 976# mode: tcl 977# indent-tabs-mode: nil 978# End: 979