first shot on adding servlets to HTTPD

This commit is contained in:
interp
2002-09-13 07:21:19 +00:00
parent becf14ce30
commit d5b2b448d9
9 changed files with 478 additions and 6 deletions
+3 -1
View File
@@ -16,6 +16,8 @@
<li><a href=info?(dir)Top>Get the dir info page</a><br>
(needs a matching info page installation;<br>
&nbsp;among others, we need non-gzipped info pages)</li>
<li><a href=/servlet/test.scm>A test servlet</a></li>
<li><a href=/servlet/news.scm>News</a></li>
<li><a href=files/text.txt>Text file</a></li>
<li><a href=files>Directory</a></li>
<li><a href=files/zipped.gz>Compressed File</a></li>
@@ -28,7 +30,7 @@
<hr>
<!-- Created: Thu Aug 22 16:44:16 CEST 2002 -->
<!-- hhmts start -->
Last modified: Thu Aug 29 16:37:20 CEST 2002
Last modified: Thu Sep 12 17:06:32 CEST 2002
<!-- hhmts end -->
</body>
</html>
+42
View File
@@ -0,0 +1,42 @@
(define-structure plugin plugin-interface
(open scsh
scheme
plugin-utilities
httpd-responses
crlf-io)
(begin
(define (main req)
(let ((news-input (open-input-file "news.txt")))
(let loop ()
(let ((next-line (read-crlf-line news-input)))
(if (eof-object? next-line)
(send/finish
(make-response
http-status/ok
(status-code->text http-status/ok)
(time)
"text/html"
'()
(make-writer-body
(lambda (out options)
(format out
"<HTML><BODY><H1>THAT'S IT<H1><P>
That's it...</BODY></HTML>")))))
(begin
(send/suspend
(lambda (next-url)
(make-response
http-status/ok
(status-code->text http-status/ok)
(time)
"text/html"
'()
(make-writer-body
(lambda (out options)
(format out
"<HTML><BODY><H1>~a<H1><P>
<A href=~a>read more...</A></BODY></HTML>"
next-line
next-url))))))
(loop)))))))
))
+4
View File
@@ -0,0 +1,4 @@
Bin Laden still alive!
Mahadma Ghandi's grave stolen!
MAKE MONEY FAST!
Get mor bucks!!!
+16
View File
@@ -0,0 +1,16 @@
(define-structure plugin plugin-interface
(open scsh
scheme
httpd-responses)
(begin
(define (main send/suspend)
(make-response
http-status/ok
(status-code->text http-status/ok)
(time)
"text/html"
'()
(make-writer-body
(lambda (out options)
(format out "<HTML><BODY><H1>THIS IS FROM SERVLET</H1></BODY></HTML>~%")))))))