Update Content-Type support for PDF (#361)

This commit is contained in:
ihmc3jn09hk 2020-02-23 18:31:27 +08:00 committed by GitHub
parent ee77800821
commit eb316d8263
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -89,6 +89,7 @@ enum ContentType
CT_APPLICATION_FONT_WOFF,
CT_APPLICATION_FONT_WOFF2,
CT_APPLICATION_VND_MS_FONTOBJ,
CT_APPLICATION_PDF,
CT_IMAGE_SVG_XML,
CT_IMAGE_PNG,
CT_IMAGE_JPG,

View File

@ -106,6 +106,11 @@ const string_view &webContentTypeToString(ContentType contenttype)
"Content-Type: application/vnd.ms-fontobject\r\n";
return sv;
}
case CT_APPLICATION_PDF:
{
static string_view sv = "Content-Type: application/pdf\r\n";
return sv;
}
case CT_IMAGE_PNG:
{
static string_view sv = "Content-Type: image/png\r\n";
@ -443,6 +448,8 @@ ContentType getContentType(const std::string &fileName)
case 'p':
if (extName == "png")
return CT_IMAGE_PNG;
else if(extName == "pdf")
return CT_APPLICATION_PDF;
break;
case 's':
if (extName == "svg")