changeset 149:804e48af1027

Fix file not found handling
author Mike Pavone <pavone@retrodev.com>
date Mon, 22 Nov 2010 20:38:03 +0000
parents f582fd6c75ee
children 50c97b448f44
files webserver.rhope
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/webserver.rhope	Mon Nov 22 01:37:05 2010 -0500
+++ b/webserver.rhope	Mon Nov 22 20:38:03 2010 +0000
@@ -129,16 +129,18 @@
 			,newpath <- [path]Slice[1]
 			Good Path?[newpath]
 			{
-				file <- Open[File[newpath],"r"]
+				file,bad file <- Open[File[newpath],"r"]
 				content length <- Length[file]
-				If[[content length] > [0]]
+				,bad file <- If[[content length] > [0]]
 				{
 					data <- [file]Read[content length]
 					[[HTTP OK[client, Get Content Type[path], content length, Dictionary[]]
 					]Write[data]
 					]Close
 					{ Close[file] }
-				}{
+				}
+				Val[bad file]
+				{
 					HTTP Not Found[client]
 				}
 			}{