httpd/
httpd/lib/
httpd/lib/data/
httpd/lib/include/
/* This object controls everything */

object connect() {
    return new("/connection");
}

string process_request(string uri) {
    sscanf(uri, "%s.html", uri);
    sscanf(uri, "/%s", uri);
    if (uri == "") uri = "index";
    
    if (file_size("/data/" + uri) == -2) {
	if (uri[<1] == '/')
	    uri += "index";
	else
	    uri += "/index";
    }
    if (strsrch(uri, "..") != -1) return 0;
    if (file_size("/data/" + uri + ".html") >= 0)
	return read_file("/data/" + uri + ".html");
    if (file_size("/data/" + uri + ".c") >= 0)
	return ("/data/" + uri)->request();
    return 0;
}

void log_error(string file, string msg) {
    write_file("/log/compile", file + ":" + msg + "\n");
}