From 6005f64915b7047bde64de80c047a2326eab5ba4 Mon Sep 17 00:00:00 2001 From: erana Date: Mon, 23 Jan 2012 03:10:30 +0900 Subject: [PATCH] thttpd - web daemon software - fixes 1 --- scsh/thttpd/thttpdaemon.scm | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/scsh/thttpd/thttpdaemon.scm b/scsh/thttpd/thttpdaemon.scm index ea6d6fa..9c569d8 100644 --- a/scsh/thttpd/thttpdaemon.scm +++ b/scsh/thttpd/thttpdaemon.scm @@ -29,7 +29,7 @@ (define (eoln) (string #\newline)) (define (servermsg) (string "::thttpd-msg::")) (define (errormsg) (string "::thttpd-error::")) -(define aspect-content "Content-Type: text/plain;charset=utf-8");; (string #\newline))) +(define aspect-content (string-append "Content-Type: text/plain;charset=utf-8" (string #\newline))) (define :thttpd-daemon-record (make-record-type 'thttpd-daemon-record '(hostname port sock))) @@ -60,21 +60,20 @@ (lambda () (socket-accept *socket)) (lambda (in out) - ;;(let ((in (make-string-input-port in))) - (let ((answer (read in))) - ;;(let ((answer2 (read in))) - ;;(let ((answer3 (read in))) - (for-each display '((servermsg) (symbol->string answer))) - (if (symbol? answer) - (cond ((eq? 'GET answer) - (write aspect-content out) - (write (string #\newline)) - (write "Hello World" out) - ;;(close-input-port in) - ;;(close-socket *socket) - ;;(close-output-port out) - ) - (else ;; + keep-alive - (write (errormsg) out)) - )))))))));;);;) + (let ((a (read in))) + ;;(let ((in (make-string-input-port in))) + (for-each display '((servermsg) (symbol->string a))) + (if (symbol? a) + (cond ((eq? a 'GET) + (write "Hello World") + (write aspect-content out) + (write (string #\newline) out) + (write "Hello World" out) + ;;(close-input-port in) + ;;(close-socket *socket) + ;;(close-output-port out) + ) + (else ;; + keep-alive + (write (errormsg) out)) + )))))))))