Adding max-waiting to serve/servlet, re dyoo

This commit is contained in:
Jay McCarthy 2013-04-11 08:28:59 -06:00
parent f340939677
commit 1bdf6e67dd
4 changed files with 20 additions and 6 deletions

View File

@ -62,6 +62,7 @@ These functions optimize the construction of dispatchers and launching of server
[#:banner? banner? boolean? #f] [#:banner? banner? boolean? #f]
[#:listen-ip listen-ip (or/c false/c string?) "127.0.0.1"] [#:listen-ip listen-ip (or/c false/c string?) "127.0.0.1"]
[#:port port number? 8000] [#:port port number? 8000]
[#:max-waiting exact-nonnegative-integer? 511]
[#:ssl-cert ssl-cert (or/c false/c path-string?) #f] [#:ssl-cert ssl-cert (or/c false/c path-string?) #f]
[#:ssl-key ssl-key (or/c false/c path-string?) #f]) [#:ssl-key ssl-key (or/c false/c path-string?) #f])
void]{ void]{
@ -79,6 +80,8 @@ These functions optimize the construction of dispatchers and launching of server
connections to all of the listening machine's addresses. Otherwise, the server accepts connections only at the interface(s) associated with the given string. connections to all of the listening machine's addresses. Otherwise, the server accepts connections only at the interface(s) associated with the given string.
For example, providing @racket["127.0.0.1"] (the default) as @racket[listen-ip] creates a server that accepts only connections to @racket["127.0.0.1"] (the loopback interface) from the local machine. For example, providing @racket["127.0.0.1"] (the default) as @racket[listen-ip] creates a server that accepts only connections to @racket["127.0.0.1"] (the loopback interface) from the local machine.
@racket[max-waiting] is passed to @racket[serve] to control the TCP backlog.
If @racket[ssl-key] and @racket[ssl-cert] are not false, then the server runs in HTTPS mode with @racket[ssl-cert] If @racket[ssl-key] and @racket[ssl-cert] are not false, then the server runs in HTTPS mode with @racket[ssl-cert]
and @racket[ssl-key] as paths to the certificate and private key. and @racket[ssl-key] as paths to the certificate and private key.

View File

@ -139,6 +139,7 @@ Like always, you don't even need to save the file.
[#:banner? banner? boolean? (not command-line?)] [#:banner? banner? boolean? (not command-line?)]
[#:listen-ip listen-ip (or/c false/c string?) "127.0.0.1"] [#:listen-ip listen-ip (or/c false/c string?) "127.0.0.1"]
[#:port port tcp-listen-port? 8000] [#:port port tcp-listen-port? 8000]
[#:max-waiting max-waiting exact-nonnegative-integer? 511]
[#:servlet-path servlet-path string? [#:servlet-path servlet-path string?
"/servlets/standalone.rkt"] "/servlets/standalone.rkt"]
[#:servlet-regexp servlet-regexp regexp? [#:servlet-regexp servlet-regexp regexp?
@ -193,10 +194,12 @@ Like always, you don't even need to save the file.
@racket[serve/servlet] is simpler interface over @racket[serve/servlet] is simpler interface over
@racket[serve/launch/wait], @racket[dispatch/servlet], and a few of @racket[serve/launch/wait], @racket[dispatch/servlet], and a few of
the standard @secref["dispatchers" #:doc the standard @secref["dispatchers" #:doc
'(lib "web-server/scribblings/web-server-internal.scrbl")]. Some advanced '(lib "web-server/scribblings/web-server-internal.scrbl")]. Some
customization requires using these underlying pieces of the options, like @racket[port] and @racket[max-waiting] are transparently
@racketmodname[web-server] directly. However, many simpler customizations do passed to @racket[serve/launch/wait]. Some advanced customization
not, which the rest of this section describes. requires using these underlying pieces of the
@racketmodname[web-server] directly. However, many simpler
customizations do not, which the rest of this section describes.
The server listens on @racket[listen-ip] and port @racket[port]. If @racket[listen-ip] is @racket[#f], then the server accepts The server listens on @racket[listen-ip] and port @racket[port]. If @racket[listen-ip] is @racket[#f], then the server accepts
connections to all of the listening machine's addresses. Otherwise, the server accepts connections only at the interface(s) associated with the given string. connections to all of the listening machine's addresses. Otherwise, the server accepts connections only at the interface(s) associated with the given string.

View File

@ -1,5 +1,5 @@
; Derived from plai/web/server, which was based on an older version of this ;; Derived from plai/web/server, which was based on an older version
; Also derived from planet/untyped/instaservlet ;; of this Also derived from planet/untyped/instaservlet
#lang racket/base #lang racket/base
(require (prefix-in net: net/sendurl) (require (prefix-in net: net/sendurl)
racket/match racket/match
@ -46,6 +46,7 @@
#:banner? boolean? #:banner? boolean?
#:listen-ip (or/c false/c string?) #:listen-ip (or/c false/c string?)
#:port tcp-listen-port? #:port tcp-listen-port?
#:max-waiting exact-nonnegative-integer?
#:ssl-cert (or/c false/c path-string?) #:ssl-cert (or/c false/c path-string?)
#:ssl-key (or/c false/c path-string?)) #:ssl-key (or/c false/c path-string?))
. ->* . . ->* .
@ -104,6 +105,8 @@
[listen-ip "127.0.0.1"] [listen-ip "127.0.0.1"]
#:port #:port
[port-arg 8000] [port-arg 8000]
#:max-waiting
[max-waiting 511]
#:ssl-cert #:ssl-cert
[ssl-cert #f] [ssl-cert #f]
#:ssl-key #:ssl-key
@ -117,6 +120,7 @@
#:dispatch (dispatcher sema) #:dispatch (dispatcher sema)
#:listen-ip listen-ip #:listen-ip listen-ip
#:port port-arg #:port port-arg
#:max-waiting max-waiting
#:tcp@ (if ssl? #:tcp@ (if ssl?
(let () (let ()
(define-unit-binding ssl-tcp@ (define-unit-binding ssl-tcp@

View File

@ -48,6 +48,7 @@
#:banner? boolean? #:banner? boolean?
#:listen-ip (or/c false/c string?) #:listen-ip (or/c false/c string?)
#:port tcp-listen-port? #:port tcp-listen-port?
#:max-waiting exact-nonnegative-integer?
#:ssl? boolean? #:ssl? boolean?
#:ssl-cert (or/c false/c path-string?) #:ssl-cert (or/c false/c path-string?)
#:ssl-key (or/c false/c path-string?) #:ssl-key (or/c false/c path-string?)
@ -95,6 +96,8 @@
[listen-ip "127.0.0.1"] [listen-ip "127.0.0.1"]
#:port #:port
[the-port 8000] [the-port 8000]
#:max-waiting
[max-waiting 511]
#:manager #:manager
[manager [manager
@ -197,5 +200,6 @@
#:banner? banner? #:banner? banner?
#:listen-ip listen-ip #:listen-ip listen-ip
#:port the-port #:port the-port
#:max-waiting max-waiting
#:ssl-cert ssl-cert #:ssl-cert ssl-cert
#:ssl-key ssl-key)) #:ssl-key ssl-key))