HTTP服务器软件系统的设计与实现(21)
时间:2017-02-21 13:09 来源:毕业论文 作者:毕业论文 点击:次
string extension = filepats[filepats.Length - 1]; return GetContentTypeByExtension(extension); } else return MimeType.none; } public static string GetStringMimeType(MimeType mime) { string strMime = ""; switch (mime) { case MimeType.text_html: strMime = "text/html; charset=utf-8"; break; case MimeType.text_javascript: strMime = "text/javascript"; break; case MimeType.multipart_xmixedreplace: strMime = "multipart/x-mixed-replace; boundary=rnA00A"; break; case MimeType.application_xml_charsetutf8: strMime = "application/xml; charset=utf-8"; break; default: strMime = mime.ToString().Replace("_", "/"); break; } return strMime; } public static MimeType GetContentTypeByExtension(string extension) { switch (extension) { case "css": return MimeType.text_css; case "gif": return MimeType.image_gif; case "jpg": case "jpeg": return MimeType.image_jpeg; (责任编辑:qin) |