Skip to content

Instantly share code, notes, and snippets.

/server.c Secret

Created August 20, 2016 17:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/a37f7cd1cad7403346e8e7df90b57813 to your computer and use it in GitHub Desktop.
Save anonymous/a37f7cd1cad7403346e8e7df90b57813 to your computer and use it in GitHub Desktop.
server.c - shared from CS50 IDE
const char* lookup(const char* path)
{
const char c = '.';
char* ext = strrchr(path, c);
if (ext != NULL)
{
if (strcasecmp(ext, ".css"))
return "text/css";
if (strcasecmp(ext, ".html"))
return "text/html";
if (strcasecmp(ext, ".gif"))
return "image/gif";
if (strcasecmp(ext, ".ico"))
return "image/x-icon";
if (strcasecmp(ext, ".jpg"))
return "image/jpeg";
if (strcasecmp(ext, ".js"))
return "text/javascript";
if (strcasecmp(ext, ".php"))
return "text/x-php";
if (strcasecmp(ext, ".png"))
return "image/png";
}
return NULL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment