深入理解计算机系统 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 */
相关推荐
Edward111111111 小时前
linux创建普通用户
linux·运维·服务器
mzhan0172 小时前
Linux: rcu: 加速宽限期
linux·rcu
Fanfanaas2 小时前
Linux 基础开发工具(二)
linux·运维·服务器·c语言
雾岛听蓝2 小时前
Linux线程基础
linux·开发语言·经验分享
齐落山大勇2 小时前
Linux的文件IO
linux·运维·服务器
tod1133 小时前
深入解析ext2文件系统架构
linux·服务器·c++·文件系统·ext
萧行之3 小时前
FRP 0.62.0 + Mac Ollama 公网穿透部署+排障实录(标准 TOML 格式)
linux·服务器
齐潇宇3 小时前
文件共享服务器
linux·运维·网络·文件共享
顺顺 尼3 小时前
进程(从操作系统的状态到linux的进程状态一步到位)
linux·服务器