about summary refs log tree commit diff stats
path: root/http-server.mu
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-07-27 16:01:55 -0700
committerKartik Agaram <vc@akkartik.com>2019-07-27 17:47:59 -0700
commit6e1eeeebfb453fa7c871869c19375ce60fbd7413 (patch)
tree539c4a3fdf1756ae79770d5c4aaf6366f1d1525e /http-server.mu
parent8846a7f85cc04b77b2fe8a67b6d317723437b00c (diff)
downloadmu-6e1eeeebfb453fa7c871869c19375ce60fbd7413.tar.gz
5485 - promote SubX to top-level
Diffstat (limited to 'http-server.mu')
-rw-r--r--http-server.mu28
1 files changed, 0 insertions, 28 deletions
diff --git a/http-server.mu b/http-server.mu
deleted file mode 100644
index 6bd172b3..00000000
--- a/http-server.mu
+++ /dev/null
@@ -1,28 +0,0 @@
-# example program: a single-request HTTP server
-#   listen for connections from clients on a server socket
-#   when a connection occurs, transfer it to a session socket
-#   read from it using channels
-#   write to it directly
-#
-# After running it, navigate to localhost:8080. Your browser should display
-# "SUCCESS!" and the server will terminate after one connection.
-
-def main [
-  local-scope
-  socket:num <- $open-server-socket 8080/port
-  $print [Mu socket creation returned ], socket, 10/newline
-  return-unless socket
-  session:num <- $accept socket
-  contents:&:source:char, sink:&:sink:char <- new-channel 30
-  sink <- start-running receive-from-socket session, sink
-  query:text <- drain contents
-  $print [Done reading from socket.], 10/newline
-  write-to-socket session, [HTTP/1.0 200 OK
-Content-type: text/plain
-
-SUCCESS!
-]
-  $print 10/newline, [Wrote to and closing socket...], 10/newline
-  session <- $close-socket session
-  socket <- $close-socket socket
-]