深入理解计算机系统 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 */
相关推荐
写bug如流水1 分钟前
在Ubuntu 20.04上安装pgAdmin 4
linux·运维·ubuntu
冰红茶兑滴水8 分钟前
Linux 线程控制
linux·c++·算法
IT良20 分钟前
while循环及简单案例
linux·服务器
码哝小鱼31 分钟前
iptables限制网速
linux·服务器·网络
leaoleao沄40 分钟前
linux-IO-进程-线程(相关函数)
linux·运维·服务器
frank00600711 小时前
linux 使用mdadm 创建raid0 nvme 磁盘
linux·运维
绿白尼1 小时前
进程与线程
linux
iangyu1 小时前
linux命令之pwdx
linux·运维·服务器
C语言扫地僧1 小时前
Docker 镜像制作(Dockerfile)
linux·服务器·docker·容器
Xinan_____2 小时前
Linux——高流量 高并发(访问场景) 高可用(架构要求)
linux·运维·架构