Ignore:
Timestamp:
11/27/08 21:28:16 (13 years ago)
Author:
sjamaan
Message:

Merge changes from uri-generic release 4 trunk into release 3

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

Legend:

Unmodified
Added
Removed
  • release/3/uri-generic/trunk

  • release/3/uri-generic/trunk/uri-generic.scm

    r12600 r12617  
    528528
    529529(define reg-name
    530   (count-min-max 0 255 (lambda (c) (or (unreserved-char? c)
    531                                        (pct-encoded? c)
     530  (count-min-max 0 255 (lambda (c) (or (pct-encoded? c)
     531                                       (unreserved-char? c)
    532532                                       (char-set-contains? char-set:sub-delims c) ))))
    533533
     
    10521052;;
    10531053;; Case normalization; cf. RFC3986 section 6.2.2.1
    1054 ;; NOTE:  authority case normalization is not performed
    10551054
    10561055(define (uri-normalize-case uri)
    1057   (let ((u1      (udup uri))
    1058         (scheme  (string->symbol (string-downcase (->string (uri-scheme uri)))))
    1059         (path    (map (lambda (c) (match c (('% h1 h2)  `(% ,(char-upcase h1) ,(char-upcase h2)))
    1060                                          (else c))) (uri-path uri))))
    1061     (URI-scheme-set! u1 scheme)
    1062     (URI-path-set! u1 path)
    1063     u1))
    1064 
     1056  (let* ((normalized-uri (uri-reference (normalize-pct-encoding (uri->string uri (lambda (user pass) (conc user ":" pass))))))
     1057         (scheme         (string->symbol (string-downcase (->string (uri-scheme uri)))))
     1058         (host           (normalize-pct-encoding (string-downcase (uri-host uri)))))
     1059    (update-uri normalized-uri scheme: scheme host: host)))
     1060
     1061(define (normalize-pct-encoding str)
     1062  (uri-char-list->string
     1063   (map (lambda (c) (match c
     1064                           ((#\% h1 h2)  `(#\% ,(char-upcase h1) ,(char-upcase h2)))
     1065                           (else c)))
     1066        (uri-string->normalized-char-list str))))
    10651067
    10661068;;  Path segment normalization; cf. RFC3986 section 6.2.2.4
Note: See TracChangeset for help on using the changeset viewer.