-
-
Save anonymous/a37f7cd1cad7403346e8e7df90b57813 to your computer and use it in GitHub Desktop.
server.c - shared from CS50 IDE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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