Changeset 14583 in project


Ignore:
Timestamp:
05/10/09 13:30:53 (10 years ago)
Author:
sjamaan
Message:

Add uri->list procedure

File:
1 edited

Legend:

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

    r13233 r14583  
    4242(module uri-common
    4343  (uri-reference uri-reference? absolute-uri absolute-uri? relative-ref?
    44    uri->uri-generic uri-generic->uri
     44   uri->uri-generic uri-generic->uri uri->list
    4545   update-uri uri? uri-scheme uri-username uri-password
    4646   uri-host uri-port uri-path uri-query uri-fragment
     
    103103(define (decode-string* s)
    104104  (and s (generic:uri-decode-string s)))
     105
     106(define (uri->list uri . rest)
     107  (let-optionals rest ((userinfomap (lambda (u pw) (string-append u ":******" ))))
     108    (list (uri-scheme uri)
     109          (list (uri-auth->list uri userinfomap) (uri-path uri) (uri-query uri))
     110          (uri-fragment uri))))
     111
     112(define (uri-auth->list uri userinfomap)
     113  (let ((username (uri-username uri))
     114        (password (uri-password uri)))
     115    (list (if (and username password) (userinfomap username password) #f)
     116          (uri-host uri)
     117          (uri-port uri))))
    105118
    106119;;; Accessors and predicates
Note: See TracChangeset for help on using the changeset viewer.