I don't know what the switch is doing, you don't have any case statements there:
switch(0){ if(0x0);
else if(ext == "htm") doHTML(parameter, client);
else if(ext == "jpg") doJPG( parameter, client);
else if(ext == "txt") doTXT( parameter, client);
else crash(4002, "unknown file extension");
}
Also I advise against using the String class, it can be a memory hog.