1 Star 0 Fork 0

prookie01 / 个人播客web服务器

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
fileType.c 1.30 KB
一键复制 编辑 原始数据 按行查看 历史
prookie01 提交于 2023-05-15 13:40 . webServer简单的实现文件
#include "fileType.h"
char *get_mime_type(char *name)
{
char *dot;
dot = strrchr(name,'.');//向左查找 . 不存在返回NULL
if(dot == (char*)0)
return "text/plain; charset=utf-8";
if(strcmp(dot,".html")==0 || strcmp(dot,".htm")==0)
return "text/html; charset=utf-8";
if(strcmp(dot,".jpg")==0 || strcmp(dot,".jpeg")==0)
return "image/jpeg";
if(strcmp(dot,".gif")==0)
return "image/gif";
if(strcmp(dot,".png")==0==0)
return "image/png";
if(strcmp(dot,".css")==0)
return "text/css";
if(strcmp(dot,".au")==0)
return "audio/basic";
if(strcmp(dot,".wav")==0)
return "audio/wav";
if(strcmp(dot,".avi")==0)
return "video/x-msvideo";
if(strcmp(dot,".mov")==0 || strcmp(dot,".qt")==0)
return "video/quicktime";
if(strcmp(dot,".mpeg")==0 || strcmp(dot,".mpe")==0)
return "video/mpeg";
if(strcmp(dot,".vrml")==0 || strcmp(dot,".wrl")==0)
return "model/vrml";
if(strcmp(dot,".midi")==0 || strcmp(dot,".mid")==0)
return "audio/midi";
if(strcmp(dot,".mp3")==0)
return "audio/mpeg";
if(strcmp(dot,".ogg")==0)
return "application/ogg";
if(strcmp(dot,".pac")==0)
return "application/x-ns-proxy-autoconfig";
return "text/plain;charset=utf-8";
}
C
1
https://gitee.com/prookie01/personal-podcast-web-server.git
git@gitee.com:prookie01/personal-podcast-web-server.git
prookie01
personal-podcast-web-server
个人播客web服务器
master

搜索帮助