From a626d25acdba3e8dc8b4fdd7e60328a591e74580 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 19 Aug 2007 18:56:50 +0000 Subject: [PATCH] handin-server updates for v371 svn: r7122 --- collects/handin-server/doc.txt | 22 +++++++++--------- collects/handin-server/handin-server.ss | 4 +++- .../status-web-root/servlets/status.ss | 23 +++++++++++-------- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/collects/handin-server/doc.txt b/collects/handin-server/doc.txt index d3d7a0bdc2..961e37ca6a 100644 --- a/collects/handin-server/doc.txt +++ b/collects/handin-server/doc.txt @@ -39,15 +39,16 @@ Quick Start for a Test Drive: 2. Copy "server-cert.pem" from the "handin-client" collection to the new directory. - NOTE: for real use, you need a new certificate. - NOTE: see also "Where is the collection?", below + NOTE: For real use, you need a new certificate. + NOTE: See also "Where is the collection?", below. 3. Copy "private-key.pem" from the "handin-server" collection to the new directory. - NOTE: for real use, you need a new key. + NOTE: For real use, you need a new key. 4. Create a file "users.ss" with the following content: - ((tester ("8fe4c11451281c094a6578e6ddbf5eed"))) + ((tester ("8fe4c11451281c094a6578e6ddbf5eed" + "Tester" "1" "test@cs"))) 5. Make a "test" subdirectory in your new directory. @@ -58,14 +59,13 @@ Quick Start for a Test Drive: mred -mvqM handin-server 8. In the "handin-client" collection, edit "info.ss" and - uncomment the line - (define server:port "localhost:7979") - and the lines that define `tools', `tool-names', and - `tool-icons'. + uncomment the lines that define `server:port', `tools', + `tool-names', and `tool-icons'. - 9. Run `setup-plt -l handin-client' (on Windows, the executable is - "Setup PLT", and you don't have to supply the command line - arguments). + 9. Run `setup-plt -l handin-client' + NOTE: Under Windows, the executable is "Setup PLT" + instead of setup-plt. + NOTE: The command line arguments are optional. 10. Start DrScheme, click "Handin" to run the client, submit with username "tester" and password "pw". diff --git a/collects/handin-server/handin-server.ss b/collects/handin-server/handin-server.ss index 66e8532f73..7137126c48 100644 --- a/collects/handin-server/handin-server.ss +++ b/collects/handin-server/handin-server.ss @@ -282,7 +282,9 @@ (error* "no ~a submission directory for ~a" assignment users)) (log-line "retrieving assignment for ~a: ~a" users assignment) (parameterize ([current-directory submission-dir]) - (define magics '(#"WXME" #"<<>>")) + (define magics '(#"WXME" + #"<<>>" + #"#reader(lib\"read.ss\"\"wxme\")WXME")) (define mlen (apply max (map bytes-length magics))) (define file ;; find the newest wxme file diff --git a/collects/handin-server/status-web-root/servlets/status.ss b/collects/handin-server/status-web-root/servlets/status.ss index 891fa69062..86e58bf1dd 100644 --- a/collects/handin-server/status-web-root/servlets/status.ss +++ b/collects/handin-server/status-web-root/servlets/status.ss @@ -4,7 +4,7 @@ (lib "string.ss") (lib "date.ss") (lib "servlet.ss" "web-server") - (lib "response-structs.ss" "web-server") + (lib "servlet-structs.ss" "web-server" "servlet") (lib "uri-codec.ss" "net") (lib "md5.ss" "handin-server" "private") (lib "logger.ss" "handin-server" "private") @@ -175,6 +175,7 @@ (loop base (cdr elts))))))) (define file (build-path server-dir tag)) (with-handlers ([exn:fail? (lambda (exn) + (log-line "Status exception: ~s" exn) (make-page "Error" "Illegal file access"))]) ;; Make sure the user is allowed to read the requested file: (or (check file `(,who *) #t) @@ -187,17 +188,21 @@ (let* ([data (with-input-from-file file (lambda () (read-bytes (file-size file))))] [html? (regexp-match? #rx"[.]html?$" (string-foldcase tag))] - [wxme? (regexp-match? #rx#"^WXME" data)]) + [wxme? (regexp-match? #rx#"^(?:#reader[(]lib\"read.ss\"\"wxme\"[)])?WXME" data)]) (make-response/full 200 "Okay" (current-seconds) (cond [html? #"text/html"] [wxme? #"application/data"] [else #"text/plain"]) - `([Content-Length . ,(number->string (bytes-length data))] - [Content-Disposition - . ,(format "~a; filename=~s" - (if wxme? "attachment" "inline") - (let-values ([(base name dir?) (split-path file)]) - (path->string name)))]) + (list + (make-header #"Content-Length" + (string->bytes/latin-1 + (number->string (bytes-length data)))) + (make-header #"Content-Disposition" + (string->bytes/utf-8 + (format "~a; filename=~s" + (if wxme? "attachment" "inline") + (let-values ([(base name dir?) (split-path file)]) + (path->string name)))))) (list data))))) (define (status-page user for-handin) @@ -251,7 +256,7 @@ (parameterize ([current-session (web-counter)]) (login-page null (aget (request-bindings initial-request) 'handin) #f))) - (define interface-version 'v2-transitional) + (define interface-version 'v1) (define timeout 600) (define (instance-expiration-handler failed-request)