changed values for send_file_mode config parameter:
0 - winix will read the content of the file and send it back to the webserver 1 - winix will use send_file_header header with a full path to the file 2 - winix will use send_file_header header with a relative path to the file
This commit is contained in:
@@ -1162,6 +1162,45 @@ bool GetUTF8File(const std::wstring & file_path, std::wstring & content, bool cl
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool GetBinaryFile(const wchar_t * file_path, BinaryPage & content, bool clear_content)
|
||||
{
|
||||
char file[WINIX_OS_PATH_SIZE];
|
||||
char buffer[4096];
|
||||
size_t buffer_len = sizeof(buffer) / sizeof(char);
|
||||
std::ifstream get_file_content;
|
||||
|
||||
if( clear_content )
|
||||
content.clear();
|
||||
|
||||
if( !wide_to_utf8(file_path, file, WINIX_OS_PATH_SIZE) )
|
||||
return false;
|
||||
|
||||
get_file_content.open(file, std::ios_base::in | std::ios_base::binary);
|
||||
|
||||
if( !get_file_content )
|
||||
return false;
|
||||
|
||||
do
|
||||
{
|
||||
get_file_content.read(buffer, buffer_len);
|
||||
content.write(buffer, get_file_content.gcount());
|
||||
}
|
||||
while( !get_file_content.eof() && get_file_content.good() );
|
||||
|
||||
get_file_content.close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool GetBinaryFile(const std::wstring & file_path, BinaryPage & content, bool clear_content)
|
||||
{
|
||||
return GetBinaryFile(file_path.c_str(), content, clear_content);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// if there is no an extension it returns a pointer to the last '\0' character
|
||||
const wchar_t * GetFileExt(const wchar_t * name)
|
||||
{
|
||||
|
Reference in New Issue
Block a user