深入理解计算机系统 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 */
相关推荐
牛马鸡niumasi15 分钟前
C/C++ 程序编译过程、静态/动态链接、静态/动态库
linux
捧月华如1 小时前
Linux 系统性能压测工具全景指南(含工程实战)
linux·运维·服务器
YMWM_1 小时前
export MPLBACKEND=Agg命令使用
linux·python
想唱rap1 小时前
线程的同步与互斥
linux·运维·服务器·数据库·mysql
格林威2 小时前
SSD 写入速度测试命令(Linux)(基于工业相机高速存储)
linux·运维·开发语言·人工智能·数码相机·计算机视觉·工业相机
勇闯逆流河2 小时前
【LInux】linux控制(进程替换,自主shell的实现详解)
linux·运维·服务器
IMPYLH3 小时前
Linux 的 ls 命令
linux·运维·服务器·bash
笨笨饿3 小时前
33_顺序表(待完善)
linux·服务器·c语言·嵌入式硬件·算法·学习方法
wwj888wwj3 小时前
Ansible基础(复习1)
linux·运维·ansible
yj_xqj3 小时前
Linux network启动报错 && nmcli 的使用
linux·运维·服务器