handin-server updates for v371

svn: r7122
This commit is contained in:
Matthew Flatt 2007-08-19 18:56:50 +00:00
parent 3f2341cda8
commit a626d25acd
3 changed files with 28 additions and 21 deletions

View File

@ -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".

View File

@ -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" #"<<<MULTI-SUBMISSION-FILE>>>"))
(define magics '(#"WXME"
#"<<<MULTI-SUBMISSION-FILE>>>"
#"#reader(lib\"read.ss\"\"wxme\")WXME"))
(define mlen (apply max (map bytes-length magics)))
(define file
;; find the newest wxme file

View File

@ -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)