SSE - 500 Internal Server Error and no debug-log or error-log info added by arthurmaciel on Tue Jun 24 04:26:55 2014
(use awful spiffy extras data-structures) (enable-sxml #t) (debug-log "debug.log") (error-log "error.log") (define-page "/test" (lambda () (add-javascript "var source = new EventSource('/sse'); source.onmessage = function (event) { document.body.innerHTML = event.data; };") "")) (define (send-sse-headers) (let ((resp (update-response (current-response) code: 200 reason: "OK" headers: (headers '((content-type text/event-stream) (cache-control no-cache) (connection keep-alive) (transfer-encoding chunked)) (response-headers (current-response)))))) (parameterize ((current-response resp)) (write-logged-response)))) (define (send-sse-data data) (display (conc "data: " data "\n\n") (response-port (current-response))) (finish-response-body (current-response))) (define-page "/sse" (lambda () (send-sse-headers) (let loop () (send-sse-data (random 10)) (thread-sleep! 5) (loop)))) ;;; Firefox developer console ;; GET http://zion:8080/test [HTTP/1.1 200 OK 16 ms] ;; GET http://zion:8080/sse [HTTP/1.1 500 Internal server error 51 ms] ;; Firefox could not establish connection with server http://zion:8080/sse ;; URL: http:/zion:8080/sse ;; Method: GET ;; Status code: HTTP/1.1 500 Internal server error ;; Response headers: ;; Server: Spiffy/5.2 (Running on Chicken 4.8.0.5) ;; Date: Tue, 24 Jun 2014 01:19:03 GMT ;; Content-Type: text/html ;; Content-Length: 62 ;;; debug-log ;; thread131: Incoming request from 192.168.1.2 ;; thread131: Handling request from 192.168.1.2 ;; thread131: Kept alive ;; thread131: Handling request from 192.168.1.2 ;; thread131: Kept alive ;; thread131: Error: ;; read operation timed out ;; 60000 ;; 5 ;; Call history: ;; spiffy.scm:181: with-output-to-file ;; spiffy.scm:187: newline ;; spiffy.scm:611: handle-next-request ;; spiffy.scm:467: call-with-current-continuation ;; spiffy.scm:467: with-exception-handler ;; spiffy.scm:467: ##sys#call-with-values ;; spiffy.scm:467: ##sys#call-with-values ;; spiffy.scm:475: call/cc ;; spiffy.scm:475: intarweb#read-request ;; intarweb.scm:613: safe-read-line ;; intarweb.scm:140: http-line-limit ;; intarweb.scm:141: http-line-limit ;; intarweb.scm:141: read-line ;; spiffy.scm:467: k657 ;; spiffy.scm:467: g661 ;; spiffy.scm:469: with-output-to-string <-- ;; thread131: Closing off ;; thread132: Incoming request from 192.168.1.2 ;; thread132: Handling request from 192.168.1.2 ;; thread132: Kept alive ;; thread132: Handling request from 192.168.1.2 ;; thread132: Kept alive ;;; error-log - none written