深入理解计算机系统 CSAPP 家庭作业11.7

静态内容是指在不同请求中访问到的数据都相同的静态文件。例如:图片、视频、网站中的文件(html、css、js)、软件安装包、apk文件、压缩包文件等。

复制代码
/*
 * get_filetype - derive file type from file name
 */
void get_filetype(char *filename, char *filetype) 
{
    if (strstr(filename, ".html"))
	strcpy(filetype, "text/html");
    else if (strstr(filename, ".gif"))
	strcpy(filetype, "image/gif");
    else if (strstr(filename, ".png"))
	strcpy(filetype, "image/png");
    else if (strstr(filename, ".jpg"))
	strcpy(filetype, "image/jpeg");
	else if (strstr(filename, ".mpg"))
	strcpy(filetype, "video/mpg");
    else
	strcpy(filetype, "text/plain");
}  
/* $end serve_static */
相关推荐
188号安全攻城狮7 分钟前
【PWN】HappyNewYearCTF_9_ret2syscall
linux·汇编·安全·网络安全·系统安全
开开心心_Every12 分钟前
Win10/Win11版本一键切换工具
linux·运维·服务器·edge·pdf·web3·共识算法
JiMoKuangXiangQu25 分钟前
Linux 内存:kasan 监测访问越界案例
linux·kasan
怣5025 分钟前
Linux创意命令组合:让终端变得有趣又高效
linux·运维·服务器
L_090730 分钟前
【Linux】进程状态
linux·开发语言·c++
小生不才yz34 分钟前
shell编程 - 数据流指南
linux
lisanmengmeng40 分钟前
添加ceph节点
linux·服务器·ceph
Tinyundg43 分钟前
Linux系统分区
linux·运维·服务器
江畔何人初1 小时前
service发现
linux·运维·云原生
life码农1 小时前
Linux系统清空文件内容的几种方法
linux·运维·chrome