深入理解计算机系统 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 */
相关推荐
V__KING__4 小时前
systemd-remount-fs,fstab之间的渊源
linux·服务器·网络
酿情师4 小时前
Windows Subsystem for Linux (WSL, Ubuntu)安装教程(详细)
linux·windows·ubuntu
Titan20245 小时前
Linux环境变量个人笔记
linux·服务器·c++
青柠代码录5 小时前
【Linux】路径区分:testdir、testdir/、testdir/*
linux·运维·服务器
7yewh5 小时前
jetson_yolo_deployment 02_linux_dev_skills
linux·python·嵌入式硬件·yolo·嵌入式
supersolon6 小时前
Windows下WSL(Ubuntu24.04)安装Nodejs
linux·ubuntu·node.js
进击切图仔6 小时前
跨系统时间戳同步问题解决总结
linux
wsoz7 小时前
文件IO讲解
linux·嵌入式
mounter6257 小时前
基于MLX设备的Devlink 工具全指南与核心架构演进
linux·运维·服务器·网络·架构·kernel