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

@@ -405,6 +405,7 @@ void App::Close()
session_manager.DeleteSessions();
cur.request->Clear();
session_manager.UninitTmpSession();
functions.Finish();
// now all sessions are cleared
}
@@ -1492,29 +1493,29 @@ void App::PrepareHeadersStatic()
void App::PrepareHeaderContentType()
{
if( !cur.request->out_headers.has_key(L"Content-Type") )
if( !cur.request->out_headers.has_key(Winix::Header::content_type) )
{
if( !cur.request->send_bin_stream )
{
if( cur.request->return_json )
{
cur.request->out_headers.add(L"Content-Type", L"application/json; charset=UTF-8");
cur.request->out_headers.add(Winix::Header::content_type, L"application/json; charset=UTF-8");
}
else
{
switch( config.content_type_header )
{
case 1:
cur.request->out_headers.add(L"Content-Type", L"application/xhtml+xml; charset=UTF-8");
cur.request->out_headers.add(Winix::Header::content_type, L"application/xhtml+xml; charset=UTF-8");
break;
case 2:
cur.request->out_headers.add(L"Content-Type", L"application/xml; charset=UTF-8");
cur.request->out_headers.add(Winix::Header::content_type, L"application/xml; charset=UTF-8");
break;
case 0:
default:
cur.request->out_headers.add(L"Content-Type", L"text/html; charset=UTF-8");
cur.request->out_headers.add(Winix::Header::content_type, L"text/html; charset=UTF-8");
}
}
}