handin-server updates for v371
svn: r7122
This commit is contained in:
parent
3f2341cda8
commit
a626d25acd
|
@ -39,15 +39,16 @@ Quick Start for a Test Drive:
|
||||||
|
|
||||||
2. Copy "server-cert.pem" from the "handin-client" collection
|
2. Copy "server-cert.pem" from the "handin-client" collection
|
||||||
to the new directory.
|
to the new directory.
|
||||||
NOTE: for real use, you need a new certificate.
|
NOTE: For real use, you need a new certificate.
|
||||||
NOTE: see also "Where is the collection?", below
|
NOTE: See also "Where is the collection?", below.
|
||||||
|
|
||||||
3. Copy "private-key.pem" from the "handin-server" collection
|
3. Copy "private-key.pem" from the "handin-server" collection
|
||||||
to the new directory.
|
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:
|
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.
|
5. Make a "test" subdirectory in your new directory.
|
||||||
|
|
||||||
|
@ -58,14 +59,13 @@ Quick Start for a Test Drive:
|
||||||
mred -mvqM handin-server
|
mred -mvqM handin-server
|
||||||
|
|
||||||
8. In the "handin-client" collection, edit "info.ss" and
|
8. In the "handin-client" collection, edit "info.ss" and
|
||||||
uncomment the line
|
uncomment the lines that define `server:port', `tools',
|
||||||
(define server:port "localhost:7979")
|
`tool-names', and `tool-icons'.
|
||||||
and the lines that define `tools', `tool-names', and
|
|
||||||
`tool-icons'.
|
|
||||||
|
|
||||||
9. Run `setup-plt -l handin-client' (on Windows, the executable is
|
9. Run `setup-plt -l handin-client'
|
||||||
"Setup PLT", and you don't have to supply the command line
|
NOTE: Under Windows, the executable is "Setup PLT"
|
||||||
arguments).
|
instead of setup-plt.
|
||||||
|
NOTE: The command line arguments are optional.
|
||||||
|
|
||||||
10. Start DrScheme, click "Handin" to run the client, submit with
|
10. Start DrScheme, click "Handin" to run the client, submit with
|
||||||
username "tester" and password "pw".
|
username "tester" and password "pw".
|
||||||
|
|
|
@ -282,7 +282,9 @@
|
||||||
(error* "no ~a submission directory for ~a" assignment users))
|
(error* "no ~a submission directory for ~a" assignment users))
|
||||||
(log-line "retrieving assignment for ~a: ~a" users assignment)
|
(log-line "retrieving assignment for ~a: ~a" users assignment)
|
||||||
(parameterize ([current-directory submission-dir])
|
(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 mlen (apply max (map bytes-length magics)))
|
||||||
(define file
|
(define file
|
||||||
;; find the newest wxme file
|
;; find the newest wxme file
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
(lib "string.ss")
|
(lib "string.ss")
|
||||||
(lib "date.ss")
|
(lib "date.ss")
|
||||||
(lib "servlet.ss" "web-server")
|
(lib "servlet.ss" "web-server")
|
||||||
(lib "response-structs.ss" "web-server")
|
(lib "servlet-structs.ss" "web-server" "servlet")
|
||||||
(lib "uri-codec.ss" "net")
|
(lib "uri-codec.ss" "net")
|
||||||
(lib "md5.ss" "handin-server" "private")
|
(lib "md5.ss" "handin-server" "private")
|
||||||
(lib "logger.ss" "handin-server" "private")
|
(lib "logger.ss" "handin-server" "private")
|
||||||
|
@ -175,6 +175,7 @@
|
||||||
(loop base (cdr elts)))))))
|
(loop base (cdr elts)))))))
|
||||||
(define file (build-path server-dir tag))
|
(define file (build-path server-dir tag))
|
||||||
(with-handlers ([exn:fail? (lambda (exn)
|
(with-handlers ([exn:fail? (lambda (exn)
|
||||||
|
(log-line "Status exception: ~s" exn)
|
||||||
(make-page "Error" "Illegal file access"))])
|
(make-page "Error" "Illegal file access"))])
|
||||||
;; Make sure the user is allowed to read the requested file:
|
;; Make sure the user is allowed to read the requested file:
|
||||||
(or (check file `(,who *) #t)
|
(or (check file `(,who *) #t)
|
||||||
|
@ -187,17 +188,21 @@
|
||||||
(let* ([data (with-input-from-file file
|
(let* ([data (with-input-from-file file
|
||||||
(lambda () (read-bytes (file-size file))))]
|
(lambda () (read-bytes (file-size file))))]
|
||||||
[html? (regexp-match? #rx"[.]html?$" (string-foldcase tag))]
|
[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)
|
(make-response/full 200 "Okay" (current-seconds)
|
||||||
(cond [html? #"text/html"]
|
(cond [html? #"text/html"]
|
||||||
[wxme? #"application/data"]
|
[wxme? #"application/data"]
|
||||||
[else #"text/plain"])
|
[else #"text/plain"])
|
||||||
`([Content-Length . ,(number->string (bytes-length data))]
|
(list
|
||||||
[Content-Disposition
|
(make-header #"Content-Length"
|
||||||
. ,(format "~a; filename=~s"
|
(string->bytes/latin-1
|
||||||
(if wxme? "attachment" "inline")
|
(number->string (bytes-length data))))
|
||||||
(let-values ([(base name dir?) (split-path file)])
|
(make-header #"Content-Disposition"
|
||||||
(path->string name)))])
|
(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)))))
|
(list data)))))
|
||||||
|
|
||||||
(define (status-page user for-handin)
|
(define (status-page user for-handin)
|
||||||
|
@ -251,7 +256,7 @@
|
||||||
(parameterize ([current-session (web-counter)])
|
(parameterize ([current-session (web-counter)])
|
||||||
(login-page null (aget (request-bindings initial-request) 'handin) #f)))
|
(login-page null (aget (request-bindings initial-request) 'handin) #f)))
|
||||||
|
|
||||||
(define interface-version 'v2-transitional)
|
(define interface-version 'v1)
|
||||||
(define timeout 600)
|
(define timeout 600)
|
||||||
|
|
||||||
(define (instance-expiration-handler failed-request)
|
(define (instance-expiration-handler failed-request)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user