aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cuirass/base.scm2
-rw-r--r--src/cuirass/http.scm15
2 files changed, 17 insertions, 0 deletions
diff --git a/src/cuirass/base.scm b/src/cuirass/base.scm
index 3dbc5f4..c1e6383 100644
--- a/src/cuirass/base.scm
+++ b/src/cuirass/base.scm
@@ -63,6 +63,8 @@
build-packages
prepare-git
process-specs
+ evaluation-log-file
+
;; Parameters.
%package-cachedir
%gc-root-directory
diff --git a/src/cuirass/http.scm b/src/cuirass/http.scm
index b6a4358..9f5fdce 100644
--- a/src/cuirass/http.scm
+++ b/src/cuirass/http.scm
@@ -24,6 +24,7 @@
(define-module (cuirass http)
#:use-module (cuirass config)
#:use-module (cuirass database)
+ #:use-module ((cuirass base) #:select (evaluation-log-file))
#:use-module (cuirass utils)
#:use-module (cuirass logging)
#:use-module (srfi srfi-1)
@@ -211,6 +212,14 @@ Hydra format."
#:body (call-with-input-file file-path get-bytevector-all))
(respond-not-found file-name))))
+ (define (respond-gzipped-file file)
+ ;; Return FILE with 'gzip' content-encoding.
+ (respond `((content-type . (text/plain (charset . "UTF-8")))
+ (content-encoding . (gzip)))
+ ;; FIXME: FILE is potentially big so it'd be better to not load
+ ;; it in memory and instead 'sendfile' it.
+ #:body (call-with-input-file file get-bytevector-all)))
+
(define (respond-build-not-found build-id)
(respond-json-with-error
404
@@ -438,6 +447,12 @@ Hydra format."
(#:link . ,(string-append "/eval/" id)))))))
(respond-html-eval-not-found id))))
+ (("eval" (= string->number id) "log" "raw")
+ (let ((log (and id (evaluation-log-file id))))
+ (if (and log (file-exists? log))
+ (respond-gzipped-file log)
+ (respond-not-found (uri->string (request-uri request))))))
+
(("search")
(let* ((params (request-parameters request))
(query (and=> (assq-ref params 'query) uri-decode))