(%uri-authority-port authority))
\f
(define (uri-userinfo? object)
- (and (string? object)
- (*match-string parser:userinfo object)))
+ (utf8-string? object))
(define (uri-host? object)
- (and (string? object)
- (*match-string matcher:host object)))
+ (utf8-string? object))
(define (uri-port? object)
(exact-nonnegative-integer? object))
\f
(define parser:hostport
(*parser
- (seq (map uri-string-downcase (match matcher:host))
+ (seq (map uri-string-downcase
+ (alt (match matcher:ip-literal)
+ ;; subsumed by MATCHER:REG-NAME
+ ;;matcher:ipv4-address
+ (map decode-component
+ (match matcher:reg-name))))
(alt (seq ":"
(map string->number
(match (+ (char-set char-set:uri-digit)))))
(write-char (char-downcase char) output)
(loop)))))))))
-(define matcher:host
- (*matcher
- (alt matcher:ip-literal
- ;; subsumed by MATCHER:REG-NAME
- ;;matcher:ipv4-address
- matcher:reg-name)))
-
(define matcher:ip-literal
(*matcher
(seq "["
(write-encoded userinfo char-set:uri-userinfo output)
(write-char #\@ output)))
(if host
- (write-encoded host char-set:uri-opaque-auth output))
+ (if (*match-string matcher:ip-literal host)
+ (write-string host output)
+ (write-encoded host char-set:uri-reg-name output)))
(if port
(begin
(write-char #\: output)
(rexp-sequence char-set:uri-alpha
(rexp* char-set:uri-scheme)))
-(define (uri-rexp:opaque-auth)
- (rexp* char-set:uri-opaque-auth))
-
(define (uri-rexp:authority)
(rexp-sequence (rexp-optional (uri-rexp:userinfo) "@")
(uri-rexp:host)
(define char-set:uri-hex)
(define char-set:uri-scheme)
(define char-set:uri-userinfo)
-(define char-set:uri-opaque-auth)
(define char-set:uri-ipvfuture)
(define char-set:uri-reg-name)
(define char-set:uri-segment)
(define char-set:uri-segment-nc)
(define char-set:uri-query)
(define char-set:uri-fragment)
+(define char-set:uri-sloppy-auth)
(define parser:userinfo)
(define matcher:reg-name)
(char-set-union char-set:uri-alpha
char-set:uri-digit
(string->char-set "+-.")))
- (let* ((uri-char
+ (let* ((gen-delims (string->char-set ":/?#[]@"))
+ (sub-delims (string->char-set "!$&'()*+,;="))
+ (unreserved
(char-set-union char-set:uri-alpha
char-set:uri-digit
- (string->char-set "!$&'()*+,-./:;=?@_~")))
+ (string->char-set "-._~")))
(component-chars
- (lambda (free)
- (char-set-difference uri-char (string->char-set free)))))
- (set! char-set:uri-userinfo (component-chars "/?@"))
+ (lambda (extra)
+ (char-set-union unreserved sub-delims (string->char-set extra)))))
+ (set! char-set:uri-userinfo (component-chars ":"))
(set! char-set:uri-ipvfuture char-set:uri-userinfo)
- (set! char-set:uri-reg-name (component-chars "/:?@"))
- (set! char-set:uri-segment (component-chars "/?"))
- (set! char-set:uri-segment-nc (component-chars "/:?"))
- (set! char-set:uri-query uri-char)
- (set! char-set:uri-fragment uri-char)
-
- (set! char-set:uri-opaque-auth
- (char-set-union (component-chars "/?")
- (string->char-set "[]"))))
+ (set! char-set:uri-reg-name (component-chars ""))
+ (set! char-set:uri-segment (component-chars ":@"))
+ (set! char-set:uri-segment-nc (component-chars "@"))
+ (set! char-set:uri-query (component-chars ":@/?"))
+ (set! char-set:uri-fragment char-set:uri-query)
+ (set! char-set:uri-sloppy-auth (component-chars ":@[]")))
(set! parser:userinfo (component-parser-* char-set:uri-userinfo))
(set! matcher:reg-name (component-matcher-* char-set:uri-reg-name))
(EOF))
(define-ppu-state authority
- (opaque-auth (push) authority)
+ (sloppy-auth (push) authority)
(/ (set authority) (push) path)
(? (set authority) query)
(|#| (set authority) fragment)