From 62c597e7ecf4ef0bc972c755a93c4eb116ae450e Mon Sep 17 00:00:00 2001 From: sperber Date: Tue, 14 Jan 2003 15:01:21 +0000 Subject: [PATCH] Rename URI-PATH-LIST->PATH to URI-PATH->URI and SPLIT-URI-PATH to SPLIT-URI. --- scheme/httpd/logging.scm | 2 +- scheme/httpd/surflets/surflet-handler.scm | 2 +- scheme/lib/uri.scm | 22 ++++------------------ scheme/lib/url.scm | 4 ++-- scheme/packages.scm | 6 +++--- 5 files changed, 11 insertions(+), 25 deletions(-) diff --git a/scheme/httpd/logging.scm b/scheme/httpd/logging.scm index 7da9474..a093ab2 100644 --- a/scheme/httpd/logging.scm +++ b/scheme/httpd/logging.scm @@ -123,7 +123,7 @@ (socket-remote-address (request-socket req))) (format-internet-host-address host-address)) (request-method req) ; request method - (uri-path-list->path + (uri-path->uri (http-url-path (request-url req))) ; requested file (version->string (request-version req)) ; protocol version (status-code-number status-code) diff --git a/scheme/httpd/surflets/surflet-handler.scm b/scheme/httpd/surflets/surflet-handler.scm index c54add9..83edbd5 100644 --- a/scheme/httpd/surflets/surflet-handler.scm +++ b/scheme/httpd/surflets/surflet-handler.scm @@ -86,7 +86,7 @@ (lambda (path req) (if (pair? path) ; need at least one element (let ((request-method (request-method req)) - (path-string (uri-path-list->path path))) + (path-string (uri-path->uri path))) (if (or (string=? request-method "GET") (string=? request-method "POST")) (if (resume-url? path-string) diff --git a/scheme/lib/uri.scm b/scheme/lib/uri.scm index 8e457a7..f9ed13c 100644 --- a/scheme/lib/uri.scm +++ b/scheme/lib/uri.scm @@ -37,7 +37,7 @@ (path-end (or ques sharp slen))) (values (and colon (substring s 0 colon)) - (split-uri-path s path-start path-end) + (split-uri s path-start path-end) (and ques (substring s (+ ques 1) (or sharp slen))) (and sharp (substring s (+ sharp 1) slen))))) @@ -154,7 +154,7 @@ ;;; Cribbed from scsh's fname.scm -(define (split-uri-path uri start end) ; Split at /'s (infix grammar). +(define (split-uri uri start end) ; Split at /'s (infix grammar). (let split ((i start)) ; "" -> ("") (cond ((>= i end) '("")) @@ -167,25 +167,11 @@ ;;; The elements of PLIST must be escaped in case they contain slashes. ;;; This procedure doesn't escape them for you; you must do that yourself: -;;; (uri-path-list->path (map escape-uri pathlist)) +;;; (uri-path->uri (map escape-uri pathlist)) -(define (uri-path-list->path plist) +(define (uri-path->uri plist) (string-join plist "/")) ; Insert slashes between elts of PLIST. - -;;; Remove . and /.. elements from path. The result is a -;;; (maybe empty) list representing a path that does not contain "." -;;; and ".." elements neither at the beginning nor somewhere else. I -;;; tried to follow RFC2396 here. The procedure returns #f if the path -;;; tries to back up past root (like "//.." or "/foo/../.."). "//" may -;;; occur somewhere in the path but not being backed up. Usually, -;;; relative paths are intended to be used with a base -;;; url. Accordingly to RFC2396 (as I hope) relative paths are -;;; considered not to start with "/". They are appended to a base -;;; URL-path and then simplified. So before you start to simplify a -;;; URL try to find out if it is a relative path (i.e. it does not -;;; start with a "/"). - (define (simplify-uri-path p) (if (null? p) #f ; P must be non-null (let lp ((path-list (cdr p)) diff --git a/scheme/lib/url.scm b/scheme/lib/url.scm index 7cad273..5bc79d6 100644 --- a/scheme/lib/url.scm +++ b/scheme/lib/url.scm @@ -104,7 +104,7 @@ ;;; The PATH slot of this record is the URL's path split at slashes, ;;; e.g., "foo/bar//baz/" => ("foo" "bar" "" "baz" "") ;;; These elements are in raw, unescaped format. To convert back to -;;; a string, use (uri-path-list->path (map escape-uri pathlist)). +;;; a string, use (uri-path->uri (map escape-uri pathlist)). (define-record-type http-url :http-url (make-http-url userhost path search frag-id) @@ -146,7 +146,7 @@ (string-append "http://" (userhost->string (http-url-userhost url)) "/" - (uri-path-list->path (map escape-uri (http-url-path url))) + (uri-path->uri (map escape-uri (http-url-path url))) (cond ((http-url-search url) => (lambda (s) (string-append "?" s))) (else "")) diff --git a/scheme/packages.scm b/scheme/packages.scm index 03645bd..8dad493 100644 --- a/scheme/packages.scm +++ b/scheme/packages.scm @@ -55,8 +55,8 @@ uri-escaped-chars unescape-uri escape-uri - split-uri-path - uri-path-list->path + split-uri + uri-path->uri simplify-uri-path)) (define-interface url-interface @@ -592,7 +592,7 @@ i/o ; make-null-output-port locks receiving - uri ; uri-path-list->path + uri ; uri-path->uri url ; http-url-path httpd-requests ; request record httpd-responses