Add PARSE-HTTP-URL-STRING procedure to URL structure.

This commit is contained in:
sperber 2003-01-15 10:36:16 +00:00
parent b85f09212e
commit e090e1bd44
2 changed files with 15 additions and 7 deletions

View File

@ -136,6 +136,13 @@
(make-http-url uh (map unescape-uri (cdddr path)) search frag-id))) (make-http-url uh (map unescape-uri (cdddr path)) search frag-id)))
(define (parse-http-url-string string)
(call-with-values
(lambda () (parse-uri string))
(lambda (scheme path search frag-id)
(if (string=? scheme "http")
(parse-http-url path search frag-id)
(fatal-syntax-error "not an HTTP URL" path)))))
;;; Default http port is 80. ;;; Default http port is 80.
(define default-http-userhost (make-userhost #f #f #f "80")) (define default-http-userhost (make-userhost #f #f #f "80"))

View File

@ -60,26 +60,27 @@
simplify-uri-path)) simplify-uri-path))
(define-interface url-interface (define-interface url-interface
(export userhost? ; USERHOST (export userhost?
make-userhost ; record struct make-userhost
userhost-user userhost-user
userhost-password userhost-password
userhost-host userhost-host
userhost-port userhost-port
parse-userhost ; parse & parse-userhost
userhost->string ; unparse. userhost->string
http-url? ; HTTP-URL http-url?
make-http-url ; record struct make-http-url
http-url-userhost http-url-userhost
http-url-path http-url-path
http-url-search http-url-search
http-url-frag-id http-url-frag-id
parse-http-url ; parse & parse-http-url
parse-http-url-string
http-url->string)) http-url->string))
(define-interface ftp-interface (define-interface ftp-interface