From d5f1f59d77b7383ee1eb5cdbd569945fbf20052a Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Thu, 31 Dec 2009 07:43:23 +0000 Subject: [PATCH] The `https-port-number' configuration is meaningless, removed and replaced with `use-https' which defaults to #t. If the web server is disabled, run a tiny "server" that spits out a message -- to avoid students complaining that something is broken. Configuration files with `https-port-number' will throw an error, and should be upgraded. svn: r17450 --- collects/handin-server/private/config.ss | 2 +- .../scribblings/quick-start.scrbl | 12 +++--- .../scribblings/server-setup.scrbl | 12 +++--- collects/handin-server/web-status-server.ss | 37 ++++++++++++------- 4 files changed, 36 insertions(+), 27 deletions(-) diff --git a/collects/handin-server/private/config.ss b/collects/handin-server/private/config.ss index ff9be42b20..d0e44b30dd 100644 --- a/collects/handin-server/private/config.ss +++ b/collects/handin-server/private/config.ss @@ -70,7 +70,7 @@ [(active-dirs) (values '() path-list )] [(inactive-dirs) (values '() path-list )] [(port-number) (values 7979 id )] - [(https-port-number) (values #f id )] + [(use-https) (values #t id )] [(hook-file) (values #f path/false )] [(session-timeout) (values 300 id )] [(session-memory-limit) (values 40000000 id )] diff --git a/collects/handin-server/scribblings/quick-start.scrbl b/collects/handin-server/scribblings/quick-start.scrbl index a4361fee96..5774528765 100644 --- a/collects/handin-server/scribblings/quick-start.scrbl +++ b/collects/handin-server/scribblings/quick-start.scrbl @@ -26,8 +26,7 @@ @item{Make a @filepath{test} subdirectory in your new directory.} @item{Create a file @filepath{config.ss} with the following content: - @schemeblock[((active-dirs ("test")) - (https-port-number 7980))]} + @schemeblock[((active-dirs ("test")))]} @item{In your new directory, run @commandline{mred-text -l handin-server}} @@ -50,10 +49,9 @@ The submitted file will be @filepath{.../test/tester/handin.scm}.} @item{Check the status of your submission by pointing a web browser at - @tt{https://localhost:7980/}. Note the ``s'' in ``https''. Use the - ``@tt{tester}'' username and ``@tt{pw}'' password, as before. + @tt{https://localhost:7979/}. Note the ``s'' in ``@tt{https}''. Use + the ``@tt{tester}'' username and ``@tt{pw}'' password, as before. - NOTE: The @scheme[https-port-number] line in the - @filepath{config.ss} file enables the embedded secure server. You - can remove it if you don't want it.} + NOTE: The embedded web server can be disabled in the configuration + file if you don't want to use it.} ] diff --git a/collects/handin-server/scribblings/server-setup.scrbl b/collects/handin-server/scribblings/server-setup.scrbl index ec13154b8b..189d233255 100644 --- a/collects/handin-server/scribblings/server-setup.scrbl +++ b/collects/handin-server/scribblings/server-setup.scrbl @@ -41,9 +41,9 @@ This directory contains the following files and sub-directories: @item{@indexed-scheme[port-number] --- the port for the main handin server; the default is 7979.} - @item{@indexed-scheme[https-port-number] --- the port number for the - handin-status HTTPS server; the default is @scheme[#f] which - indicates that no HTTPS server is started.} + @item{@indexed-scheme[use-https] --- determines whether to start an + embedded web server for handin status reports; the default is + @scheme[#t].} @item{@indexed-scheme[session-timeout] --- number of seconds before the session times-out. The client is given this many seconds for @@ -470,9 +470,9 @@ the correct assignment in the handin dialog. A student can download his/her own submissions through the handin dialog. This can also be done through a web server that runs -concurrently with the handin server if you use the -@scheme[https-port-number] option in the configuration file. The -starting URL is +concurrently with the handin server (on the same port) if you set the +@scheme[use-https] option in the configuration file to @scheme[#t] (the +default). The starting URL is @commandline{https://SERVER:PORT/} diff --git a/collects/handin-server/web-status-server.ss b/collects/handin-server/web-status-server.ss index 031eca897e..297cc4e2f5 100644 --- a/collects/handin-server/web-status-server.ss +++ b/collects/handin-server/web-status-server.ss @@ -254,16 +254,27 @@ (provide run) (define (run) - (cond [(get-conf 'https-port-number) - => (lambda (p) - (begin0 (parameterize ([error-print-context-length 0]) - (run-servlet - dispatcher - #:namespace '(handin-server/private/md5 - handin-server/private/logger - handin-server/private/config - handin-server/private/hooker - handin-server/private/reloadable) - #:log-file (get-conf 'web-log-file))) - (log-line "*** embedded web server started")))] - [else void])) + (if (get-conf 'use-https) + (begin0 (parameterize ([error-print-context-length 0]) + (run-servlet + dispatcher + #:namespace '(handin-server/private/md5 + handin-server/private/logger + handin-server/private/config + handin-server/private/hooker + handin-server/private/reloadable) + #:log-file (get-conf 'web-log-file))) + (log-line "*** embedded web server started")) + ;; simple "server" so it's known that there is no server + (lambda (msg . args) + (when (eq? 'connect msg) + (for-each (lambda (x) (display x (cadr args))) + '(#"HTTP/1.0 200 OK\r\n" + #"Content-Type: text/html\r\n" + #"\r\n" + #"

" + #"Please use the handin plugin" + #"

")) + (close-input-port (car args)) + (close-output-port (cadr args)) + (semaphore-post (caddr args))))))