深入理解计算机系统 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 */
相关推荐
奋斗的蛋黄28 分钟前
硬链接(Hard Link)与软连接(Symbolic Link)核心解析
linux
i建模1 小时前
Omarchy挂载windows磁盘
linux·运维·windows
林姜泽樾1 小时前
linux基础第一章,linux的介绍和它和windows的区别
linux·运维·计算机网络·安全·网络安全
nudt_qxx1 小时前
Ubuntu 26.04 LTS“坚毅浣熊”(Resolute Raccoon) 新特性前瞻
linux·数据库·ubuntu
白云偷星子1 小时前
RHCSA笔记6
linux·笔记
i建模1 小时前
在 **Omarchy**(基于 Arch Linux 的发行版)中检查当前内核是否支持 NTFS 文件系统
linux·运维·服务器
bwz999@88.com2 小时前
CentOS 7安装ollama
linux·centos·ollama
Emotional。2 小时前
AI Agent 开发实战:用 LangChain 构建智能邮件助手
linux·服务器·网络·人工智能·python·langchain
Galeoto2 小时前
how to deploy claude code
linux
Lsir10110_2 小时前
【Linux】线程管理——互斥锁
linux·运维·服务器