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]
[#:listen-ip listen-ip (or/c false/c string?) "127.0.0.1"]
[#:port port number? 8000]
[#:max-waiting exact-nonnegative-integer? 511]
[#:ssl-cert ssl-cert (or/c false/c path-string?) #f]
[#:ssl-key ssl-key (or/c false/c path-string?) #f])
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.
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]
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?)]
[#:listen-ip listen-ip (or/c false/c string?) "127.0.0.1"]
[#:port port tcp-listen-port? 8000]
[#:max-waiting max-waiting exact-nonnegative-integer? 511]
[#:servlet-path servlet-path string?
"/servlets/standalone.rkt"]
[#: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/launch/wait], @racket[dispatch/servlet], and a few of
the standard @secref["dispatchers" #:doc
'(lib "web-server/scribblings/web-server-internal.scrbl")]. Some advanced
customization requires using these underlying pieces of the
@racketmodname[web-server] directly. However, many simpler customizations do
not, which the rest of this section describes.
'(lib "web-server/scribblings/web-server-internal.scrbl")]. Some
options, like @racket[port] and @racket[max-waiting] are transparently
passed to @racket[serve/launch/wait]. Some advanced customization
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
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
; Also derived from planet/untyped/instaservlet
;; Derived from plai/web/server, which was based on an older version
;; of this Also derived from planet/untyped/instaservlet
#lang racket/base
(require (prefix-in net: net/sendurl)
racket/match
@ -46,6 +46,7 @@
#:banner? boolean?
#:listen-ip (or/c false/c string?)
#:port tcp-listen-port?
#:max-waiting exact-nonnegative-integer?
#:ssl-cert (or/c false/c path-string?)
#:ssl-key (or/c false/c path-string?))
. ->* .
@ -104,6 +105,8 @@
[listen-ip "127.0.0.1"]
#:port
[port-arg 8000]
#:max-waiting
[max-waiting 511]
#:ssl-cert
[ssl-cert #f]
#:ssl-key
@ -117,6 +120,7 @@
#:dispatch (dispatcher sema)
#:listen-ip listen-ip
#:port port-arg
#:max-waiting max-waiting
#:tcp@ (if ssl?
(let ()
(define-unit-binding ssl-tcp@

View File

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