From e090e1bd440f4bd1ecc19ec685aab1a54898d6cc Mon Sep 17 00:00:00 2001 From: sperber Date: Wed, 15 Jan 2003 10:36:16 +0000 Subject: [PATCH] Add PARSE-HTTP-URL-STRING procedure to URL structure. --- scheme/lib/url.scm | 7 +++++++ scheme/packages.scm | 15 ++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/scheme/lib/url.scm b/scheme/lib/url.scm index 69e8c46..cb02868 100644 --- a/scheme/lib/url.scm +++ b/scheme/lib/url.scm @@ -136,6 +136,13 @@ (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. (define default-http-userhost (make-userhost #f #f #f "80")) diff --git a/scheme/packages.scm b/scheme/packages.scm index 8dad493..69cf10d 100644 --- a/scheme/packages.scm +++ b/scheme/packages.scm @@ -60,26 +60,27 @@ simplify-uri-path)) (define-interface url-interface - (export userhost? ; USERHOST - make-userhost ; record struct + (export userhost? + make-userhost userhost-user userhost-password userhost-host userhost-port - parse-userhost ; parse & - userhost->string ; unparse. + parse-userhost + userhost->string - http-url? ; HTTP-URL - make-http-url ; record struct + http-url? + make-http-url http-url-userhost http-url-path http-url-search http-url-frag-id - parse-http-url ; parse & + parse-http-url + parse-http-url-string http-url->string)) (define-interface ftp-interface