深入理解计算机系统 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 */
相关推荐
不昀22 分钟前
网口Link Up后仍然掉线,怎样区分物理链路和数据通路问题?
linux·以太网
Lhan.zzZ1 小时前
Qt WebEngineView 在 Linux 上无法加载网页:从“看不见 HTML“到“禁用沙箱“
linux·c++·qt
Fcy6482 小时前
Linux下 多路转接select详解
linux·select·多路转接
无足鸟ICT3 小时前
【RHCA+】RPM包命名规则
linux·运维·服务器
Zucker n3 小时前
一款适合研究生科研工作安排的日历
linux·数据库·python
爱吃香菜的初学者3 小时前
十六.Linux——多线程(2)
linux·运维·开发语言
‎ദ്ദിᵔ.˛.ᵔ₎5 小时前
Linux:对有关 SIGCHLD 的深层理解
linux·运维·服务器
aichitang20245 小时前
QCU 2.0.0:补齐 Windows、Linux 与 GNOME Wayland
linux·运维·windows·ai·agent·ai编程
Lv_沐曦5 小时前
Linux 上的Web文件管理器-filebrowser
linux·运维·服务器