Ignore:
Timestamp:
02/09/09 22:52:05 (12 years ago)
Author:
sjamaan
Message:

Rename old uri? predicate to uri-reference? and introduce a new uri? predicate that only returns #t when the object is an uri, not when it's a relative reference

File:
1 edited

Legend:

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

    r13228 r13229  
    4242(module uri-generic
    4343  (uri-reference update-uri update-authority
    44    uri? uri-auth uri-authority uri-scheme uri-path uri-query
     44   uri-reference? uri-auth uri-authority uri-scheme uri-path uri-query
    4545   uri-fragment uri-host uri-port uri-username uri-password
    4646   authority? authority-host authority-port
    4747   authority-username authority-password
    4848   
    49    absolute-uri absolute-uri? uri->string uri->list
     49   uri? absolute-uri absolute-uri? uri->string uri->list
    5050   relative-ref? uri-relative-to uri-relative-from
    5151   uri-decode-string uri-encode-string
     
    8080           (URIAuth-port x)))
    8181
    82 (define uri? URI?)
     82(define uri-reference? URI?)
    8383
    8484(define uri-auth       URI-authority )
     
    281281;;               / path-empty
    282282
     283;; TODO: Export a modified version of this one, to match absolute-uri
     284;;       (modified = throw an error instead of #f)
    283285(define (uri s)
    284286  (let ((s (if (string? s) (uri-string->normalized-char-list s) s)))
     
    294296                                  fragment: (and uf (uri-char-list->string uf)))))
    295297         (else #f))))
     298
     299(define (uri? u)
     300  (and (uri-reference? u) (uri-scheme u)))
    296301
    297302(define (uri-path-list->path pcl)
     
    664669    (or (uri s) (relative-ref s))))
    665670
     671;; (define uri-reference? URI) ; Already defined as URI? (struct predicate)
     672
    666673;;  RFC3986, section 4.2
    667674;;
     
    673680;;                 / path-empty
    674681
     682;; TODO: Export a modified version of this  (one that accepts a string
     683;;       and throws an exception instead of returning #f)
    675684(define (relative-ref s)
    676685  (and (not (scheme s))
     
    685694
    686695(define (relative-ref? u)
    687   (and (uri? u) (not (uri-scheme u))))
     696  (and (uri-reference? u) (not (uri-scheme u))))
    688697
    689698(define (relative-part s)
     
    716725
    717726(define (absolute-uri? u)
    718   (and (uri? u) (not (relative-ref? u)) (not (uri-fragment u))))
     727  (and (uri-reference? u) (not (relative-ref? u)) (not (uri-fragment u))))
    719728
    720729;; Turns a URI into a string.
     
    825834
    826835(define (uri-relative-to ref base)
    827   (and (uri? ref) (uri? base)
     836  (and (uri-reference? ref) (uri-reference? base)
    828837       (cond ((uri-scheme ref)      (update-URI ref
    829838                                                path: (just-segments ref)))
Note: See TracChangeset for help on using the changeset viewer.