Changeset 12721 in project


Ignore:
Timestamp:
12/02/08 22:26:59 (13 years ago)
Author:
sjamaan
Message:

Implement collapsing of consecutive slashes and fix a small problem with relative references using dot-dot on URIs that end with slashes

Location:
release/4/uri-generic/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/uri-generic/trunk/tests/run.scm

    r12719 r12721  
    102102    (,base "http:" "http:")
    103103    (,base "..%2f" "http://a/b/c/..%2f")
     104    ("http://a/b/c/d/" ".." "http://a/b/c/")
     105    ("http://a/b/c/d/" "../e" "http://a/b/c/e")
     106    ("http://a/b/c/d/" "../e/" "http://a/b/c/e/")
     107    ("http://a/b//c///d///" "..//.." "http://a/b/")
    104108    ))
    105109
  • release/4/uri-generic/trunk/uri-generic.scm

    r12719 r12721  
    557557(define (slash-segment s)
    558558  (match s
    559          ((#\/ . rst)  (match (segment rst)
    560                               ((ss rst)  (list (cons #\/ ss) rst))
    561                               (else #f)))
     559         ((#\/ . rst)
     560          (or (slash-segment rst)
     561              (match (segment rst)
     562                     ((ss rst)  (list (cons #\/ ss) rst))
     563                     (else #f))))
    562564         (else  #f)))
    563565
     
    859861(define (merge0 pb pr)
    860862  (let* ((rpb  (reverse pb))
    861          (pb1  (reverse (if (and (pair? rpb) (not (string=? (car rpb) "/"))) (cdr rpb) rpb)))
     863         (pb1  (reverse (if (pair? rpb) (cdr rpb) rpb)))
    862864         (pr1  (or (and (pair? pr) (not (string=? ".." (car pr))) (not (string=? "." (car pr)))
    863                         (not (string-prefix? "/" (car pr))) 
     865                        (not (string-prefix? "/" (car pr)))
    864866                        (cons (string-append "/" (car pr)) (cdr pr)))
    865867                   pr)))
Note: See TracChangeset for help on using the changeset viewer.