Using path-string? rather than path? in many places

svn: r12570
This commit is contained in:
Jay McCarthy 2008-11-21 17:59:08 +00:00
parent 65d3d41096
commit d2a9872174
20 changed files with 47 additions and 48 deletions

View File

@ -15,7 +15,7 @@
[read-range-header (-> (listof header?) (or/c (listof pair?) false/c))]
[make
(->* (#:url->path url->path/c)
(#:path->mime-type (path? . -> . bytes?)
(#:path->mime-type (path-string? . -> . bytes?)
#:indices (listof path-string?))
dispatcher/c)])

View File

@ -22,7 +22,7 @@
[make-basic-denied?/path
(authorized?/c . -> . denied?/c)]
[password-file->authorized?
(path? . -> . (values (-> void)
(path-string? . -> . (values (-> void)
authorized?/c))])
(define interface-version 'v1)

View File

@ -8,7 +8,7 @@
(provide/contract
[url->path/c contract?]
[make-url->path (path? . -> . url->path/c)]
[make-url->path (path-string? . -> . url->path/c)]
[make-url->valid-path (url->path/c . -> . url->path/c)]
[filter-url->path (regexp? url->path/c . -> . url->path/c)])

View File

@ -15,7 +15,7 @@
(provide/contract
[rename ext:output-response output-response (connection? response? . -> . void)]
[rename ext:output-response/method output-response/method (connection? response? symbol? . -> . void)]
[rename ext:output-file output-file (connection? path? symbol? bytes? (or/c pair? false/c) . -> . void)])
[rename ext:output-file output-file (connection? path-string? symbol? bytes? (or/c pair? false/c) . -> . void)])
;; Table 1. head responses:
; ------------------------------------------------------------------------------

View File

@ -15,10 +15,7 @@
(provide/contract
[static-files-path (path-string? . -> . void?)])
(define (static-files-path path)
(set! extra-files-path
(if (path? path)
path
(string->path path))))
(set! extra-files-path path))
(provide/contract
[no-web-browser (-> void)])

View File

@ -24,7 +24,7 @@
(provide/contract
[file-box? (any/c . -> . boolean?)]
[file-box (path? serializable? . -> . file-box?)]
[file-box (path-string? serializable? . -> . file-box?)]
[file-unbox (file-box? . -> . serializable?)]
[file-box-set? (file-box? . -> . boolean?)]
[file-box-set! (file-box? serializable? . -> . void)])

View File

@ -742,7 +742,7 @@
[copy-conf
(lambda (from to)
(let ([to-path (build-path-unless-absolute conf to)])
; more here - check existance of from path?
; more here - check existance of from path
(copy-file* (build-path from-conf from) to-path)))])
(copy-conf "passwords-refresh.html" (messages-passwords-refreshed messages))
(copy-conf "servlet-refresh.html" (messages-servlets-refreshed messages))

View File

@ -2,7 +2,7 @@
(require file/md5)
(provide/contract
[md5-home (parameter/c path?)]
[md5-home (parameter/c path-string?)]
[md5-store (bytes? . -> . bytes?)]
[md5-lookup (bytes? . -> . bytes?)])

View File

@ -21,7 +21,7 @@
([custodian custodian?]
[namespace namespace?]
[manager manager?]
[directory path?]
[directory path-string?]
[handler (request? . -> . response?)])]
[struct execution-context
([request request?])]

View File

@ -7,7 +7,7 @@
xml/xml
net/url)
(define path-element?
(or/c string? path? (symbols 'up 'same)))
(or/c path-string? (symbols 'up 'same)))
(define port-number? (between/c 1 65535))
@ -16,13 +16,13 @@
[port-number? contract?]
[pretty-print-invalid-xexpr (exn:invalid-xexpr? any/c . -> . void)]
[url-replace-path (((listof path/param?) . -> . (listof path/param?)) url? . -> . url?)]
[explode-path* (path? . -> . (listof path-element?))]
[path-without-base (path? path? . -> . (listof path-element?))]
[explode-path* (path-string? . -> . (listof path-element?))]
[path-without-base (path-string? path-string? . -> . (listof path-element?))]
[list-prefix? (list? list? . -> . boolean?)]
[strip-prefix-ups ((listof path-element?) . -> . (listof path-element?))]
[url-path->string ((listof path/param?) . -> . string?)]
[network-error ((symbol? string?) (listof any/c) . ->* . (void))]
[directory-part (path? . -> . path?)]
[directory-part (path-string? . -> . path?)]
[lowercase-symbol! ((or/c string? bytes?) . -> . symbol?)]
[exn->string ((or/c exn? any/c) . -> . string?)]
[build-path-unless-absolute (path-string? path-string? . -> . path?)]

View File

@ -99,7 +99,7 @@ URLs to paths on the filesystem.
The returned @scheme[path?] is the path on disk. The list is the list of
path elements that correspond to the path of the URL.}
@defproc[(make-url->path (base path?))
@defproc[(make-url->path (base path-string?))
url->path/c]{
The @scheme[url-path/c] returned by this procedure considers the root
URL to be @scheme[base]. It ensures that @scheme[".."]s in the URL

View File

@ -293,13 +293,13 @@ functions.
@filepath{private/mime-types.ss} provides function for dealing with @filepath{mime.types}
files.
@defproc[(read-mime-types [p path?])
@defproc[(read-mime-types [p path-string?])
(hash-table/c symbol? bytes?)]{
Reads the @filepath{mime.types} file from @scheme[p] and constructs a
hash table mapping extensions to MIME types.
}
@defproc[(make-path->mime-type [p path?])
@defproc[(make-path->mime-type [p path-string?])
(path? . -> . bytes?)]{
Uses a @scheme[read-mime-types] with @scheme[p] and constructs a
function from paths to their MIME type.
@ -371,7 +371,7 @@ needs. They are provided by @filepath{private/util.ss}.
@subsection{Contracts}
@defthing[port-number? contract?]{Equivalent to @scheme[(between/c 1 65535)].}
@defthing[path-element? contract?]{Equivalent to @scheme[(or/c string? path? (symbols 'up 'same))].}
@defthing[path-element? contract?]{Equivalent to @scheme[(or/c path-string? (symbols 'up 'same))].}
@subsection{Lists}
@defproc[(list-prefix? [l list?]
@ -395,19 +395,19 @@ needs. They are provided by @filepath{private/util.ss}.
}
@subsection{Paths}
@defproc[(explode-path* [p path?])
@defproc[(explode-path* [p path-string?])
(listof path-element?)]{
Like @scheme[normalize-path], but does not resolve symlinks.
}
@defproc[(path-without-base [base path?]
[p path?])
@defproc[(path-without-base [base path-string?]
[p path-string?])
(listof path-element?)]{
Returns, as a list, the portion of @scheme[p] after @scheme[base],
assuming @scheme[base] is a prefix of @scheme[p].
}
@defproc[(directory-part [p path?])
@defproc[(directory-part [p path-string?])
path?]{
Returns the directory part of @scheme[p], returning @scheme[(current-directory)]
if it is relative.

View File

@ -43,7 +43,7 @@ The following API is provided to customize the server instance:
@onscreen["Run"].
}
@defproc[(static-files-path [path path?]) void]{
@defproc[(static-files-path [path path-string?]) void]{
This instructs the Web server to serve static files, such as stylesheet and images, from @scheme[path].
}

View File

@ -98,10 +98,10 @@ If you want to use @scheme[serve/servlet] in a start up script for a Web server,
[#:stateless? stateless? boolean? #f]
[#:manager manager manager? (make-threshold-LRU-manager #f (* 1024 1024 64))]
[#:servlet-namespace servlet-namespace (listof module-path?) empty]
[#:server-root-path server-root-path path? default-server-root-path]
[#:extra-files-paths extra-files-paths (listof path?) (list (build-path server-root-path "htdocs"))]
[#:servlets-root servlets-root path? (build-path server-root-path "htdocs")]
[#:servlet-current-directory servlet-current-directory path? servlets-root]
[#:server-root-path server-root-path path-string? default-server-root-path]
[#:extra-files-paths extra-files-paths (listof path-string?) (list (build-path server-root-path "htdocs"))]
[#:servlets-root servlets-root path-string? (build-path server-root-path "htdocs")]
[#:servlet-current-directory servlet-current-directory path-string? servlets-root]
[#:file-not-found-responder file-not-found-responder
(request? . -> . response?)
(gen-file-not-found-responder
@ -109,9 +109,9 @@ If you want to use @scheme[serve/servlet] in a start up script for a Web server,
server-root-path
"conf"
"not-found.html"))]
[#:mime-types-path mime-types-path path?
[#:mime-types-path mime-types-path path-string?
....]
[#:log-file log-file path? #f]
[#:log-file log-file (or/c false/c path-string?) #f]
[#:log-format log-format symbol? 'apache-default])
void]{
This sets up and starts a fairly default server instance.

View File

@ -12,21 +12,21 @@
This module is used internally to build and load servlets. It may be useful to those who are trying to extend the server.
@defproc[(make-v1.servlet [directory path?]
@defproc[(make-v1.servlet [directory path-string?]
[timeout integer?]
[start (request? . -> . response?)])
servlet?]{
Creates a version 1 servlet that uses @scheme[directory] as its current directory, a timeout manager with a @scheme[timeout] timeout, and @scheme[start] as the request handler.
}
@defproc[(make-v2.servlet [directory path?]
@defproc[(make-v2.servlet [directory path-string?]
[manager manager?]
[start (request? . -> . response?)])
servlet?]{
Creates a version 2 servlet that uses @scheme[directory] as its current directory, a @scheme[manager] as the continuation manager, and @scheme[start] as the request handler.
}
@defproc[(make-stateless.servlet [directory path?]
@defproc[(make-stateless.servlet [directory path-string?]
[start (request? . -> . response?)])
servlet?]{
Creates a stateless @schememodname[web-server] servlet that uses @scheme[directory] as its current directory and @scheme[start] as the request handler.
@ -62,7 +62,7 @@ Equivalent to @scheme[(path? . -> . servlet?)].
@defstruct[servlet ([custodian custodian?]
[namespace namespace?]
[manager manager?]
[directory path?]
[directory path-string?]
[handler (request? . -> . response?)])
#:mutable]{
Instances of this structure hold the necessary parts of a servlet:

View File

@ -615,7 +615,7 @@ To do this, we set aside a path to store these files, and then tell
the web server where that directory is. The function
@scheme[static-files-path],
@defthing[static-files-path (path? -> void)]
@defthing[static-files-path (path-string? -> void)]
tells the web server to look in the given path when it receives a URL
that looks like a static resource request.

View File

@ -58,7 +58,7 @@ Provides contains the following identifiers.
@defmodule[web-server/web-config-unit]{
@defproc[(configuration-table->web-config@ [path path?]
@defproc[(configuration-table->web-config@ [path path-string?]
[#:port port (or/c false/c port-number?) #f]
[#:listen-ip listen-ip (or/c false/c string?) #f]
[#:make-servlet-namespace make-servlet-namespace make-servlet-namespace/c (make-make-servlet-namespace)])
@ -68,10 +68,12 @@ Provides contains the following identifiers.
}
@defproc[(configuration-table-sexpr->web-config@ [sexpr list?]
[#:web-server-root web-server-root path? (directory-part default-configuration-table-path)]
[#:web-server-root web-server-root path-string?
(directory-part default-configuration-table-path)]
[#:port port (or/c false/c port-number?) #f]
[#:listen-ip listen-ip (or/c false/c string?) #f]
[#:make-servlet-namespace make-servlet-namespace make-servlet-namespace/c (make-make-servlet-namespace)])
[#:make-servlet-namespace make-servlet-namespace make-servlet-namespace/c
(make-make-servlet-namespace)])
(unit? web-config^)]{
Parses @scheme[sexpr] as a configuration-table and constructs a @scheme[web-config^] unit.
}

View File

@ -104,7 +104,7 @@ boxes in a safe way.
@defproc[(file-box? [v any/c])
boolean?]{Checks if @scheme[v] is a file-box.}
@defproc[(file-box [p path?]
@defproc[(file-box [p path-string?]
[v serializable?])
file-box?]{
Creates a file-box that is stored at @scheme[p], with the default

View File

@ -52,15 +52,15 @@
#:ssl? boolean?
#:manager manager?
#:servlet-namespace (listof module-path?)
#:server-root-path path?
#:server-root-path path-string?
#:stateless? boolean?
#:extra-files-paths (listof path?)
#:servlets-root path?
#:extra-files-paths (listof path-string?)
#:servlets-root path-string?
#:file-not-found-responder (request? . -> . response?)
#:mime-types-path path?
#:mime-types-path path-string?
#:servlet-path string?
#:servlet-regexp regexp?
#:log-file (or/c false/c path?))
#:log-file (or/c false/c path-string?))
. ->* .
void)])

View File

@ -97,9 +97,9 @@
servlet-module-specs
lang-module-specs))
(provide/contract
[make-v1.servlet (path? integer? (request? . -> . response?) . -> . servlet?)]
[make-v2.servlet (path? manager? (request? . -> . response?) . -> . servlet?)]
[make-stateless.servlet (path? (request? . -> . response?) . -> . servlet?)]
[make-v1.servlet (path-string? integer? (request? . -> . response?) . -> . servlet?)]
[make-v2.servlet (path-string? manager? (request? . -> . response?) . -> . servlet?)]
[make-stateless.servlet (path-string? (request? . -> . response?) . -> . servlet?)]
[default-module-specs (listof module-path?)])
(define (make-default-path->servlet #:make-servlet-namespace [make-servlet-namespace (make-make-servlet-namespace)]