start | find | index | login or register | edit
Mittwoch, 4. November 2009 link

In the spirit of 2006-05-07's minimal-but-not-totally-compliant HTTP server written in REBOL 2, here's the same thing written in REBOL 3:

r: to-binary ajoin [
"HTTP/1.0 503 Service Unavailable" crlf
"Content-type: text/plain" crlf
crlf
"server down for maintenance, we'll be back soon! "
"[503 service unavailable]" crlf
]

s: open tcp://:8080
s/awake: func [e] [if e/type = 'accept [close write first e/port r prin '.]]
wait s

Yay, one line down! Beware though, as this will happily idle at maximum CPU usage on Linux or OSX until bug #913 gets fixed.


no comments

Please log in (you may want to register first) to post comments!

powered by vanilla
echo earlZstrainYat|tr ZY @.
earl.strain.at • esa3 • online for 8692 days • c'est un vanilla site