REBOL Webserver Error:" err/3 " " file newline
] close port ] send-page: func [ port data mime ] [ insert data rejoin [ "HTTP/1.0 200 OK^/Content-type: " mime "^/Content-length: " length? data "^/^/" ] write port data ] server/awake: func [ event /local port ] [ if event/type = 'accept [ port: first event/port port/awake: func [ event /local data dat] [ probe event/type switch event/type [ read [ print [ "Client said:" ] request: to-string event/port/data file: "index.html" mime: "text/plain" parse request [ "GET" thru " " copy file to " "] parse file [thru "." [ "html" (mime: "text/html") | "gif" (mime: "image/gif") | "jpg" (mime: "image/jpeg") ] ] print [ "debug:" web-dir/:file space mime] if not exists? to-file web-dir/:file [ send-error event/port 404 file return true ] if error? try [ data: read to-file web-dir/:file ] [ send-error event/port 400 file return true ] send-page event/port data mime ] wrote [ read event/port ] close [ close event/port return true ] ] false ] read port ] false ] wait [ server ] close server wait 2