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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user