深入理解计算机系统 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 */
相关推荐
阿巴~阿巴~14 分钟前
Linux基本命令篇 —— alias命令
linux·服务器·bash
好名字更能让你们记住我1 小时前
Linux多线程(十二)之【生产者消费者模型】
linux·运维·服务器·jvm·windows·centos
学习编程的gas1 小时前
Linux开发工具——gcc/g++
linux·运维·服务器
嵌入式成长家1 小时前
ubuntu rules 使用规则
linux·ubuntu·rules 使用规则
_可乐无糖2 小时前
AWS WebRTC: 判断viewer端拉流是否稳定的算法
linux·服务器·webrtc·aws
数据智能老司机2 小时前
Linux内核编程——Linux设备模型
linux·架构·操作系统
BD_Marathon2 小时前
ubuntu防火墙使用
linux·ubuntu
dessler2 小时前
Kafka-消费者(Consumer)和消费者组(Consumer Group)
linux·运维·kafka
kfepiza2 小时前
Debian-10-standard用`networking`服务的`/etc/network/interfaces`配置文件设置多网卡多IPv6
linux·debian
进击的程序汪3 小时前
Linux 启动过程流程图--ARM版
linux·运维·arm开发