string error_msg(int what, string kind, string long) { string tmp = what + " " + kind; return html_page(tmp, long + "<P>"); } string not_found(string uri) { return error_msg(404, "Not Found", "The requested URL '"+uri+"' was not found on this server."); } string not_implemented(string req) { return error_msg(500, "Not Implemented", "The request '" + req + "' is not supported by this server."); } void process_input(string str) { string uri; string response; if (sscanf(str, "GET %s", uri)) { sscanf(uri, "%s HTTP/1.0", uri); response = master()->process_request(uri); if (response) { receive(response); } else { receive(not_found(uri)); } } else { receive(not_implemented(str)); write_file("/log/request", "Request " + str + " unknown.\n"); } destruct(this_object()); }