深入理解计算机系统 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 */
相关推荐
皮蛋sol周2 分钟前
嵌入式学习数据结构(二)双向链表 内核链表
linux·数据结构·学习·嵌入式·arm·双向链表
Sleepy MargulisItG8 分钟前
【Linux网络编程】网络层协议:IP
linux·网络·tcp/ip
叠叠乐10 分钟前
移动家庭云电脑linux docker 容器登陆移动家庭云电脑
linux·运维·docker
Volunteer Technology23 分钟前
Centos7安装python和jupyter
linux·python·jupyter
馨谙29 分钟前
Linux面试题----rpm,dnf,Application Streams,Modules软件存储库
linux·运维·服务器
wdfk_prog32 分钟前
[Linux]学习笔记系列 -- [drivers][base]core
linux·笔记·学习
tan 9133 分钟前
KaliLinux2025.4 root用户修改显示语言
linux·服务器·前端·安全
Byte不洛43 分钟前
从除 0 到 SIGPIPE:Linux 信号的真正来源
linux
小码吃趴菜1 小时前
守护进程及其编程流程
linux·运维·服务器
久违8161 小时前
PHP 安全与部署知识总结
linux·ubuntu·php