深入理解计算机系统 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 */
相关推荐
NEXU538 分钟前
Linux:套接字
linux·服务器·网络
morliz子轩2 小时前
基于WSL搭建Ubuntu 22.04.x LTS开发环境
linux·运维·ubuntu
Janspran3 小时前
嵌入式linux学习 -- 进程和线程
linux·运维·学习
Cosmoshhhyyy3 小时前
linux远程部署dify和mac本地部署dify
linux·运维·macos
路多辛5 小时前
Debian新一代的APT软件源配置文件格式DEB822详解
linux·运维·ubuntu·debian
-VE-5 小时前
Linux线程控制
linux
驱动探索者5 小时前
USB ADB 简介
linux·adb·驱动·usb
dessler7 小时前
Hadoop HDFS-部署和基本操作
linux·运维·hdfs
风静雪冷7 小时前
find命令解读
linux
小米里的大麦8 小时前
026 inode 与软硬链接
linux