added possibility to send static files to nginx via X-Accel-Redirect header
added to config:
int send_file_mode;
// 0 - full path to a file in send_file_header header
// 1 - relative path to a file in send_file_header (need http_send_file_relative_prefix set) (used for nginx)
std::wstring send_file_header;
// default: X-SENDFILE
// for Apache set: X-SENDFILE
// for Lighttpd set: X-LIGHTTPD-send-file
// for Nginx set: X-Accel-Redirect
std::wstring send_file_relative_prefix;
// relative prefix used for sending static files if send_file_mode is 1
// default: "upload-files-internal"
This commit is contained in:
@@ -971,6 +971,43 @@ return true;
|
||||
}
|
||||
|
||||
|
||||
bool System::MakeRelativeFilePath(const Item & item, const std::wstring & path_prefix, std::wstring & path, bool thumb)
|
||||
{
|
||||
path.clear();
|
||||
|
||||
if( item.item_content.file_path.empty() || item.item_content.file_type == WINIX_ITEM_FILETYPE_NONE )
|
||||
{
|
||||
log << log1 << "System: MakePath: this item has not a static file" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
// we allow the prefix to be empty
|
||||
if( !path_prefix.empty() )
|
||||
{
|
||||
if( path_prefix[0] != '/' )
|
||||
path += '/';
|
||||
|
||||
path += path_prefix;
|
||||
TrimLast(path, '/');
|
||||
}
|
||||
|
||||
if( item.item_content.file_fs == mounts.MountFsHashfs() )
|
||||
path += L"/hashfs";
|
||||
else
|
||||
path += L"/simplefs";
|
||||
|
||||
if( thumb )
|
||||
path += L"/thumb";
|
||||
else
|
||||
path += L"/normal";
|
||||
|
||||
path += '/';
|
||||
path += item.item_content.file_path;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// item can be a directory, file or a symlink
|
||||
// if item is a directory then the path will be with a slash at the end
|
||||
bool System::MakePath(const Item & item, std::wstring & path, bool clear_path)
|
||||
|
||||
Reference in New Issue
Block a user