深入理解计算机系统 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 */
相关推荐
好评12428 分钟前
Linux入门:软件包管理、Vim、GCC、Makefile、Git 与 GDB
linux·运维·服务器
可爱又迷人的反派角色“yang”1 小时前
ansible剧本编写(三)
linux·网络·云计算·ansible
石像鬼₧魂石7 小时前
内网渗透靶场实操清单(基于 Vulhub+Metasploitable 2)
linux·windows·学习·ubuntu
橘子真甜~8 小时前
C/C++ Linux网络编程15 - 网络层IP协议
linux·网络·c++·网络协议·tcp/ip·计算机网络·网络层
拾贰_C9 小时前
【Linux | Windows | Terminal Command】 Linux---grep | Windows--- findstr
linux·运维·服务器
阿华hhh10 小时前
Linux系统编程(标准io)
linux·开发语言·c++
石像鬼₧魂石10 小时前
Kali Linux 网络端口深度扫描
linux·运维·网络
alengan10 小时前
linux上面写python3日志服务器
linux·运维·服务器
Rose sait11 小时前
【环境配置】Linux配置虚拟环境pytorch
linux·人工智能·python