深入理解计算机系统 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 */
相关推荐
Cyber4K1 小时前
【Nginx专项】基础入门篇:状态页、微更新、内容替换、读取、压缩及防盗链
linux·运维·服务器·nginx·github
shining2 小时前
当拿到一个新服务器时所需准备工作
linux·程序员
maosheng11463 小时前
linux的综合教程(搭建论坛教程)
linux
Deitymoon3 小时前
linux——TCPIP协议原理
linux·网络
独小乐3 小时前
018.使用I2C总线EEPROM|千篇笔记实现嵌入式全栈/裸机篇
linux·笔记·单片机·嵌入式硬件·arm·信息与通信
SPC的存折3 小时前
2、Docker命令与镜像、容器管理
linux·运维·服务器·docker·容器·eureka
D4c-lovetrain3 小时前
Linux个人心得26 (redis主从复制全流程,详细版)
linux·运维·服务器
晴天¥4 小时前
达梦数据库共享存储集群搭建(DSC双节点+Openfiler-IP SAN存储)
linux·数据库·达梦数据库
吃着火锅x唱着歌4 小时前
LeetCode 150.逆波兰表达式求值
linux·算法·leetcode
Bert.Cai4 小时前
Linux whoami命令详解
linux·运维