深入理解计算机系统 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 */
相关推荐
Hi202402171 小时前
消除FFmpeg库的SONAME依赖
linux·ffmpeg
gfanbei2 小时前
ARM V8 Cortex R52 上电运行在什么状态?— Deepseek 解答
linux·arm开发·嵌入式硬件
liu****3 小时前
14.日志封装和线程池封装
linux·开发语言·c++
云动雨颤3 小时前
访问宝塔面板安全入口404?SSH命令轻松解决
linux·运维·安全
NPE~3 小时前
[Linux命令分享]日志查看 — — less
linux·运维·less·常用命令·日志查看
赖small强4 小时前
Linux 系统调用在 ARM 上的实现与工作机制
linux·系统调用·内核态·用户态·上下文切换
大锦终5 小时前
【Linux】网络层与数据链路层中重点介绍
linux·运维·服务器·网络
lht6319356126 小时前
从Windows通过XRDP远程访问和控制银河麒麟 v10服务器
linux·运维·服务器·windows
qiudaorendao6 小时前
作业11.9
linux·服务器·apache
阿豪学编程6 小时前
环境变量与程序地址空间
linux·运维·windows