Commit Diff


commit - d421a781300d0f29c6f8fb47e6c438e19823e255
commit + d3b734c59c04287dfb0438550d99c8f1b69c06c0
blob - 7f61575cf6508aff8065ebf667e38c5fe934999e
blob + 3ee77039ef1f5508d98c9b838ba3c3e7bc425bc3
--- cgi.c
+++ cgi.c
@@ -46,6 +46,10 @@ status_text(int code)
 		return "Unauthorized";
 	case 403:
 		return "Forbidden";
+	case 404:
+		return "Not Found";
+	case 405:
+		return "Method Not Allowed";
 	case 409:
 		return "Conflict";
 	case 500:
blob - d512b12b1e6a25654703e290d008afddc7703a03
blob + 0fd26948843cb053bbc795858509a09691054327
--- deskd.c
+++ deskd.c
@@ -157,8 +157,13 @@ main(int argc, char *argv[])
 	} else if (strcmp(method, "POST") == 0 && pathlen > 6 &&
 	    strncmp(path, "/book/", 6) == 0) {
 		handle_book(path + 6);
+	} else if (strcmp(path, "/") == 0 ||
+	    strcmp(path, "/about") == 0 ||
+	    strcmp(path, "/book") == 0 ||
+	    (pathlen > 6 && strncmp(path, "/book/", 6) == 0)) {
+		cgi_error(405);
 	} else {
-		cgi_error(400);
+		cgi_error(404);
 	}
 
 	free(path_copy);