Changeset 266 in serd
- Timestamp:
- 2011-12-24 12:08:44 (17 months ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
src/uri.c (modified) (2 diffs)
-
tests/test-uri.out (modified) (1 diff)
-
tests/test-uri.ttl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r263 r266 19 19 * Escape ASCII control characters in output (e.g. fix problems with string 20 20 literals that start with a backspace) 21 * Improve URI resolution to cover most of the abnormal cases from RFC3986 21 22 22 23 -- David Robillard <d@drobilla.net> (UNRELEASED) -
trunk/src/uri.c
r244 r266 288 288 WRITE(uri->authority.buf, uri->authority.len); 289 289 } 290 if (uri->path_base.len ) {290 if (uri->path_base.len || uri->path.len) { 291 291 if (!uri->path.buf && (uri->fragment.buf || uri->query.buf)) { 292 292 WRITE_COMPONENT("", uri->path_base, ""); … … 308 308 break; 309 309 case '.': 310 ++up;311 310 switch (begin[2]) { 311 case '\0': 312 ++up; 313 begin += 2; // Chop input ".." 314 done = true; 315 break; 312 316 case '/': 313 begin += 3; // Chop lading "../" 317 ++up; 318 begin += 3; // Chop leading "../" 314 319 break; 315 320 default: 316 begin += 2; // Chop leading ".." 321 done = true; 322 break; 317 323 } 318 324 break; 325 case '\0': 326 ++begin; // Chop input "." (and fall-through) 319 327 default: 320 ++begin; // Chop leading "." 328 done = true; 329 break; 321 330 } 322 331 break; 323 332 case '/': 324 if (begin[1] == '/') { 325 ++begin; // Replace leading "//" with "/" 326 break; 327 } // else fall through 333 switch (begin[1]) { 334 case '.': 335 switch (begin[2]) { 336 case '/': 337 begin += 2; // Leading "/./" => "/" 338 break; 339 case '.': 340 switch (begin[3]) { 341 case '/': 342 ++up; 343 begin += 3; // Leading "/../" => "/" 344 } 345 break; 346 default: 347 done = true; 348 break; 349 } 350 } // else fall through 328 351 default: 329 352 done = true; // Finished chopping dot components -
trunk/tests/test-uri.out
r64 r266 22 22 <http://a/> <http://www.w3.org/2002/07/owl#sameAs> <http://a/> . 23 23 <http://a/g> <http://www.w3.org/2002/07/owl#sameAs> <http://a/g> . 24 <http://a/g> <http://www.w3.org/2002/07/owl#sameAs> <http://a/g> . 25 <http://a/g> <http://www.w3.org/2002/07/owl#sameAs> <http://a/g> . 26 <http://a/g> <http://www.w3.org/2002/07/owl#sameAs> <http://a/g> . 27 <http://a/g> <http://www.w3.org/2002/07/owl#sameAs> <http://a/g> . 28 <http://a/b/c/g.> <http://www.w3.org/2002/07/owl#sameAs> <http://a/b/c/g.> . 29 <http://a/b/c/.g> <http://www.w3.org/2002/07/owl#sameAs> <http://a/b/c/.g> . 30 <http://a/b/c/g..> <http://www.w3.org/2002/07/owl#sameAs> <http://a/b/c/g..> . 31 <http://a/b/c/..g> <http://www.w3.org/2002/07/owl#sameAs> <http://a/b/c/..g> . 32 <http://a/b/g> <http://www.w3.org/2002/07/owl#sameAs> <http://a/b/g> . 33 <http://a/b/c/g?y/./x> <http://www.w3.org/2002/07/owl#sameAs> <http://a/b/c/g?y/./x> . 34 <http://a/b/c/g?y/../x> <http://www.w3.org/2002/07/owl#sameAs> <http://a/b/c/g?y/../x> . 35 <http://a/b/c/g#s/./x> <http://www.w3.org/2002/07/owl#sameAs> <http://a/b/c/g#s/./x> . 36 <http://a/b/c/g#s/../x> <http://www.w3.org/2002/07/owl#sameAs> <http://a/b/c/g#s/../x> . 37 <http://a/.g> <http://www.w3.org/2002/07/owl#sameAs> <http://a/.g> . 24 38 <http://A?aquery> <http://www.w3.org/2002/07/owl#sameAs> <http://A?aquery> . 25 39 <http://A#afragment> <http://www.w3.org/2002/07/owl#sameAs> <http://A#afragment> . -
trunk/tests/test-uri.ttl
r64 r266 30 30 <../../g> owl:sameAs <http://a/g> . 31 31 32 # 5.4.2. Abnormal Examples 33 <../../../g> owl:sameAs <http://a/g> . 34 <../../../../g> owl:sameAs <http://a/g> . 35 </./g> owl:sameAs <http://a/g> . 36 </../g> owl:sameAs <http://a/g> . 37 <g.> owl:sameAs <http://a/b/c/g.> . 38 <.g> owl:sameAs <http://a/b/c/.g> . 39 <g..> owl:sameAs <http://a/b/c/g..> . 40 <..g> owl:sameAs <http://a/b/c/..g> . 41 <./../g> owl:sameAs <http://a/b/g> . 42 # Serd only resolves the leading components 43 #<./g/.> owl:sameAs <http://a/b/c/g/> . 44 #<g/./h> owl:sameAs <http://a/b/c/g/h> . 45 #<g/../h> owl:sameAs <http://a/b/c/h> . 46 #<g;x=1/./y> owl:sameAs <http://a/b/c/g;x=1/y> . 47 #<g;x=1/../y> owl:sameAs <http://a/b/c/y> . 48 <g?y/./x> owl:sameAs <http://a/b/c/g?y/./x> . 49 <g?y/../x> owl:sameAs <http://a/b/c/g?y/../x> . 50 <g#s/./x> owl:sameAs <http://a/b/c/g#s/./x> . 51 <g#s/../x> owl:sameAs <http://a/b/c/g#s/../x> . 52 32 53 # Additional tests for Serd 54 </.g> owl:sameAs <http://a/.g> . 33 55 <http://A?aquery> owl:sameAs <http://A?aquery> . 34 56 <http://A#afragment> owl:sameAs <http://A#afragment> . … … 42 64 @base <http://C#cfragment> . 43 65 44 </bar> owl:sameAs <http://C/bar> .66 </bar> owl:sameAs <http://C/bar> .
Note: See TracChangeset
for help on using the changeset viewer.
