added: setting a correct mime type for static files - using magic library

added: std::wstring file_mime_type to ItemContent - a mime type for static file
added: Header (core/header.h) - there will be header names defined, at the moment only content_type
added: FuncionsBase::Finish() - it is called at the end when the winix finishes
This commit is contained in:
2021-09-22 00:23:25 +02:00
parent 26ed7b80be
commit 9c5c74ba84
29 changed files with 364 additions and 35 deletions

View File

@@ -73,6 +73,9 @@ void Download::MakeGet()
cur->request->send_as_attachment = cur->request->IsParam(L"attachment");
bool is_thumb = (cur->request->item.item_content.file_has_thumb && cur->request->IsParam(L"thumb"));
if( !cur->request->item.item_content.file_mime_type.empty() )
cur->request->out_headers.add(Header::content_type, cur->request->item.item_content.file_mime_type);
if( config->send_file_mode == 0 || config->send_file_mode == 1 )
{
system->MakeFilePath(cur->request->item, cur->request->x_sendfile, is_thumb);
@@ -84,9 +87,9 @@ void Download::MakeGet()
if( !GetBinaryFile(cur->request->x_sendfile, cur->request->out_bin_stream) )
{
log << log1 << "Download: I cannot read the content of the file: " << cur->request->x_sendfile << logend;
// may it would be good to return a html page with an error?
}
// IMPROVEME it would be good to set Content-Type header too
cur->request->x_sendfile.clear();
cur->request->send_bin_stream = true;
}